Package org.hibernate

Examples of org.hibernate.DuplicateMappingException


      namedQueries.put( name.intern(), query );
    }

    private void checkQueryName(String name) throws DuplicateMappingException {
      if ( namedQueries.containsKey( name ) || namedSqlQueries.containsKey( name ) ) {
        throw new DuplicateMappingException( "query", name );
      }
    }
View Full Code Here


        throws DuplicateMappingException {
      final String name = definition.getRegisteredName();
      if ( !defaultNamedProcedure.contains( name ) ) {
        final NamedProcedureCallDefinition previous = namedProcedureCallMap.put( name, definition );
        if ( previous != null ) {
          throw new DuplicateMappingException( "named stored procedure query", name );
        }
      }
    }
View Full Code Here

        throws DuplicateMappingException {
      final String name = definition.getRegisteredName();

      final NamedEntityGraphDefinition previous = namedEntityGraphMap.put( name, definition );
      if ( previous != null ) {
        throw new DuplicateMappingException( "NamedEntityGraph", name );
      }
    }
View Full Code Here

    }

    public void applyResultSetMapping(ResultSetMappingDefinition sqlResultSetMapping) throws DuplicateMappingException {
      Object old = sqlResultSetMappings.put( sqlResultSetMapping.getName(), sqlResultSetMapping );
      if ( old != null ) {
        throw new DuplicateMappingException( "resultSet",  sqlResultSetMapping.getName() );
      }
    }
View Full Code Here

      String key = buildTableNameKey( schema, catalog, physicalName );
      TableDescription tableDescription = new TableDescription( logicalName, denormalizedSuperTable );
      TableDescription oldDescriptor = ( TableDescription ) tableNameBinding.put( key, tableDescription );
      if ( oldDescriptor != null && ! oldDescriptor.logicalName.equals( logicalName ) ) {
        //TODO possibly relax that
        throw new DuplicateMappingException(
            "Same physical table name [" + physicalName + "] references several logical table names: [" +
                oldDescriptor.logicalName + "], [" + logicalName + ']',
            "table",
            physicalName
        );
View Full Code Here

  }

  public void addEntity(EntityBinding entityBinding) {
    final String entityName = entityBinding.getEntity().getName();
    if ( entityBindingMap.containsKey( entityName ) ) {
      throw new DuplicateMappingException( DuplicateMappingException.Type.ENTITY, entityName );
    }
    entityBindingMap.put( entityName, entityBinding );
  }
View Full Code Here

  public void addCollection(PluralAttributeBinding pluralAttributeBinding) {
    final String owningEntityName = pluralAttributeBinding.getContainer().getPathBase();
    final String attributeName = pluralAttributeBinding.getAttribute().getName();
    final String collectionRole = owningEntityName + '.' + attributeName;
    if ( collectionBindingMap.containsKey( collectionRole ) ) {
      throw new DuplicateMappingException( DuplicateMappingException.Type.ENTITY, collectionRole );
    }
    collectionBindingMap.put( collectionRole, pluralAttributeBinding );
  }
View Full Code Here

  }

  public void addEntity(EntityBinding entityBinding) {
    final String entityName = entityBinding.getEntity().getName();
    if ( entityBindingMap.containsKey( entityName ) ) {
      throw new DuplicateMappingException( DuplicateMappingException.Type.ENTITY, entityName );
    }
    entityBindingMap.put( entityName, entityBinding );
  }
View Full Code Here

  public void addCollection(PluralAttributeBinding pluralAttributeBinding) {
    final String owningEntityName = pluralAttributeBinding.getContainer().getPathBase();
    final String attributeName = pluralAttributeBinding.getAttribute().getName();
    final String collectionRole = owningEntityName + '.' + attributeName;
    if ( collectionBindingMap.containsKey( collectionRole ) ) {
      throw new DuplicateMappingException( DuplicateMappingException.Type.ENTITY, collectionRole );
    }
    collectionBindingMap.put( collectionRole, pluralAttributeBinding );
  }
View Full Code Here

      private void bindPhysicalToLogical(String logicalName, Column physicalColumn) throws DuplicateMappingException {
        final String physicalName = physicalColumn.getQuotedName();
        final String existingLogicalName = ( String ) physicalToLogical.put( physicalName, logicalName );
        if ( existingLogicalName != null && ! existingLogicalName.equals( logicalName ) ) {
          throw new DuplicateMappingException(
              " Table [" + tableName + "] contains phyical column name [" + physicalName
                  + "] represented by different logical column names: [" + existingLogicalName
                  + "], [" + logicalName + "]",
              "column-binding",
              tableName + "." + physicalName
View Full Code Here

TOP

Related Classes of org.hibernate.DuplicateMappingException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.