void createPrimaryKey() { if ( !isOneToMany() ) { PrimaryKey pk = new PrimaryKey( getCollectionTable() ); pk.addColumns( getIdentifier().getColumnIterator() ); getCollectionTable().setPrimaryKey(pk); } // create an index on the key columns?? }
public void validate(Mapping mapping) throws MappingException { super.validate( mapping ); assert getElement() != null : "IdentifierCollection identifier not bound : " + getRole(); if ( !getIdentifier().isValid(mapping) ) { throw new MappingException( "collection id mapping has wrong number of columns: " + getRole() + " type: " + getIdentifier().getType().getName() ); } } }
final SimpleValue idBinding = new SimpleValue( mappingDocument, idBagBinding.getCollectionTable() ); idBagBinding.setIdentifier( idBinding );
private void checkColumnDuplication() throws MappingException { HashSet cols = new HashSet(); checkColumnDuplication( cols, getKey() ); if ( isIndexed() ) { checkColumnDuplication( cols, ( (IndexedCollection) this ).getIndex() ); } if ( isIdentified() ) { checkColumnDuplication( cols, ( (IdentifierCollection) this ).getIdentifier() ); } if ( !isOneToMany() ) { checkColumnDuplication( cols, getElement() ); } }
public void validate(Mapping mapping) throws MappingException { super.validate(mapping); if ( !getIdentifier().isValid(mapping) ) { throw new MappingException( "collection id mapping has wrong number of columns: " + getRole() + " type: " + getIdentifier().getType().getName() ); } }
void createPrimaryKey() { if ( !isOneToMany() ) { MappedPrimaryKey pk = new PrimaryKey( getMappedTable() ); pk.addColumns( getIdentifier().getMappedColumns() ); getMappedTable().setPrimaryKey(pk); } // create an index on the key columns?? }
( (IdentifierCollection) collection ).setIdentifier( id ); String generator = collectionIdAnn.generator(); String generatorType;
final BasicValue idBinding = new BasicValue( mappingDocument, idBagBinding.getMappedTable() ); idBagBinding.setIdentifier( idBinding );
SimpleValue iv = new SimpleValue( list.getCollectionTable() ); bindSimpleValue( subnode,
@Override public boolean isSame(Collection other) { return other instanceof IdentifierCollection && isSame( (IdentifierCollection) other ); }
private void processExportableProducers() { // for now we only handle id generators as ExportableProducers final Dialect dialect = getDatabase().getJdbcEnvironment().getDialect(); final String defaultCatalog = extractName( getDatabase().getDefaultNamespace().getName().getCatalog(), dialect ); final String defaultSchema = extractName( getDatabase().getDefaultNamespace().getName().getSchema(), dialect ); for ( PersistentClass entityBinding : entityBindingMap.values() ) { if ( entityBinding.isInherited() ) { continue; } handleIdentifierValueBinding( entityBinding.getIdentifier(), dialect, defaultCatalog, defaultSchema, (RootClass) entityBinding ); } for ( Collection collection : collectionBindingMap.values() ) { if ( !IdentifierCollection.class.isInstance( collection ) ) { continue; } handleIdentifierValueBinding( ( (IdentifierCollection) collection ).getIdentifier(), dialect, defaultCatalog, defaultSchema, null ); } }
public void validate(Mapping mapping) throws MappingException { super.validate(mapping); if ( !getIdentifier().isValid(mapping) ) { throw new MappingException( "collection id mapping has wrong number of columns: " + getRole() + " type: " + getIdentifier().getType().getName() ); } }
( (IdentifierCollection) collection ).setIdentifier( id ); String generator = collectionIdAnn.generator(); String generatorType;
public boolean isSame(IdentifierCollection other) { return super.isSame( other ) && isSame( identifier, other.identifier ); }
void createPrimaryKey() { if ( !isOneToMany() ) { PrimaryKey pk = new PrimaryKey(); pk.addColumns( getIdentifier().getColumnIterator() ); getCollectionTable().setPrimaryKey(pk); } else { // don't create a unique key, 'cos some // databases don't like a UK on nullable // columns //getCollectionTable().createUniqueKey( getIdentifier().getConstraintColumns() ); } // create an index on the key columns?? }
identifierType = idColl.getIdentifier().getType(); iter = idColl.getIdentifier().getColumnIterator(); Column col = (Column) iter.next(); identifierColumnName = col.getQuotedName( dialect ); identifierColumnAlias = col.getAlias( dialect ); identifierGenerator = idColl.getIdentifier().createIdentifierGenerator( creationContext.getMetadata().getIdentifierGeneratorFactory(), factory.getDialect(),
public void validate(Mapping mapping) throws MappingException { super.validate(mapping); if ( !getIdentifier().isValid(mapping) ) { throw new MappingException( "collection id mapping has wrong number of columns: " + getRole() + " type: " + getIdentifier().getType().getName() ); } }
public void validate() throws MappingException { super.validate(); assert getElement() != null : "IdentifierCollection identifier not bound : " + getRole(); if ( !getIdentifier().isValid() ) { throw new MappingException( "collection id mapping has wrong number of columns: " + getRole() + " type: " + getIdentifier().getJavaTypeMapping().getTypeName() ); } } }
public static void bindIdentifierCollectionSecondPass(Element node, IdentifierCollection collection, java.util.Map persistentClasses, Mappings mappings, java.util.Map inheritedMetas) throws MappingException { bindCollectionSecondPass( node, collection, persistentClasses, mappings, inheritedMetas ); Element subnode = node.element( "collection-id" ); SimpleValue id = new SimpleValue( collection.getCollectionTable() ); bindSimpleValue( subnode, id, false, IdentifierCollection.DEFAULT_IDENTIFIER_COLUMN_NAME, mappings ); collection.setIdentifier( id ); makeIdentifier( subnode, id, mappings ); }
( (IdentifierCollection) collection ).setIdentifier( id ); String generator = collectionIdAnn.generator(); String generatorType;