Codota Logo
MappingException
Code IndexAdd Codota to your IDE (free)

How to use
MappingException
in
org.hibernate

Best Java code snippets using org.hibernate.MappingException (Showing top 20 results out of 369)

Refine searchRefine arrow

  • PersistentClass
  • Property
  • Type
  • KeyValue
  • Table
  • Column
  • Common ways to obtain MappingException
private void myMethod () {
MappingException m =
  • Codota IconString str;Throwable cause;new MappingException(str, cause)
  • Codota IconString message;new MappingException(message)
  • Codota IconThrowable cause;new MappingException(cause)
  • Smart code suggestions by Codota
}
origin: hibernate/hibernate-orm

Iterator idColumnsIt = referencedEntity.getKey().getColumnIterator();
while ( idColumnsIt.hasNext() ) {
  idColumns.add( (Column) idColumnsIt.next() );
if ( columnOwner == null ) {
  try {
    throw new MappingException(
        "Unable to find column with logical name: "
            + columns[0].getReferencedColumn() + " in " + referencedEntity.getTable() + " and its related "
            + "supertables and secondary tables"
    );
    throw new RecoverableException( e.getMessage(), e );
    ( (PersistentClass) columnOwner ).getTable() :
    ( (Join) columnOwner ).getTable();
      throw new MappingException(
          "Unable to find column with logical name: "
              + logicalReferencedColumnName + " in " + matchingTable.getName()
      );
    Column refCol = new Column( referencedColumnName );
    boolean contains = idColumns.contains( refCol );
    if ( !contains ) {
origin: hibernate/hibernate-orm

prop.setOptional( optional );
if ( BinderHelper.isEmptyAnnotationValue( mappedBy ) ) {
  try {
    if ( otherSide == null ) {
      throw new MappingException( "Unable to find entity: " + value.getReferencedEntityName() );
    );
  if ( otherSideProperty.getValue() instanceof OneToOne ) {
    propertyHolder.addProperty( prop, inferredData.getDeclaringClass() );
  else if ( otherSideProperty.getValue() instanceof ManyToOne ) {
    Iterator it = otherSide.getJoinIterator();
    Join otherSideJoin = null;
    while ( it.hasNext() ) {
      referencesDerivedId = otherSide.getIdentifier() instanceof Component
          && ( (Component) otherSide.getIdentifier() ).getProperty( mappedBy ) != null;
origin: hibernate/hibernate-orm

    throw new MappingException( "Discriminator formulas on joined inheritance hierarchies not supported at this time" );
    explicitDiscriminatorColumnName = column.getQuotedName( factory.getDialect() );
    discriminatorAlias = column.getAlias( factory.getDialect(), persistentClass.getRootTable() );
      throw new MappingException("Illegal discriminator type: " + discriminatorType.getName() );
      throw new MappingException("Could not format discriminator value to SQL string", e);
    throw new MappingException( "Could not format discriminator value to SQL string", e );
throw new MappingException( "optimistic-lock=all|dirty not supported for joined-subclass mappings [" + getEntityName() + "]" );
keyColumnReaders.add( keyColReaders );
keyColumnReaderTemplates.add( keyColReaderTemplates );
cascadeDeletes.add( key.isCascadeDeleteEnabled() && factory.getDialect().supportsCascadeDelete() );
int joinIdColumnSpan = key.getColumnSpan();
propTableNumbers.add( tabnum );
          throw new MappingException( "Illegal discriminator type: " + discriminatorType.getName() );
          throw new MappingException( "Could not format discriminator value to SQL string", e);
  throw new MappingException( "Error parsing discriminator value", e );
origin: hibernate/hibernate-orm

deleteResultCheckStyles = new ExecuteUpdateResultCheckStyle[joinSpan];
customSQLInsert[0] = persistentClass.getCustomSQLInsert();
      : join.getCustomSQLDeleteCheckStyle();
  while ( iter.hasNext() ) {
    Column col = (Column) iter.next();
    keyCols[i++] = col.getQuotedName( factory.getDialect() );
    throw new MappingException( "discriminator mapping required for single table polymorphic persistence" );
    discriminatorColumnName = column.getQuotedName( factory.getDialect() );
      throw new MappingException( "Illegal discriminator type: " + discriminatorType.getName() );
      throw new MappingException( "Could not format discriminator value to SQL string", e );
      prop.getPersistentClass().getEntityName() + '.' + prop.getName(),
      join
  );
        throw new MappingException( "Illegal discriminator type: " + discriminatorType.getName() );
        throw new MappingException( "Error parsing discriminator value", e );
origin: hibernate/hibernate-orm

this.sessionFactory = sessionFactory;
name = persistentClass.getEntityName();
rootName = persistentClass.getRootClass().getEntityName();
);
versioned = persistentClass.isVersioned();
if ( persistentClass.hasPojoRepresentation() ) {
  if ( "id".equals( prop.getName() ) ) {
    foundNonIdentifierPropertyNamedId = true;
  nonlazyPropertyUpdateability[i] = properties[i].isUpdateable() && !lazy;
  propertyCheckability[i] = propertyUpdateability[i] ||
      ( propertyTypes[i].isAssociationType() && ( (AssociationType) propertyTypes[i] ).isAlwaysDirtyChecked() );
  if ( propertyTypes[i].isMutable() && propertyCheckability[i] ) {
    foundMutable = true;
        || optimisticLockStyle == OptimisticLockStyle.DIRTY;
if ( isAllOrDirty && !dynamicUpdate ) {
  throw new MappingException( "optimistic-lock=all|dirty requires dynamic-update=\"true\": " + name );
  throw new MappingException( "version and optimistic-lock=all|dirty are not a valid combination : " + name );
origin: hibernate/hibernate-orm

  Set<ForeignKey> done,
  final MetadataBuildingContext buildingContext) throws MappingException {
table.createForeignKeys();
Iterator itr = table.getForeignKeyIterator();
while ( itr.hasNext() ) {
  final ForeignKey fk = (ForeignKey) itr.next();
    final String referencedEntityName = fk.getReferencedEntityName();
    if ( referencedEntityName == null ) {
      throw new MappingException(
          "An association from the table " +
              fk.getTable().getName() +
              " does not specify the referenced entity"
      );
    final PersistentClass referencedClass = getEntityBinding( referencedEntityName );
    if ( referencedClass == null ) {
      throw new MappingException(
          "An association from the table " +
              fk.getTable().getName() +
      );
    if ( referencedClass.isJoinedSubclass() ) {
      secondPassCompileForeignKeys( referencedClass.getSuperclass().getTable(), done, buildingContext );
origin: hibernate/hibernate-orm

private void alignColumns(Table referencedTable) {
  final int referencedPkColumnSpan = referencedTable.getPrimaryKey().getColumnSpan();
  if ( referencedPkColumnSpan != getColumnSpan() ) {
    StringBuilder sb = new StringBuilder();
    sb.append( "Foreign key (" ).append( getName() ).append( ":" )
        .append( getTable().getName() )
        .append( " [" );
    appendColumns( sb, getColumnIterator() );
    sb.append( "])" )
        .append( ") must have same number of columns as the referenced primary key (" )
        .append( referencedTable.getName() )
        .append( " [" );
    appendColumns( sb, referencedTable.getPrimaryKey().getColumnIterator() );
    sb.append( "])" );
    throw new MappingException( sb.toString() );
  }
  Iterator fkCols = getColumnIterator();
  Iterator pkCols = referencedTable.getPrimaryKey().getColumnIterator();
  while ( pkCols.hasNext() ) {
    ( (Column) fkCols.next() ).setLength( ( (Column) pkCols.next() ).getLength() );
  }
}
origin: hibernate/hibernate-orm

Class mappedClass = persistentClass.getMappedClass();
Class proxyInterface = persistentClass.getProxyInterface();
    throw new MappingException(
        "proxy must be either an interface, or the class itself: " + getEntityName()
    );
Iterator<Subclass> subclasses = persistentClass.getSubclassIterator();
while ( subclasses.hasNext() ) {
  final Subclass subclass = subclasses.next();
  if ( subclassProxy != null && !subclassClass.equals( subclassProxy ) ) {
    if ( !subclassProxy.isInterface() ) {
      throw new MappingException(
          "proxy must be either an interface, or the class itself: " + subclass.getEntityName()
      );
while ( properties.hasNext() ) {
  Property property = (Property) properties.next();
  Method method = property.getGetter( clazz ).getMethod();
  if ( method != null && Modifier.isFinal( method.getModifiers() ) ) {
    LOG.gettersOfLazyClassesCannotBeFinal( persistentClass.getEntityName(), property.getName() );
  method = property.getSetter( clazz ).getMethod();
  if ( method != null && Modifier.isFinal( method.getModifiers() ) ) {
    LOG.settersOfLazyClassesCannotBeFinal( persistentClass.getEntityName(), property.getName() );
origin: hibernate/hibernate-orm

  throw new MappingException(
      "Cannot use identity column key generation with <union-subclass> mapping for: " +
          getEntityName()
tableName = determineTableName( persistentClass.getTable(), jdbcEnvironment );
boolean callable = false;
ExecuteUpdateResultCheckStyle checkStyle = null;
sql = persistentClass.getCustomSQLInsert();
callable = sql != null && persistentClass.isCustomInsertCallable();
checkStyle = sql == null
    ? ExecuteUpdateResultCheckStyle.COUNT
  while ( iter.hasNext() ) {
    Table tab = (Table) iter.next();
    if ( !tab.isAbstractUnionTable() ) {
      final String tableName = determineTableName( tab, jdbcEnvironment );
      tableNames.add( tableName );
      String[] key = new String[idColumnSpan];
      Iterator citer = tab.getPrimaryKey().getColumnIterator();
      for ( int k = 0; k < idColumnSpan; k++ ) {
        key[k] = ( (Column) citer.next() ).getQuotedName( factory.getDialect() );
origin: org.hibernate/hibernate-tools

while( iterator.hasNext() ) {
  Element element = (Element) iterator.next();
  Column column = new Column();
  column.setName( element.attributeValue("name") );
  String attributeValue = element.attributeValue("jdbc-type");
  if(StringHelper.isNotEmpty(attributeValue)) {
    column.setSqlTypeCode(new Integer(JDBCToHibernateTypeHelper.getJDBCType(attributeValue)));
  if(table.getColumn(column)!=null) {
    throw new MappingException("Column " + column.getName() + " already exists in table " + tableIdentifier );
  table.addColumn(column);
  columnNames.add(column.getName());
  repository.setTypeNameForColumn(tableIdentifier, column.getName(), element.attributeValue("type"));
    List<Column> foreignColumns = new ArrayList<Column>();
    Table foreignTable = new Table();
    foreignTable.setName(foreignTableName);
    foreignTable.setCatalog(getValue(element.attributeValue( "foreign-catalog"),table.getCatalog()) );
      throw new MappingException("foreign-column is required when foreign-table is specified on " + column);
origin: hibernate/hibernate-orm

public void validate(Mapping mapping) throws MappingException {
  Iterator iter = getPropertyIterator();
  while ( iter.hasNext() ) {
    Property prop = (Property) iter.next();
    if ( !prop.isValid( mapping ) ) {
      throw new MappingException(
          "property mapping has wrong number of columns: " +
              StringHelper.qualify( getEntityName(), prop.getName() ) +
              " type: " +
              prop.getType().getName()
      );
    }
  }
  checkPropertyDuplication();
  checkColumnDuplication();
}
origin: hibernate/hibernate-orm

throw new MappingException(
    String.format("Association [%s] for entity [%s] references unmapped class [%s]",
        propertyName, propertyHolder.getClassName(), assocClass)
LOG.debugf( "Mapping collection: %s -> %s", collection.getRole(), collection.getCollectionTable().getName() );
  && !collection.getKey().isNullable() ) {
prop.setSelectable( false );
prop.setCollectionRole( collection.getRole() );
prop.setEntityName( collection.getOwner().getEntityName() );
prop.setValue( collection.getKey() );
referenced.addProperty( prop );
origin: hibernate/hibernate-orm

  final String element = (String) st.nextElement();
  if ( property == null ) {
    Property identifierProperty = getIdentifierProperty();
    if ( identifierProperty != null && identifierProperty.getName().equals( element ) ) {
    else if ( identifierProperty == null && getIdentifierMapper() != null ) {
        identifierProperty = getProperty( element, getIdentifierMapper().getPropertyIterator() );
        if ( identifierProperty != null ) {
    property = ( (Component) property.getValue() ).getProperty( element );
throw new MappingException( "property [" + propertyPath + "] not found on entity [" + getEntityName() + "]" );
origin: hibernate/hibernate-orm

public void validate(Mapping mapping) throws MappingException {
  super.validate(mapping);
  if ( key!=null && !key.isValid(mapping) ) {
    throw new MappingException(
      "subclass key mapping has wrong number of columns: " +
      getEntityName() +
      " type: " +
      key.getType().getName()
    );
  }
}

origin: hibernate/hibernate-orm

  Selectable column = columns.get(i);
  if (column instanceof Column){
    columnsNames[i] = ((Column) column).getName();
        ),
        annotations,
        table.getCatalog(),
        table.getSchema(),
        table.getName(),
        Boolean.valueOf( typeParameters.getProperty( DynamicParameterizedType.IS_PRIMARY_KEY ) ),
        columnsNames
throw new MappingException( "Could not create DynamicParameterizedType for type: " + typeName, e );
origin: hibernate/hibernate-orm

  keyColumnNames[k] = col.getQuotedName( dialect );
  keyColumnAliases[k] = col.getAlias( dialect, table );
  k++;
if ( elementType.isEntityType() ) {
  String entityName = ( (EntityType) elementType ).getAssociatedEntityName();
  elementPersister = factory.getEntityPersister( entityName );
    elementColumnNames[j] = col.getQuotedName( dialect );
    elementColumnWriters[j] = col.getWriteExpr();
    elementColumnReaders[j] = col.getReadExpr( dialect );
if ( hasIdentifier ) {
  if ( collectionBinding.isOneToMany() ) {
    throw new MappingException( "one-to-many collections with identifiers are not supported" );
if ( elementType.isComponentType() ) {
  elementPropertyMapping = new CompositeElementPropertyMapping(
      elementColumnNames,
      );
else if ( !elementType.isEntityType() ) {
  elementPropertyMapping = new ElementPropertyMapping(
      elementColumnNames,
origin: hibernate/hibernate-orm

if (persistentClass.getClassName() != null) {
  XClass clazz;
  try {
    clazz = reflectionManager.classForName( persistentClass.getClassName() );
    throw new MappingException( e );
  if ( revisionEntity != null ) {
    if (revisionEntityFound) {
      throw new MappingException("Only one entity may be annotated with @RevisionEntity!");
      throw new MappingException("An entity annotated with @RevisionEntity cannot be audited!");
      throw new MappingException(
          "An entity annotated with @RevisionEntity must have a field annotated " +
              "with @RevisionNumber!"
      throw new MappingException(
          "An entity annotated with @RevisionEntity must have a field annotated " +
              "with @RevisionTimestamp!"
    revisionInfoEntityName = persistentClass.getEntityName();
    revisionInfoClass = persistentClass.getMappedClass();
    final Class<? extends RevisionListener> revisionListenerClass = getRevisionListenerClass( revisionEntity.value() );
    revisionInfoTimestampType = persistentClass.getProperty( revisionInfoTimestampData.getName() ).getType();
    if ( globalCfg.isTrackEntitiesChangedInRevision()
        || ( globalCfg.isUseRevisionEntityWithNativeId() && DefaultTrackingModifiedEntitiesRevisionEntity.class
origin: hibernate/hibernate-orm

@Override
public org.hibernate.type.Type getIdentifierType(String entityName) throws MappingException {
  final PersistentClass pc = entityBindingMap.get( entityName );
  if ( pc == null ) {
    throw new MappingException( "persistent class not known: " + entityName );
  }
  return pc.getIdentifier().getType();
}
origin: hibernate/hibernate-orm

private void checkPropertyDuplication() throws MappingException {
  HashSet<String> names = new HashSet<>();
  Iterator iter = getPropertyIterator();
  while ( iter.hasNext() ) {
    Property prop = (Property) iter.next();
    if ( !names.add( prop.getName() ) ) {
      throw new MappingException( "Duplicate property mapping of " + prop.getName() + " found in " + getEntityName() );
    }
  }
}
origin: hibernate/hibernate-orm

@Override
public String getPhysicalColumnName(Table table, Identifier logicalName) throws MappingException {
  if ( logicalName == null ) {
    throw new MappingException( "Logical column name cannot be null" );
  }
  Table currentTable = table;
  String physicalName = null;
  while ( currentTable != null ) {
    final TableColumnNameBinding binding = columnNameBindingByTableMap.get( currentTable );
    if ( binding != null ) {
      physicalName = binding.logicalToPhysical.get( logicalName );
      if ( physicalName != null ) {
        break;
      }
    }
    if ( DenormalizedTable.class.isInstance( currentTable ) ) {
      currentTable = ( (DenormalizedTable) currentTable ).getIncludedTable();
    }
    else {
      currentTable = null;
    }
  }
  if ( physicalName == null ) {
    throw new MappingException(
        "Unable to find column with logical name " + logicalName.render() + " in table " + table.getName()
    );
  }
  return physicalName;
}
org.hibernateMappingException

Javadoc

An exception that occurs while reading mapping sources (xml/annotations),usually as a result of something screwy in the O-R mappings.

Most used methods

  • <init>
    Constructs a MappingException using the given information.
  • getMessage
  • getCause
  • getStackTrace
  • setStackTrace

Popular in Java

  • Parsing JSON documents to java classes using gson
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getApplicationContext (Context)
  • startActivity (Activity)
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • ResourceBundle (java.util)
    Resource bundles contain locale-specific objects. When your program needs a locale-specific resource
  • ConcurrentHashMap (java.util.concurrent)
    A hash table supporting full concurrency of retrievals and adjustable expected concurrency for updat
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now