From: <one...@us...> - 2003-03-29 04:20:25
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test In directory sc8-pr-cvs1:/tmp/cvs-serv6518/test Added Files: X.java XY.hbm.xml Y.java Log Message: added foreign id generator for 1-to-1 associations --- NEW FILE: X.java --- package net.sf.hibernate.test; public class X { private long id; private Y y; /** * Returns the id. * @return long */ public long getId() { return id; } /** * Returns the y. * @return Y */ public Y getY() { return y; } /** * Sets the id. * @param id The id to set */ public void setId(long id) { this.id = id; } /** * Sets the y. * @param y The y to set */ public void setY(Y y) { this.y = y; } } --- NEW FILE: XY.hbm.xml --- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd"> <hibernate-mapping> <class name="net.sf.hibernate.test.X"> <id name="id"> <generator class="foreign"> <param name="property">y</param> </generator> </id> <one-to-one name="y" constrained="true"/> </class> <class name="net.sf.hibernate.test.Y"> <id name="id"> <generator class="hilo"/> </id> <property name="x"/> </class> </hibernate-mapping> --- NEW FILE: Y.java --- package net.sf.hibernate.test; public class Y { private Long id; private String x; /** * Returns the id. * @return Long */ public Long getId() { return id; } /** * Returns the x. * @return String */ public String getX() { return x; } /** * Sets the id. * @param id The id to set */ public void setId(Long id) { this.id = id; } /** * Sets the x. * @param x The x to set */ public void setX(String x) { this.x = x; } } |