javax.persistence.Embedded Java Examples
The following examples show how to use
javax.persistence.Embedded.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: IndicatorElement.java From cia with Apache License 2.0 | 5 votes |
/** * Gets the source. * * @return the source */ @Embedded @AttributeOverrides({ @AttributeOverride(name = "value", column = @Column(name = "SOURCE_VALUE")), @AttributeOverride(name = "id", column = @Column(name = "SOURCE_ID")) }) public Source getSource() { return source; }
Example #2
Source File: IdentifiedObjectTests.java From OpenESPI-DataCustodian-java with Apache License 2.0 | 5 votes |
@Test public void upLink() { assertAnnotationPresent(IdentifiedObject.class, "upLink", XmlTransient.class); assertAnnotationPresent(IdentifiedObject.class, "upLink", Embedded.class); }
Example #3
Source File: DbUtil.java From cloudstack with Apache License 2.0 | 5 votes |
public static Field findField(Class<?> clazz, String columnName) { for (Field field : clazz.getDeclaredFields()) { if (field.getAnnotation(Embedded.class) != null || field.getAnnotation(EmbeddedId.class) != null) { findField(field.getClass(), columnName); } else { if (columnName.equals(DbUtil.getColumnName(field))) { return field; } } } return null; }
Example #4
Source File: CountryElement.java From cia with Apache License 2.0 | 5 votes |
/** * Gets the lending type. * * @return the lending type */ @Embedded @AttributeOverrides({ @AttributeOverride(name = "value", column = @Column(name = "LENDING_TYPE_VALUE")), @AttributeOverride(name = "id", column = @Column(name = "LENDING_TYPE_ID")) }) public LendingType getLendingType() { return lendingType; }
Example #5
Source File: CountryElement.java From cia with Apache License 2.0 | 5 votes |
/** * Gets the income level. * * @return the income level */ @Embedded @AttributeOverrides({ @AttributeOverride(name = "value", column = @Column(name = "INCOME_LEVEL_VALUE")), @AttributeOverride(name = "id", column = @Column(name = "INCOME_LEVEL_ID")) }) public IncomeLevel getIncomeLevel() { return incomeLevel; }
Example #6
Source File: CountryElement.java From cia with Apache License 2.0 | 5 votes |
/** * Gets the adminregion. * * @return the adminregion */ @Embedded @AttributeOverrides({ @AttributeOverride(name = "value", column = @Column(name = "ADMINREGION_VALUE")), @AttributeOverride(name = "id", column = @Column(name = "ADMINREGION_ID")) }) public Adminregion getAdminregion() { return adminregion; }
Example #7
Source File: CountryElement.java From cia with Apache License 2.0 | 5 votes |
/** * Gets the region. * * @return the region */ @Embedded @AttributeOverrides({ @AttributeOverride(name = "value", column = @Column(name = "REGION_VALUE")), @AttributeOverride(name = "id", column = @Column(name = "REGION_ID")) }) public Region getRegion() { return region; }
Example #8
Source File: WorldBankData.java From cia with Apache License 2.0 | 5 votes |
/** * Gets the country. * * @return the country */ @Embedded @AttributeOverrides({ @AttributeOverride(name = "value", column = @Column(name = "COUNTRY_VALUE")), @AttributeOverride(name = "id", column = @Column(name = "COUNTRY_ID")) }) public Country getCountry() { return country; }
Example #9
Source File: WorldBankData.java From cia with Apache License 2.0 | 5 votes |
/** * Gets the indicator. * * @return the indicator */ @Embedded @AttributeOverrides({ @AttributeOverride(name = "value", column = @Column(name = "INDICATOR_VALUE")), @AttributeOverride(name = "id", column = @Column(name = "INDICATOR_ID")) }) public Indicator getIndicator() { return indicator; }
Example #10
Source File: EntityCallbacksListenerTest.java From nomulus with Apache License 2.0 | 5 votes |
private static boolean hasMethodAnnotatedWithEmbedded(Class<?> entityType) { boolean result = false; Class<?> parentType = entityType.getSuperclass(); if (parentType != null && parentType.isAnnotationPresent(MappedSuperclass.class)) { result = hasMethodAnnotatedWithEmbedded(parentType); } for (Method method : entityType.getDeclaredMethods()) { if (method.isAnnotationPresent(Embedded.class)) { result = true; break; } } return result; }
Example #11
Source File: EntityCallbacksListener.java From nomulus with Apache License 2.0 | 5 votes |
private Stream<Object> findEmbeddedProperties(Object object, Class<?> clazz) { return Arrays.stream(clazz.getDeclaredFields()) .filter(field -> !field.isAnnotationPresent(Transient.class)) .filter( field -> field.isAnnotationPresent(Embedded.class) || field.getType().isAnnotationPresent(Embeddable.class)) .filter(field -> !Modifier.isStatic(field.getModifiers())) .map(field -> getFieldObject(field, object)) .filter(Objects::nonNull); }
Example #12
Source File: DbUtil.java From cosmic with Apache License 2.0 | 5 votes |
public static Field findField(final Class<?> clazz, final String columnName) { for (final Field field : clazz.getDeclaredFields()) { if (field.getAnnotation(Embedded.class) != null || field.getAnnotation(EmbeddedId.class) != null) { findField(field.getClass(), columnName); } else { if (columnName.equals(DbUtil.getColumnName(field))) { return field; } } } return null; }
Example #13
Source File: InlineDirtyCheckingHandler.java From lams with GNU General Public License v2.0 | 5 votes |
static Implementation wrap( TypeDescription managedCtClass, ByteBuddyEnhancementContext enhancementContext, FieldDescription persistentField, Implementation implementation) { if ( enhancementContext.doDirtyCheckingInline( managedCtClass ) ) { if ( enhancementContext.isCompositeClass( managedCtClass ) ) { implementation = Advice.to( CodeTemplates.CompositeDirtyCheckingHandler.class ).wrap( implementation ); } else if ( !EnhancerImpl.isAnnotationPresent( persistentField, Id.class ) && !EnhancerImpl.isAnnotationPresent( persistentField, EmbeddedId.class ) && !( persistentField.getType().asErasure().isAssignableTo( Collection.class ) && enhancementContext.isMappedCollection( persistentField ) ) ) { implementation = new InlineDirtyCheckingHandler( implementation, managedCtClass, persistentField.asDefined() ); } if ( enhancementContext.isCompositeClass( persistentField.getType().asErasure() ) && EnhancerImpl.isAnnotationPresent( persistentField, Embedded.class ) ) { implementation = Advice.withCustomMapping() .bind( CodeTemplates.FieldValue.class, persistentField ) .bind( CodeTemplates.FieldName.class, persistentField.getName() ) .to( CodeTemplates.CompositeFieldDirtyCheckingHandler.class ) .wrap( implementation ); } } return implementation; }
Example #14
Source File: PersistentAttributesEnhancer.java From lams with GNU General Public License v2.0 | 5 votes |
private void handleCompositeField(CtClass managedCtClass, CtField persistentField, CtMethod fieldWriter) throws NotFoundException, CannotCompileException { if ( !enhancementContext.isCompositeClass( persistentField.getType() ) || !PersistentAttributesHelper.hasAnnotation( persistentField, Embedded.class ) ) { return; } // make sure to add the CompositeOwner interface addCompositeOwnerInterface( managedCtClass ); // cleanup previous owner fieldWriter.insertBefore( String.format( "if (%1$s != null) { ((%2$s) %1$s).%3$s(\"%1$s\"); }%n", persistentField.getName(), CompositeTracker.class.getName(), EnhancerConstants.TRACKER_COMPOSITE_CLEAR_OWNER ) ); // trigger track changes fieldWriter.insertAfter( String.format( "if (%1$s != null) { ((%2$s) %1$s).%4$s(\"%1$s\", (%3$s) this); }%n" + "%5$s(\"%1$s\");", persistentField.getName(), CompositeTracker.class.getName(), CompositeOwner.class.getName(), EnhancerConstants.TRACKER_COMPOSITE_SET_OWNER, EnhancerConstants.TRACKER_CHANGER_NAME ) ); }
Example #15
Source File: Customer.java From quarkus with Apache License 2.0 | 4 votes |
@Embedded public Address getAddress() { return address; }
Example #16
Source File: GlobalDiscoveryEntryPersisted.java From joynr with Apache License 2.0 | 4 votes |
@Column @Embedded public ProviderQosPersisted getProviderQosPersisted() { return providerQosPersisted; }
Example #17
Source File: ReadingTypePersistenceTests.java From OpenESPI-Common-java with Apache License 2.0 | 4 votes |
@Test public void argument() { TestUtils.assertAnnotationPresent(ReadingType.class, "argument", Embedded.class); }
Example #18
Source File: ReadingTypePersistenceTests.java From OpenESPI-Common-java with Apache License 2.0 | 4 votes |
@Test public void interhamonic() { TestUtils.assertAnnotationPresent(ReadingType.class, "interharmonic", Embedded.class); }
Example #19
Source File: Customer.java From quarkus with Apache License 2.0 | 4 votes |
@Embedded public Address getAddress() { return address; }
Example #20
Source File: Book.java From cxf with Apache License 2.0 | 4 votes |
@Embedded public OwnerAddress getAddress() { return address; }
Example #21
Source File: OwnerInfo.java From cxf with Apache License 2.0 | 4 votes |
@Embedded public Name getName() { return name; }
Example #22
Source File: D.java From hyperjaxb3 with BSD 2-Clause "Simplified" License | 4 votes |
@Embedded @AssociationOverride(name = "f"/*, joinColumns = { @JoinColumn(name = "E_F") }*/) public E getE() { return e; }
Example #23
Source File: PersistentAttributeTransformer.java From lams with GNU General Public License v2.0 | 4 votes |
DynamicType.Builder<?> applyTo(DynamicType.Builder<?> builder, boolean accessor) { boolean compositeOwner = false; builder = builder.visit( new AsmVisitorWrapper.ForDeclaredMethods().method( not( nameStartsWith( "$$_hibernate_" ) ), this ) ); for ( FieldDescription enhancedField : enhancedFields ) { builder = builder .defineMethod( EnhancerConstants.PERSISTENT_FIELD_READER_PREFIX + enhancedField.getName(), enhancedField.getType().asErasure(), Visibility.PUBLIC ) .intercept( accessor ? FieldAccessor.ofField( enhancedField.getName() ).in( enhancedField.getDeclaringType().asErasure() ) : fieldReader( enhancedField ) ) .defineMethod( EnhancerConstants.PERSISTENT_FIELD_WRITER_PREFIX + enhancedField.getName(), TypeDescription.VOID, Visibility.PUBLIC ) .withParameters( enhancedField.getType().asErasure() ) .intercept( accessor ? FieldAccessor.ofField( enhancedField.getName() ).in( enhancedField.getDeclaringType().asErasure() ) : fieldWriter( enhancedField ) ); if ( !compositeOwner && !accessor && EnhancerImpl.isAnnotationPresent( enhancedField, Embedded.class ) && enhancementContext.isCompositeClass( enhancedField.getType().asErasure() ) && enhancementContext.doDirtyCheckingInline( managedCtClass ) ) { compositeOwner = true; } } if ( compositeOwner ) { builder = builder.implement( CompositeOwner.class ); if ( enhancementContext.isCompositeClass( managedCtClass ) ) { builder = builder.defineMethod( EnhancerConstants.TRACKER_CHANGER_NAME, void.class, Visibility.PUBLIC ) .withParameters( String.class ) .intercept( Advice.to( CodeTemplates.CompositeOwnerDirtyCheckingHandler.class ).wrap( StubMethod.INSTANCE ) ); } } if ( enhancementContext.doExtendedEnhancement( managedCtClass ) ) { builder = applyExtended( builder ); } return builder; }
Example #24
Source File: Address.java From microservice-monitoring with MIT License | 4 votes |
@Embedded public GeoPoint getLocation() { return location; }
Example #25
Source File: MCRCategoryImpl.java From mycore with GNU General Public License v3.0 | 4 votes |
@Override @Embedded public MCRCategoryID getId() { return super.getId(); }
Example #26
Source File: Address.java From requery with Apache License 2.0 | 4 votes |
@Embedded public abstract Coordinate getCoordinate();
Example #27
Source File: Address.java From requery with Apache License 2.0 | 4 votes |
@Embedded Coordinate getCoordinate();
Example #28
Source File: EntityCallbacksListenerTest.java From nomulus with Apache License 2.0 | 4 votes |
@Embedded EntityEmbedded getEntityEmbedded() { return new EntityEmbedded(); }
Example #29
Source File: MybatisPersistentPropertyImpl.java From spring-data-mybatis with Apache License 2.0 | 4 votes |
@Override public boolean isEmbeddable() { return isAnnotationPresent(Embedded.class) || hasActualTypeAnnotation(Embeddable.class); }
Example #30
Source File: ContentFilter.java From uyuni with GNU General Public License v2.0 | 2 votes |
/** * Gets the criteria. * * @return criteria */ @Embedded public FilterCriteria getCriteria() { return criteria; }