Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 2.1.4
Mapping documents:
<many-to-one
name="GeneralAcctsData"
column="ACCOUNT_ID"
class="com.dsicdiiti.tnt.oms.general.GeneralData"
insert="false"
update="false"
>
</many-to-one>
Code between sessionFactory.openSession() and session.close():
sess.save(generalData);
.
.
.
(in another class)
.
List entries = sess.createQuery("from GeneralData as detail where "
+ "detail.transactionNumber = :transNumber and detail.flag= :flag")
.setLong("transNumber", data.getTransactionNumber().longValue())
.setString("flag", "Y").list();
Full stack trace of any exception that occurs:
Name and version of the database you are using:
Oracle 9i
I have a problem with a mapping. I have a class that has a mapping to another table with a foreign key. If I save a class using the session it generates a record in the database fine. However, if I try to load the class in the same session the mapping is null. If I close commit the
transaction and then open up another the mapping is valid and I don't get the null.
Is there any way to force the mapping in the same session? Due to the way the system is set up I need to do this within one transaction so I can rollbacl if there is a failure. And the I can not pass the data class around between the various methods. I tried to flush the session before I created my criteria query in the second class, but it did not work. The only way I can get it to work is to execute it within another transaction.
Thanks,
twufire