Transactions in hibernate
Posted
by
kumar1425
on Stack Overflow
See other posts from Stack Overflow
or by kumar1425
Published on 2011-01-07T08:11:53Z
Indexed on
2011/01/07
9:53 UTC
Read the original article
Hit count: 262
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....
© Stack Overflow or respective owner