Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 package org.hibernate.mapping; 3 4 import org.hibernate.MappingException; 5 import org.hibernate.engine.Mapping; 6 7 10 public abstract class IdentifierCollection extends Collection { 11 12 public static final String DEFAULT_IDENTIFIER_COLUMN_NAME = "id"; 13 14 private KeyValue identifier; 15 16 public IdentifierCollection(PersistentClass owner) { 17 super(owner); 18 } 19 20 public KeyValue getIdentifier() { 21 return identifier; 22 } 23 public void setIdentifier(KeyValue identifier) { 24 this.identifier = identifier; 25 } 26 public final boolean isIdentified() { 27 return true; 28 } 29 30 void createPrimaryKey() { 31 if ( !isOneToMany() ) { 32 PrimaryKey pk = new PrimaryKey(); 33 pk.addColumns( getIdentifier().getColumnIterator() ); 34 getCollectionTable().setPrimaryKey(pk); 35 } 36 else { 37 } 42 } 44 45 public void validate(Mapping mapping) throws MappingException { 46 super.validate(mapping); 47 if ( !getIdentifier().isValid(mapping) ) { 48 throw new MappingException( 49 "collection id mapping has wrong number of columns: " + 50 getRole() + 51 " type: " + 52 getIdentifier().getType().getName() 53 ); 54 } 55 } 56 57 } 58 59 60 61 62 63 64 65
| Popular Tags
|