From: <one...@us...> - 2002-11-07 10:12:18
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/test In directory usw-pr-cvs1:/tmp/cvs-serv25310/hibernate/test Added Files: MoreStuff.java Several.java Single.java SingleSeveral.hbm.xml Log Message: fixed a bug with embedded composite-ids and outerjoin fetching --- NEW FILE: MoreStuff.java --- //$Id: MoreStuff.java,v 1.1 2002/11/07 10:12:15 oneovthafew Exp $ package cirrus.hibernate.test; import java.io.Serializable; import java.util.Collection; public class MoreStuff implements Serializable { private String stringId; private int intId; private Collection stuffs; private String name; /** * Returns the stuffs. * @return Collection */ public Collection getStuffs() { return stuffs; } /** * Sets the stuffs. * @param stuffs The stuffs to set */ public void setStuffs(Collection stuffs) { this.stuffs = stuffs; } /** * Returns the name. * @return String */ public String getName() { return name; } /** * Sets the name. * @param name The name to set */ public void setName(String name) { this.name = name; } /** * Returns the intId. * @return int */ public int getIntId() { return intId; } /** * Returns the stringId. * @return String */ public String getStringId() { return stringId; } /** * Sets the intId. * @param intId The intId to set */ public void setIntId(int intId) { this.intId = intId; } /** * Sets the stringId. * @param stringId The stringId to set */ public void setStringId(String stringId) { this.stringId = stringId; } } --- NEW FILE: Several.java --- //$Id: Several.java,v 1.1 2002/11/07 10:12:15 oneovthafew Exp $ package cirrus.hibernate.test; import java.io.Serializable; public class Several implements Serializable { private String id; private String prop; private Single single; private String string; /** * Returns the id. * @return String */ public String getId() { return id; } /** * Returns the prop. * @return String */ public String getProp() { return prop; } /** * Returns the single. * @return Single */ public Single getSingle() { return single; } /** * Sets the id. * @param id The id to set */ public void setId(String id) { this.id = id; } /** * Sets the prop. * @param prop The prop to set */ public void setProp(String prop) { this.prop = prop; } /** * Sets the single. * @param single The single to set */ public void setSingle(Single single) { this.single = single; } /** * Returns the string. * @return String */ public String getString() { return string; } /** * Sets the string. * @param string The string to set */ public void setString(String string) { this.string = string; } public boolean equals(Object other) { return ( (Several) other ).id.equals(id) && ( (Several) other ).string.equals(string); } public int hashCode() { return id.hashCode(); } } --- NEW FILE: Single.java --- //$Id: Single.java,v 1.1 2002/11/07 10:12:15 oneovthafew Exp $ package cirrus.hibernate.test; import java.io.Serializable; import java.util.Collection; import java.util.HashSet; public class Single implements Serializable { private String id; private String prop; private String string; private Collection several = new HashSet(); /** * Returns the id. * @return String */ public String getId() { return id; } /** * Returns the prop. * @return String */ public String getProp() { return prop; } /** * Returns the several. * @return Set */ public Collection getSeveral() { return several; } /** * Sets the id. * @param id The id to set */ public void setId(String id) { this.id = id; } /** * Sets the prop. * @param prop The prop to set */ public void setProp(String prop) { this.prop = prop; } /** * Sets the several. * @param several The several to set */ public void setSeveral(Collection several) { this.several = several; } /** * Returns the string. * @return String */ public String getString() { return string; } /** * Sets the string. * @param string The string to set */ public void setString(String string) { this.string = string; } public boolean equals(Object other) { return ( (Single) other ).id.equals(id) && ( (Single) other ).string.equals(string); } public int hashCode() { return id.hashCode(); } } --- NEW FILE: SingleSeveral.hbm.xml --- <?xml version="1.0"?> <!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-1.1.dtd" > <hibernate-mapping> <class name="cirrus.hibernate.test.Single"> <composite-id> <key-property name="id"/> <key-property name="string"/> </composite-id> <property name="prop"/> <bag role="several" readonly="true" lazy="false" cascade="all"> <!--important: test for bidirectional with lazy="false" --> <key> <column name="single_id" not-null="true"/> <column name="single_string" not-null="true"/> </key> <one-to-many class="cirrus.hibernate.test.Several"/> </bag> </class> <class name="cirrus.hibernate.test.Several"> <composite-id> <key-property name="id"/> <key-property name="string"/> </composite-id> <many-to-one name="single"> <column name="single_id"/> <column name="single_string"/> </many-to-one> </class> </hibernate-mapping> |