Update of /cvsroot/hibernate/Hibernate3/test/org/hibernate/test/ejb3 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10165/test/org/hibernate/test/ejb3 Added Files: EJB3Suite.java Item.hbm.xml Item.java Part.hbm.xml Part.java package.html Log Message: HHH-1416 & HHH-1421 : EJB3 LockModeTypes --- NEW FILE: EJB3Suite.java --- package org.hibernate.test.ejb3; import junit.framework.Test; import junit.framework.TestSuite; import org.hibernate.test.ejb3.lock.EJB3LockTest; import org.hibernate.test.ejb3.lock.RepeatableReadTest; /** * @author Steve Ebersole */ public class EJB3Suite { public static Test suite() { TestSuite suite = new TestSuite( "EJB3-compliance tests"); suite.addTest( EJB3LockTest.suite() ); suite.addTest( RepeatableReadTest.suite() ); return suite; } } --- NEW FILE: Item.hbm.xml --- <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="org.hibernate.test.ejb3"> <class name="Item" table="EJB3_ITEM"> <id name="id" column="ITEM_ID" type="long"> <generator class="increment"/> </id> <version name="version" column="VERS" type="long"/> <property name="name" column="NAME" not-null="true"/> <!-- modeled as many-to-one even though, yes, in real life would normally be many-to-many --> <set name="parts" cascade="all" fetch="subselect" inverse="true"> <key column="ITEM_ID"/> <one-to-many class="Part"/> </set> </class> </hibernate-mapping> --- NEW FILE: Item.java --- package org.hibernate.test.ejb3; import java.util.Set; import java.util.HashSet; /** * @author Steve Ebersole */ public class Item { private Long id; private String name; private long version; private Set parts = new HashSet(); public Item() { } public Item(String name) { this.name = name; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public long getVersion() { return version; } public void setVersion(long version) { this.version = version; } public Set getParts() { return parts; } public void setParts(Set parts) { this.parts = parts; } } --- NEW FILE: Part.hbm.xml --- <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="org.hibernate.test.ejb3"> <class name="Part" table="EJB3_PART"> <id name="id" column="PART_ID" type="long"> <generator class="increment"/> </id> <many-to-one name="item" class="Item" column="ITEM_ID" cascade="save-update, lock" not-null="true"/> <property name="name" column="NAME" not-null="true" type="string"/> <property name="stockNumber" column="STOCK_NUM" not-null="true" type="string"/> <property name="unitPrice" column="UNIT_PRICE" not-null="true" type="big_decimal"/> </class> </hibernate-mapping> --- NEW FILE: Part.java --- package org.hibernate.test.ejb3; import java.math.BigDecimal; /** * @author Steve Ebersole */ public class Part { private Long id; private Item item; private String name; private String stockNumber; private BigDecimal unitPrice; public Part() { } public Part(Item item, String name, String stockNumber, BigDecimal unitPrice) { this.item = item; this.name = name; this.stockNumber = stockNumber; this.unitPrice = unitPrice; this.item.getParts().add( this ); } public Long getId() { return id; } private void setId(Long id) { this.id = id; } public Item getItem() { return item; } private void setItem(Item item) { this.item = item; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getStockNumber() { return stockNumber; } public void setStockNumber(String stockNumber) { this.stockNumber = stockNumber; } public BigDecimal getUnitPrice() { return unitPrice; } public void setUnitPrice(BigDecimal unitPrice) { this.unitPrice = unitPrice; } } --- NEW FILE: package.html --- <html> <head></head> <body> <p> Tests for any ejb3-specific behavior for which we need to ensure compliance. </p> </body> </html> |