⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 set.java

📁 用Java实现的23个常用设计模式源代码
💻 JAVA
字号:
//$Id: Set.java,v 1.6.2.3 2003/11/09 01:46:25 oneovthafew Exp $package net.sf.hibernate.mapping;import java.util.Iterator;import net.sf.hibernate.type.PersistentCollectionType;import net.sf.hibernate.type.TypeFactory;/** * A set with no nullable element columns. It will have a primary key  * consisting of all table columns (ie. key columns + element columns). * @author Gavin King */public class Set extends Collection {		/**	 * Constructor for Set.	 * @param owner	 */	public Set(PersistentClass owner) {		super(owner);	}	public boolean isSet() {		return true;	}		public PersistentCollectionType getCollectionType() {		return isSorted() ? 			TypeFactory.sortedSet( getRole(), getComparator() ) : 			TypeFactory.set( getRole() );	}		public void createPrimaryKey() {		PrimaryKey pk = new PrimaryKey();		Iterator iter = getKey().getColumnIterator();		while ( iter.hasNext() ) {			pk.addColumn( (Column) iter.next() );					}		boolean nullable = false;		iter = getElement().getColumnIterator();		while ( iter.hasNext() ) {			Column col = (Column) iter.next();			//col.setNullable(false);			if ( col.isNullable() ) nullable=true;			pk.addColumn(col);		}		// Some databases (Postgres) will tolerate nullable		// column in a primary key others (DB2) won't		if (!nullable) getCollectionTable().setPrimaryKey(pk);	}	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -