818283848586878889909192
public void test02_ASetBDropExisting() throws Exception { resetDB(); beginTransaction(); try { PersonLocal person = findPerson(1); person.setLicense(null); } finally { completeTransaction(); } assertUnlinked(1);
107108109110111112113114115116117118119
public void test04_ASetBNewAB() throws Exception { resetDB(); beginTransaction(); try { PersonLocal person = findPerson(2); LicenseLocal license = createLicense(22); person.setLicense(license); } finally { completeTransaction(); } assertLinked(2, 22);
121122123124125126127128129130131
public void test05_BSetANewAB() throws Exception { resetDB(); beginTransaction(); try { PersonLocal person = findPerson(2); LicenseLocal license = createLicense(22); license.setPerson(person); } finally { completeTransaction(); }
135136137138139140141142143144145146147
public void test06_ASetBExistingBNewA() throws Exception { resetDB(); beginTransaction(); try { PersonLocal person = findPerson(2); LicenseLocal license = findLicense(11); person.setLicense(license); } finally { completeTransaction(); } assertLinked(2, 11);
149150151152153154155156157158159
public void test07_BSetAExistingBNewA() throws Exception { resetDB(); beginTransaction(); try { PersonLocal person = createPerson(3); LicenseLocal license = findLicense(11); license.setPerson(person); } finally { completeTransaction(); }
162163164165166167168169170171172
public void test09_BSetAExistingANewB() throws Exception { resetDB(); beginTransaction(); try { PersonLocal person = findPerson(1); LicenseLocal license = createLicense(22); license.setPerson(person); } finally { completeTransaction(); }
175176177178179180181182183184185186
public void test10_RemoveRelationships() throws Exception { resetDB(); beginTransaction(); try { PersonLocal person = findPerson(1); person.remove(); } finally { completeTransaction(); } Connection c = ds.getConnection();
238239240241242243244245246247248249
try { LicenseLocal license = findLicense(11); license.setPoints(new Integer(2)); PersonLocal person = license.getPerson(); assertEquals(new Integer(2), person.getId()); assertEquals("value2", person.getName()); } finally { completeTransaction(); } }
247248249250251252253254
completeTransaction(); } } private PersonLocal createPerson(int personId) throws CreateException { PersonLocal person = personLocalHome.create(new PersonPk(personId, "value" + personId)); return person; }
311312313314315316317318319320321
} finally { close(statement); close(connection); } PersonLocal person1 = createPerson(1); createPerson(2); LicenseLocal license = createLicense(11); license.setPerson(person1); }