1 package org.hibernate.test.idclass; 3 4 import junit.framework.Test; 5 import junit.framework.TestSuite; 6 7 import org.hibernate.Session; 8 import org.hibernate.Transaction; 9 import org.hibernate.test.TestCase; 10 11 14 public class IdClassTest extends TestCase { 15 16 public IdClassTest(String str) { 17 super(str); 18 } 19 20 public void testIdClass() { 21 Session s = openSession(); 22 Transaction t = s.beginTransaction(); 23 Customer cust = new Customer("JBoss", "RouteOne", "Detroit"); 24 s.persist(cust); 25 t.commit(); 26 s.close(); 27 28 s = openSession(); 29 CustomerId custId = new CustomerId("JBoss", "RouteOne"); 30 t = s.beginTransaction(); 31 cust = (Customer) s.get(Customer.class, custId); 32 t.commit(); 33 s.close(); 34 } 35 36 protected String [] getMappings() { 37 return new String [] { "idclass/Customer.hbm.xml" }; 38 } 39 40 public static Test suite() { 41 return new TestSuite(IdClassTest.class); 42 } 43 44 } 45 46 | Popular Tags |