identifiercollection.java

来自「人力资源管理系统主要包括:人员管理、招聘管理、培训管理、奖惩管理和薪金管理五大管」· Java 代码 · 共 65 行

JAVA
65
字号
//$Id: IdentifierCollection.java,v 1.1.2.6 2003/12/04 01:29:14 oneovthafew Exp $package net.sf.hibernate.mapping;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;	}	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??	}		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 + =
减小字号Ctrl + -
显示快捷键?