MappedSuperclass msc = persistentClass.getSuperMappedSuperclass(); while ( msc != null ) { classNames.add( msc.getMappedClass().getName() );
/** * Check to see if a property with the given name exists in this PersistentClass * or in any of its super hierarchy. Unlike {@link #isPropertyDefinedInSuperHierarchy}, * this method does check this PersistentClass * * @param name The property name to check * * @return {@code true} if a property with that name exists; {@code false} if not */ @SuppressWarnings({"WeakerAccess", "RedundantIfStatement"}) public boolean isPropertyDefinedInHierarchy(String name) { if ( hasProperty( name ) ) { return true; } if ( getSuperMappedSuperclass() != null && getSuperMappedSuperclass().isPropertyDefinedInHierarchy( name ) ) { return true; } if ( getSuperclass() != null && getSuperclass().isPropertyDefinedInHierarchy( name ) ) { return true; } return false; }
@SuppressWarnings("unchecked") private static EntityTypeImpl<?> buildEntityType(PersistentClass persistentClass, MetadataContext context) { final Class javaType = persistentClass.getMappedClass(); context.pushEntityWorkedOn( persistentClass ); final MappedSuperclass superMappedSuperclass = persistentClass.getSuperMappedSuperclass(); IdentifiableTypeDescriptor<?> superType = superMappedSuperclass == null ? null : locateOrBuildMappedSuperclassType( superMappedSuperclass, context ); //no mappedSuperclass, check for a super entity if ( superType == null ) { final PersistentClass superPersistentClass = persistentClass.getSuperclass(); superType = superPersistentClass == null ? null : locateOrBuildEntityType( superPersistentClass, context ); } EntityTypeImpl entityType = new EntityTypeImpl( javaType, superType, persistentClass, context.getSessionFactory() ); context.registerEntityType( persistentClass, entityType ); context.popEntityWorkedOn( persistentClass ); return entityType; }
/** * Check to see if a property with the given name exists in this PersistentClass * or in any of its super hierarchy. Unlike {@link #isPropertyDefinedInSuperHierarchy}, * this method does check this PersistentClass * * @param name The property name to check * * @return {@code true} if a property with that name exists; {@code false} if not */ @SuppressWarnings({"WeakerAccess", "RedundantIfStatement"}) public boolean isPropertyDefinedInHierarchy(String name) { if ( hasProperty( name ) ) { return true; } if ( getSuperMappedSuperclass() != null && getSuperMappedSuperclass().isPropertyDefinedInHierarchy( name ) ) { return true; } if ( getSuperclass() != null && getSuperclass().isPropertyDefinedInHierarchy( name ) ) { return true; } return false; }
@SuppressWarnings( "unchecked" ) private static EntityTypeImpl<?> buildEntityType(PersistentClass persistentClass, MetadataContext context) { final Class javaType = persistentClass.getMappedClass(); context.pushEntityWorkedOn(persistentClass); final MappedSuperclass superMappedSuperclass = persistentClass.getSuperMappedSuperclass(); AbstractIdentifiableType<?> superType = superMappedSuperclass == null ? null : locateOrBuildMappedsuperclassType( superMappedSuperclass, context ); //no mappedSuperclass, check for a super entity if (superType == null) { final PersistentClass superPersistentClass = persistentClass.getSuperclass(); superType = superPersistentClass == null ? null : locateOrBuildEntityType( superPersistentClass, context ); } EntityTypeImpl entityType = new EntityTypeImpl( javaType, superType, persistentClass.getJpaEntityName(), persistentClass.hasIdentifierProperty(), persistentClass.isVersioned() ); context.registerEntityType( persistentClass, entityType ); context.popEntityWorkedOn(persistentClass); return entityType; }