aspose file tools*
The moose likes Object Relational Mapping and the fly likes Hibernate - How to save multiple entities in single transactions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate - How to save multiple entities in single transactions" Watch "Hibernate - How to save multiple entities in single transactions" New topic
Author

Hibernate - How to save multiple entities in single transactions

Bala Gangadhar
Ranch Hand

Joined: Oct 07, 2008
Posts: 82
    
    1
Hi All,
Thanks for your replies. One more question on Hibernate mapping..

I have a Class, TestClass with fields
field1
field2....
....
...filed6.

I have mapped this class to two tables with two differnt entity names

<class name="com.something.TestClass " table="TEST_TABLE" entity-name="TestTableTestClass">
<id name="filed1" column="FIELD1" />
<property name="filed2" column="FIELD2" />
<property name="filed5" column="FIELD5" />

</class>
and some fileds to second table with different entity name
<class name="com.something.TestClass " table="TEST_TABLE_OTHER" entity-name="TestTableOtherTestClass">
<id name="filed2" column="FIELD2" />
<property name="filed4" column="FIELD4" />
<property name="filed5" column="FIELD5" />

</class>

Now my requirement is save entries to both the tables in single transaction,



But unfotunately its saving only the first save. i.e TestTableTestClass enitity to corresponding table. If change the order then also only first save is working and second is not.

Neither its throwing any error.... Not sure whats the error.

Can somebody help me....
Bala Gangadhar
Ranch Hand

Joined: Oct 07, 2008
Posts: 82
    
    1
Hi, did i post this in wrong forum ? Shouldn't it be under Object relational Mapping
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate - How to save multiple entities in single transactions