Transactions in hibernate
- by kumar1425
Hi
I new to hibernate
In my project, i need to handle transactions.
How to handle declarative transactions with in two classes
Examples:
//class 1
class A{
createA()
{
insert(A);
}
}
//class 2
class B
{
createB()
{
insert(B);
}
}
//class 3
@Transaction(Exception.class)
class C
{
test()
{
create(A);
create(B);
}
}
As per the above code is there any possibility to handle transactions, in such a way that if the insert in classA success and the insert in the classB fails then the transaction should rollback and remove the record inserted in the table A corresponding to the Class A
please help me with this using declarative transactions....
Thanks in adavace....