Tabnine Logo
AssertionFailure
Code IndexAdd Tabnine to your IDE (free)

How to use
AssertionFailure
in
org.hibernate.annotations.common

Best Java code snippets using org.hibernate.annotations.common.AssertionFailure (Showing top 20 results out of 315)

origin: hibernate/hibernate-orm

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;
}
origin: hibernate/hibernate-search

@Test
public void testUpdatingInTransaction() {
  assertFindsByRoadName( "buonarroti" );
  FullTextSession fullTextSession = Search.getFullTextSession( openSession() );
  try {
    Transaction tx = fullTextSession.beginTransaction();
    resetFieldSelector();
    List list = fullTextSession.createCriteria( BusStop.class ).list();
    assertNotNull( list );
    assertEquals( 4, list.size() );
    BusStop busStop = (BusStop) list.get( 1 );
    busStop.setRoadName( "new road" );
    tx.commit();
  }
  catch (org.hibernate.annotations.common.AssertionFailure ass) {
    fail( ass.getMessage() );
  }
  finally {
    fullTextSession.close();
  }
  assertFindsByRoadName( "new" );
}
origin: hibernate/hibernate-search

@Test
public void testUpdatingOutOfTransaction() {
  assertFindsByRoadName( "buonarroti" );
  FullTextSession fullTextSession = Search.getFullTextSession( openSession() );
  try {
    List list = fullTextSession.createCriteria( BusStop.class ).list();
    assertNotNull( list );
    assertEquals( 4, list.size() );
    BusStop busStop = (BusStop) list.get( 1 );
    busStop.setRoadName( "new road" );
    fullTextSession.flush();
  }
  catch (org.hibernate.annotations.common.AssertionFailure ass) {
    fail( ass.getMessage() );
  }
  finally {
    fullTextSession.close();
  }
  assertFindsByRoadName( "new" );
}
origin: hibernate/hibernate-orm

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()
    );
  }
}
origin: hibernate/hibernate-orm

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" );
  }
}
origin: hibernate/hibernate-orm

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();
}
origin: hibernate/hibernate-orm

/**
 * 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 );
}
origin: hibernate/hibernate-orm

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()
    );
  }
}
origin: hibernate/hibernate-orm

throw new AssertionFailure(
    "Unable to inject static metamodel attribute : " + metamodelClass.getName() + '#' + name,
origin: hibernate/hibernate-orm

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 );
  }
}
origin: hibernate/hibernate-orm

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 );
  }
}
origin: hibernate/hibernate-orm

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;
  }
}
origin: hibernate/hibernate-orm

throw new AssertionFailure( "Unexpected mapping type: " + mapping.getClass() );
origin: hibernate/hibernate-orm

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 );
  }
}
origin: hibernate/hibernate-orm

throw new AssertionFailure( "Unknown type : " + typeContext.getValueClassification() );
origin: hibernate/hibernate-orm

throw new AssertionFailure(
    "Define fetch strategy on a property not annotated with @ManyToOne nor @OneToMany nor @CollectionOfElements"
);
  throw new AssertionFailure( "Unknown FetchMode: " + fetch.value() );
origin: org.hibernate/hibernate-annotations

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" );
  }
}
origin: org.hibernate/hibernate-annotations

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();
}
origin: hibernate/hibernate-orm

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 );
origin: hibernate/hibernate-orm

throw new AssertionFailure(
    "CollectionSecondPass for oneToMany should not be called with null mappings"
);
org.hibernate.annotations.commonAssertionFailure

Javadoc

Indicates failure of an assertion: a possible bug in Hibernate.

Most used methods

  • <init>
  • getMessage

Popular in Java

  • Running tasks concurrently on multiple threads
  • setContentView (Activity)
  • getApplicationContext (Context)
  • onCreateOptionsMenu (Activity)
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now