public PersistentClass getPersistentClassHostingProperties(MappedSuperclassTypeImpl<?> mappedSuperclassType) { final PersistentClass persistentClass = mappedSuperClassTypeToPersistentClass.get( mappedSuperclassType ); if ( persistentClass == null ) { throw new AssertionFailure( "Could not find PersistentClass for MappedSuperclassType: " + mappedSuperclassType.getJavaType() ); } return persistentClass; }
public void popEntityWorkedOn(PersistentClass persistentClass) { final PersistentClass stackTop = stackOfPersistentClassesBeingProcessed.remove( stackOfPersistentClassesBeingProcessed.size() - 1 ); if ( stackTop != persistentClass ) { throw new AssertionFailure( "Inconsistent popping: " + persistentClass.getEntityName() + " instead of " + stackTop.getEntityName() ); } }
private void validateBind() { if ( property.isAnnotationPresent( Immutable.class ) ) { throw new AnnotationException( "@Immutable on property not allowed. " + "Only allowed on entity level or on a collection." ); } if ( !declaringClassSet ) { throw new AssertionFailure( "declaringClass has not been set before a bind" ); } }
private String getStringBasedPath(Path.Node traversableProperty, Path pathToTraversableObject) { StringBuilder path = new StringBuilder( ); for ( Path.Node node : pathToTraversableObject ) { if (node.getName() != null) { path.append( node.getName() ).append( "." ); } } if ( traversableProperty.getName() == null ) { throw new AssertionFailure( "TraversableResolver being passed a traversableProperty with null name. pathToTraversableObject: " + path.toString() ); } path.append( traversableProperty.getName() ); return path.toString(); }
/** * Constructs a JarProtocolArchiveDescriptor * * @param archiveDescriptorFactory The factory creating this * @param url The url to the JAR file * @param incomingEntry The prefix for entries within the JAR url */ public JarProtocolArchiveDescriptor( ArchiveDescriptorFactory archiveDescriptorFactory, URL url, String incomingEntry) { if ( incomingEntry != null && incomingEntry.length() > 0 ) { throw new IllegalArgumentException( "jar:jar: not supported: " + url ); } final String urlFile = url.getFile(); final int subEntryIndex = urlFile.lastIndexOf( "!" ); if ( subEntryIndex == -1 ) { throw new AssertionFailure( "JAR URL does not contain '!/' :" + url ); } final String subEntry; if ( subEntryIndex + 1 >= urlFile.length() ) { subEntry = ""; } else { subEntry = urlFile.substring( subEntryIndex + 1 ); } final URL fileUrl = archiveDescriptorFactory.getJarURLFromURLEntry( url, subEntry ); delegateDescriptor = archiveDescriptorFactory.buildArchiveDescriptor( fileUrl, subEntry ); }
private Class<?> getClassFromGenericArgument(java.lang.reflect.Type type) { if ( type instanceof Class ) { return (Class) type; } else if ( type instanceof TypeVariable ) { final java.lang.reflect.Type upperBound = ( (TypeVariable) type ).getBounds()[0]; return getClassFromGenericArgument( upperBound ); } else if ( type instanceof ParameterizedType ) { final java.lang.reflect.Type rawType = ( (ParameterizedType) type ).getRawType(); return getClassFromGenericArgument( rawType ); } else if ( type instanceof WildcardType ) { final java.lang.reflect.Type upperBound = ( (WildcardType) type ).getUpperBounds()[0]; return getClassFromGenericArgument( upperBound ); } else { throw new AssertionFailure( "Fail to process type argument in a generic declaration. Member : " + getMemberDescription() + " Type: " + type.getClass() ); } }
throw new AssertionFailure( "Unable to inject static metamodel attribute : " + metamodelClass.getName() + '#' + name,
private void addPropertyToPersistentClass(Property prop, XClass declaringClass) { if ( declaringClass != null ) { final InheritanceState inheritanceState = inheritanceStatePerClass.get( declaringClass ); if ( inheritanceState == null ) { throw new AssertionFailure( "Declaring class is not found in the inheritance state hierarchy: " + declaringClass ); } if ( inheritanceState.isEmbeddableSuperclass() ) { persistentClass.addMappedsuperclassProperty(prop); addPropertyToMappedSuperclass( prop, declaringClass ); } else { persistentClass.addProperty( prop ); } } else { persistentClass.addProperty( prop ); } }
private void addPropertyToJoin(Property prop, XClass declaringClass, Join join) { if ( declaringClass != null ) { final InheritanceState inheritanceState = inheritanceStatePerClass.get( declaringClass ); if ( inheritanceState == null ) { throw new AssertionFailure( "Declaring class is not found in the inheritance state hierarchy: " + declaringClass ); } if ( inheritanceState.isEmbeddableSuperclass() ) { join.addMappedsuperclassProperty(prop); addPropertyToMappedSuperclass( prop, declaringClass ); } else { join.addProperty( prop ); } } else { join.addProperty( prop ); } }
public static MappedSuperclass getMappedSuperclassOrNull( XClass declaringClass, Map<XClass, InheritanceState> inheritanceStatePerClass, MetadataBuildingContext context) { boolean retrieve = false; if ( declaringClass != null ) { final InheritanceState inheritanceState = inheritanceStatePerClass.get( declaringClass ); if ( inheritanceState == null ) { throw new org.hibernate.annotations.common.AssertionFailure( "Declaring class is not found in the inheritance state hierarchy: " + declaringClass ); } if ( inheritanceState.isEmbeddableSuperclass() ) { retrieve = true; } } if ( retrieve ) { return context.getMetadataCollector().getMappedSuperclass( context.getBootstrapContext().getReflectionManager().toClass( declaringClass ) ); } else { return null; } }
throw new AssertionFailure( "Unexpected mapping type: " + mapping.getClass() );
private EntityMetamodel getDeclarerEntityMetamodel(AbstractIdentifiableType<?> ownerType) { final Type.PersistenceType persistenceType = ownerType.getPersistenceType(); if ( persistenceType == Type.PersistenceType.ENTITY ) { return context.getSessionFactory() .getMetamodel() .entityPersister( ownerType.getTypeName() ) .getEntityMetamodel(); } else if ( persistenceType == Type.PersistenceType.MAPPED_SUPERCLASS ) { PersistentClass persistentClass = context.getPersistentClassHostingProperties( (MappedSuperclassTypeImpl<?>) ownerType ); return context.getSessionFactory() .getMetamodel() .entityPersister( persistentClass.getClassName() ) .getEntityMetamodel(); } else { throw new AssertionFailure( "Cannot get the metamodel for PersistenceType: " + persistenceType ); } }
throw new AssertionFailure( "Unknown type : " + typeContext.getValueClassification() );
throw new AssertionFailure( "Define fetch strategy on a property not annotated with @ManyToOne nor @OneToMany nor @CollectionOfElements" ); throw new AssertionFailure( "Unknown FetchMode: " + fetch.value() );
private void validateBind() { if ( property.isAnnotationPresent( Immutable.class ) ) { throw new AnnotationException( "@Immutable on property not allowed. " + "Only allowed on entity level or on a collection." ); } if ( !declaringClassSet ) { throw new AssertionFailure( "declaringClass has not been set before a bind" ); } }
private String getStringBasedPath(Path.Node traversableProperty, Path pathToTraversableObject) { StringBuilder path = new StringBuilder( ); for ( Path.Node node : pathToTraversableObject ) { if (node.getName() != null) { path.append( node.getName() ).append( "." ); } } if ( traversableProperty.getName() == null ) { throw new AssertionFailure( "TraversableResolver being passed a traversableProperty with null name. pathToTraversableObject: " + path.toString() ); } path.append( traversableProperty.getName() ); return path.toString(); }
if ( inheritanceStatePerClass == null) throw new AssertionFailure( "inheritanceStatePerClass not set" ); SecondPass sp = getSecondPass( fkJoinColumns, Property prop = binder.makeProperty(); if (! declaringClassSet) throw new AssertionFailure( "DeclaringClass is not set in CollectionBinder while binding" ); propertyHolder.addProperty( prop, declaringClass );
throw new AssertionFailure( "CollectionSecondPass for oneToMany should not be called with null mappings" );
public static MappedSuperclass getMappedSuperclassOrNull(XClass declaringClass, Map<XClass, InheritanceState> inheritanceStatePerClass, ExtendedMappings mappings) { boolean retrieve = false; if ( declaringClass != null ) { final InheritanceState inheritanceState = inheritanceStatePerClass.get( declaringClass ); if ( inheritanceState == null ) { throw new org.hibernate.annotations.common.AssertionFailure( "Declaring class is not found in the inheritance state hierarchy: " + declaringClass ); } if ( inheritanceState.isEmbeddableSuperclass() ) { retrieve = true; } } return retrieve ? mappings.getMappedSuperclass( mappings.getReflectionManager().toClass( declaringClass ) ) : null; }
throw new AssertionFailure( "Unable to guess collection property accessor name" );