posted 14 years ago
Hi All,
I have a secnario like this:
CMT with Hibernate
1. Insert a record into table1 with JXP
2. execute select query with Hibernate on table1 to fetch the record inserted in the above table.
3. Result: No records present in the table ------------> (1)
4. close the hibernate session/tx
Below is the code snippet:
CustomService(CMT) {
PartyRole (CMT) -> insert record
Hibernate -> select record
}
Only with Hibernate
1. Insert a record into table2 using session.save(obj)
2. execute select query on table2 to fetch the record inserted in the above table.
3. 1 record present in the table.-------------------- > (2)
4. commit/close the transaction
Below is the code snippet
create() method: Complete Hibernate
{
open session/transaction
insert record;
select record; -> able to fetch the record.
commit and close ;
}
With the above findings, For the first one....I understood that Hibernate is not identifying any db changes performed by CMT.
In the second example, insert and select done by hibernate. so i am able to fetch the records which is not committed.
Can you help, Is there any way to specify hibernate to make use of the CMT transaction. how it should identify the changes done by CMT.
In Hibernate code I have tried with openSession() as well as currentSession. but did not work.
Please help me in this.
-Kiran