onetomany.java

来自「用Java实现的23个常用设计模式源代码」· Java 代码 · 共 92 行

JAVA
92
字号
//$Id: OneToMany.java,v 1.7.2.4 2003/11/09 01:46:25 oneovthafew Exp $package net.sf.hibernate.mapping;import java.util.Iterator;import net.sf.hibernate.MappingException;import net.sf.hibernate.engine.Mapping;import net.sf.hibernate.loader.OuterJoinLoader;import net.sf.hibernate.type.EntityType;import net.sf.hibernate.type.Type;/** * A mapping for a one-to-many association * @author Gavin King */public class OneToMany implements Value {		private EntityType type;	private Table referencingTable;	private PersistentClass associatedClass;		public EntityType getEntityType() {		return type;	}		public OneToMany(PersistentClass owner) throws MappingException {		this.referencingTable = (owner==null) ? null : owner.getTable();	}		public void setType(EntityType type) {		this.type = type;	}	public PersistentClass getAssociatedClass() {		return associatedClass;	}	public void setAssociatedClass(PersistentClass associatedClass) {		this.associatedClass = associatedClass;	}	public void createForeignKey() {}	public Iterator getColumnIterator() {		return associatedClass.getKey().getColumnIterator();	}	public int getColumnSpan() {		return associatedClass.getKey().getColumnSpan();	}	public Formula getFormula() {		return null;	}	public int getOuterJoinFetchSetting() {		return OuterJoinLoader.EAGER;	}	public Table getTable() {		return referencingTable;	}	public Type getType() {		return getEntityType();	}	public boolean isNullable() {		return false;	}	public boolean isSimpleValue() {		return false;	}	public boolean isUnique() {		return false;	}	public boolean isValid(Mapping mapping) throws MappingException {		return true;	}}

⌨️ 快捷键说明

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