-->
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.  [ 3 posts ] 
Author Message
 Post subject: trouble retrieving list with hibernate
PostPosted: Thu Apr 27, 2006 9:11 am 
Newbie

Joined: Thu Apr 27, 2006 8:51 am
Posts: 2
I've completed the mapping,config and pojos everything looks fine untill i try to save datas into the table, but then when i run the createQuery and try to retrieve datas back from the table it for some reason updates record from the primary table and deletes records from the other table mapped to it.

The table structure, primary table mapped to another table which has all columns in a list of the primary table, like
the class has one of the variables declared of type abc, and that variable is put in a list xyz. i believe the mapping is not right for the list,

<hibernate-mapping>
<class name="classA" table="Tbl_A">
<id name="Id" column="ID"/>
<property name="userName" column="USER_NAME"/>
<property name="TrackCode" column="TRACK"/>

<list name="xyz" table="Tbl_L" cascade="all">
<key column="ID"/>
<index column="IND"/>
<composite-element class="abc">
<property name="custName" column="Name"/>
<property name="custNumber" column="Number"/>
</composite-element>
</list>

</class>
</hibernate-mapping>


when tried retrieving it gets me the values userName and TrackCode but the datas from the list xyz are lost, please give me ur suggestion, greatly appreciate if at the earliest. Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 27, 2006 9:16 am 
Expert
Expert

Joined: Tue Apr 25, 2006 12:04 pm
Posts: 260
I suppose this happens the way the method setXyz( List ) is implemented in your Java class. While updating if you are passing empty List to your pojo class, I guess, it would delete data in the mapped table while updating respective information in the primary table.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 27, 2006 9:42 am 
Newbie

Joined: Thu Apr 27, 2006 8:51 am
Posts: 2
true, i started diggin into it and its showing me some changes, but still not able to figure out.. but thanks for ur hint atleast am not going in the wrong direction.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.