{
Transaction transaction = session.beginTransaction();
Person person = new Person(1L);
Address address = new Address(2L);
address.setPerson(person);
person.addAddress(address);
session.save(person);
session.save(address);
transaction.commit();
session.clear();
session.beginTransaction();
Address reloadedAddress = (Address) session.get(Address.class, address.getId());
Person reloadedPerson = (Person) session.get(Person.class, person.getId());
session.delete(reloadedPerson);
session.get(Person.class, person.getId());
}
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
Test:
{ Transaction transaction = session.beginTransaction(); Person person = new Person(1L); Address address = new Address(2L); address.setPerson(person); person.addAddress(address); session.save(person); session.save(address); transaction.commit(); session.clear(); session.beginTransaction(); Address reloadedAddress = (Address) session.get(Address.class, address.getId()); Person reloadedPerson = (Person) session.get(Person.class, person.getId()); session.delete(reloadedPerson); session.get(Person.class, person.getId()); }@Test
public void test()