/** * Build an iterator of properties which may be referenced in association mappings. * <p> * Includes properties defined in superclasses of the mapping inheritance. * Includes all properties defined as part of a join. * * @see #getReferencedProperty for a discussion of "referenceable" * @return The referenceable property iterator. */ public Iterator getReferenceablePropertyIterator() { return getPropertyClosureIterator(); }
public Iterator getSubclassPropertyClosureIterator() { ArrayList iters = new ArrayList(); iters.add( getPropertyClosureIterator() ); iters.add( subclassProperties.iterator() ); for ( int i = 0; i < subclassJoins.size(); i++ ) { Join join = subclassJoins.get( i ); iters.add( join.getPropertyIterator() ); } return new JoinedIterator( iters ); }
/** * 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 Iterator getPropertyClosureIterator() { return new JoinedIterator( getSuperclass().getPropertyClosureIterator(), getPropertyIterator() ); } public Iterator getTableClosureIterator() {
public Property getRecursiveProperty(String propertyPath) throws MappingException { try { return getRecursiveProperty( propertyPath, getPropertyClosureIterator() ); } catch (MappingException e) { throw new MappingException( "property [" + propertyPath + "] not found on entity [" + getEntityName() + "]", e ); } }
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 ); } }
final Iterator itr = mappedEntity.getPropertyClosureIterator(); while ( itr.hasNext() ) { i++;
private void dump(PersistentClass entityBinding, TheEntity theEntity) { final Iterator propertyBindingIterator = entityBinding.getPropertyClosureIterator(); while ( propertyBindingIterator.hasNext() ) { final Property propertyBinding = (Property) propertyBindingIterator.next(); final JavaTypeDescriptor javaTypeDescriptor = ( (AbstractStandardBasicType) propertyBinding.getType() ).getJavaTypeDescriptor(); System.out.println( String.format( "%s (%s) -> %s", propertyBinding.getName(), javaTypeDescriptor.getJavaType().getSimpleName(), javaTypeDescriptor.toString( propertyBinding.getGetter( TheEntity.class ).get( theEntity ) ) ) ); } }
@Test public void basicTests() { final PersistentClass entityBinding = metadata().getEntityBinding( TheEntity.class.getName() ); final Iterator propertyBindingIterator = entityBinding.getPropertyClosureIterator(); while ( propertyBindingIterator.hasNext() ) { final Property propertyBinding = (Property) propertyBindingIterator.next(); assertFalse( "Found property bound as Serializable : " + propertyBinding.getName(), propertyBinding.getType() instanceof SerializableType ); } TheEntity theEntity = new TheEntity( 1 ); Session s = openSession(); s.beginTransaction(); s.save( theEntity ); s.getTransaction().commit(); s.close(); s = openSession(); s.beginTransaction(); theEntity = (TheEntity) s.get( TheEntity.class, 1 ); dump( entityBinding, theEntity ); assertNotNull( theEntity ); s.delete( theEntity ); s.getTransaction().commit(); s.close(); }
ArrayList lazyColAliases = new ArrayList(); iter = persistentClass.getPropertyClosureIterator(); i = 0; boolean foundFormula = false;
final Iterator props = entityBinding.getPropertyClosureIterator(); while ( props.hasNext() ) { final Property prop = (Property) props.next();
naturalOrderPropertyTableNumbers = new int[hydrateSpan]; propertyTableNumbers = new int[hydrateSpan]; Iterator iter = persistentClass.getPropertyClosureIterator(); int i = 0; while ( iter.hasNext() ) {
Iterator iter = persistentClass.getPropertyClosureIterator(); int i = 0; while ( iter.hasNext() ) {
setters = new Setter[propertySpan]; Iterator itr = mappingInfo.getPropertyClosureIterator(); boolean foundCustomAccessor = false; int i = 0;
Iterator iter = persistentClass.getPropertyClosureIterator(); int i = 0; int tempVersionProperty = NO_VERSION_INDX;
/** * Build an iterator of properties which are "referenceable". * * @see #getReferencedProperty for a discussion of "referenceable" * @return The property iterator. */ public Iterator getReferenceablePropertyIterator() { return getPropertyClosureIterator(); }
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 ); } }
public Iterator getPropertyClosureIterator() { return new JoinedIterator( getSuperclass().getPropertyClosureIterator(), getPropertyIterator() ); } public Iterator getTableClosureIterator() {
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 ); } }
public Property getProperty(String propertyName) throws MappingException { Iterator iter = getPropertyClosureIterator(); Property identifierProperty = (Property) getIdentifierAttributeMapping(); if ( identifierProperty != null && identifierProperty.getName().equals( StringHelper.root( propertyName ) ) ) { return identifierProperty; } else { return getProperty( propertyName, iter ); } }