-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Hibernate not saving collection
PostPosted: Thu Feb 21, 2013 12:37 am 
Newbie

Joined: Thu Feb 21, 2013 12:34 am
Posts: 1
Here are my hibernate mappings

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate- mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.business.Test" table="Test">
<composite-id name="key">
<key-property name="x" column="X"/>
<key-property name="y" column="Y"/>
</composite-id>

<set name="valueObjects" inverse="false" lazy="false" cascade="all">
<key>
<column name="X"/>
<column name="Y"/>
</key>
<one-to-many class="com.business.ValueObjects" />
</set>

</class>
</hibernate-mapping>




<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
<class name="com.business.ValueObjects" table="ValueObjects" mutable="false">
<id name="id" type="java.lang.Long" column="ID">
<generator class="sequence">
<param name="sequence">ID_SEQ</param>
</generator>
</id>

<property name="x" column="X"/>
<property name="y" column="Y"/>

</class>
</hibernate-mapping>

When i load the Test object, hibernate loads the ValueObjects collections. But when i update the ValueObjects and save Test. I dont see any insert or Update statements.

Please suggest what to do.

Raulito


Top
 Profile  
 
 Post subject: Re: Hibernate not saving collection
PostPosted: Thu Feb 21, 2013 7:11 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
Quote:
But when i update the ValueObjects and save Test. I dont see any insert or Update statements.


Well, hibernate actually defers the insert and update statements to the moment where you commit or flush your persistent context.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.