📄 identifiercollection.java
字号:
//$Id: IdentifierCollection.java,v 1.1.2.4 2003/11/12 02:43:48 oneovthafew Exp $package net.sf.hibernate.mapping;import java.util.Iterator;import net.sf.hibernate.MappingException;import net.sf.hibernate.engine.Mapping;/** * A collection with a synthetic "identifier" column */public abstract class IdentifierCollection extends Collection { public static final String DEFAULT_IDENTIFIER_COLUMN_NAME = "id"; private SimpleValue identifier; public IdentifierCollection(PersistentClass owner) { super(owner); } public SimpleValue getIdentifier() { return identifier; } public void setIdentifier(SimpleValue identifier) { this.identifier = identifier; } public final boolean isIdentified() { return true; } public void createPrimaryKey() { PrimaryKey pk = new PrimaryKey(); Iterator iter = getIdentifier().getColumnIterator(); while ( iter.hasNext() ) { pk.addColumn( (Column) iter.next() ); } getCollectionTable().setPrimaryKey(pk); } 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() ); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -