public Property getIdentifierProperty() { //get direct identifiermapper or the one from the super mappedSuperclass // or the one from the super persistentClass Property propagatedIdentifierProp = identifierProperty; if ( propagatedIdentifierProp == null ) { if ( superMappedSuperclass != null ) { propagatedIdentifierProp = superMappedSuperclass.getIdentifierProperty(); } if (propagatedIdentifierProp == null && superPersistentClass != null){ propagatedIdentifierProp = superPersistentClass.getIdentifierProperty(); } } return propagatedIdentifierProp; }
public Property getIdentifierProperty() { return getSuperclass().getIdentifierProperty(); }
@Override public String getIdentifierPropertyName(String entityName) throws MappingException { final PersistentClass pc = entityBindingMap.get( entityName ); if ( pc == null ) { throw new MappingException( "persistent class not known: " + entityName ); } if ( !pc.hasIdentifierProperty() ) { return null; } return pc.getIdentifierProperty().getName(); }
@Override public String getIdentifierPropertyName(String entityName) throws MappingException { final PersistentClass pc = entityBindingMap.get( entityName ); if ( pc == null ) { throw new MappingException( "persistent class not known: " + entityName ); } if ( !pc.hasIdentifierProperty() ) { return null; } return pc.getIdentifierProperty().getName(); }
/** * Check to see if this PersistentClass defines a property with the given name. * * @param name The property name to check * * @return {@code true} if a property with that name exists; {@code false} if not */ @SuppressWarnings("WeakerAccess") public boolean hasProperty(String name) { final Property identifierProperty = getIdentifierProperty(); if ( identifierProperty != null && identifierProperty.getName().equals( name ) ) { return true; } final Iterator itr = getPropertyClosureIterator(); while ( itr.hasNext() ) { final Property property = (Property) itr.next(); if ( property.getName().equals( name ) ) { return true; } } return false; }
public Property getProperty(String propertyName) throws MappingException { Iterator iter = getPropertyClosureIterator(); Property identifierProperty = getIdentifierProperty(); if ( identifierProperty != null && identifierProperty.getName().equals( StringHelper.root( propertyName ) ) ) { return identifierProperty; } else { return getProperty( propertyName, iter ); } }
@Override public boolean isInPrimaryKey() { if ( entityClassName == null ) return false; final PersistentClass persistentClass = buildingContext.getMetadataCollector().getEntityBinding( entityClassName ); Property property = persistentClass.getIdentifierProperty(); if ( path == null ) { return false; } else if ( property != null) { //try explicit identifier property return path.startsWith( property.getName() + "." ); } else { //try the embedded property //embedded property starts their path with 'id.' See PropertyPreloadedData( ) use when idClass != null in AnnotationSourceProcessor if ( path.startsWith( "id." ) ) { KeyValue valueIdentifier = persistentClass.getIdentifier(); String localPath = path.substring( 3 ); if ( valueIdentifier instanceof Component ) { Iterator it = ( (Component) valueIdentifier ).getPropertyIterator(); while ( it.hasNext() ) { Property idProperty = (Property) it.next(); if ( localPath.startsWith( idProperty.getName() ) ) return true; } } } } return false; }
Property idProperty = associatedClass.getIdentifierProperty(); String idName = idProperty != null ? idProperty.getName() : null; try {
public void generateSecondPass(String entityName, PersistentClass persistentClass) { final Component identifierMapper = persistentClass.getIdentifierMapper(); final Property identifierProperty = persistentClass.getIdentifierProperty(); if ( identifierMapper != null ) { generateSecondPass( entityName, identifierMapper ); } else if ( identifierProperty != null && identifierProperty.isComposite() ) { final Component component = (Component) identifierProperty.getValue(); generateSecondPass( entityName, component ); } }
Property idProperty = associatedClass.getIdentifierProperty(); String idName = idProperty != null ? idProperty.getName() : null; try {
matchColumnsByProperty( ( (PersistentClass) columnOwner ).getIdentifierProperty(), columnsToProperty );
@Test public void testColumnDefinition() { Column idCol = ( Column ) metadata().getEntityBinding( Ball.class.getName() ) .getIdentifierProperty().getValue().getColumnIterator().next(); assertEquals( "ball_id", idCol.getName() ); }
final String element = (String) st.nextElement(); if ( property == null ) { Property identifierProperty = getIdentifierProperty(); if ( identifierProperty != null && identifierProperty.getName().equals( element ) ) {
@Test public void testApplyOnIdColumn() throws Exception { PersistentClass classMapping = metadata().getEntityBinding( Tv.class.getName() ); Column serialColumn = (Column) classMapping.getIdentifierProperty().getColumnIterator().next(); assertEquals( "Validator annotation not applied on ids", 2, serialColumn.getLength() ); }
try { if ( referencedPc.getIdentifierMapper() == null ) { parentPropItr = ( (Component) referencedPc.getIdentifierProperty() .getValue() ).getPropertyIterator();
idGetter = buildPropertyGetter( mappingInfo.getIdentifierProperty(), mappingInfo ); idSetter = buildPropertySetter( mappingInfo.getIdentifierProperty(), mappingInfo );
String mappedUnsavedValue = mappedEntity.getIdentifier().getNullValue(); Type type = mappedEntity.getIdentifier().getType(); Property property = mappedEntity.getIdentifierProperty();
try { if ( referencedPc.getIdentifierMapper() == null ) { parentPropIter = ( (Component) referencedPc.getIdentifierProperty() .getValue() ).getPropertyIterator();
if ( owner.getIdentifierProperty() != null ) { accessType = owner.getIdentifierProperty().getPropertyAccessorName().equals( "property" ) ? AccessType.PROPERTY : AccessType.FIELD;
final Property idProp = pc.getIdentifierProperty(); final Component idMapper = pc.getIdentifierMapper();