-->
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.  [ 1 post ] 
Author Message
 Post subject: List indexes not persisted
PostPosted: Sat May 07, 2011 7:05 pm 
Newbie

Joined: Sat May 07, 2011 6:47 pm
Posts: 3
I am trying to reorder a list selection within the database. Say I have a choice set called "Cities" and have several cities as children of the "Cities" choice. I have a method to reorder the children alphabetically so that their list indexes are in the correct order, but, when I attempt to persist it to the database, nothing in the database changes. Also, if I attempt to move a state, for example, from the "Cities" group to the "State" group, it is not moved. For some reason, the list indexes and added children are only persisted when I add an option to the choice table after attempting to persist the reordered choices. Because I do not wish to delete items from this table, I have to go in and alter the mapping to allow me to delete the newly added Choice that I really don't want in there in the first place.

So, in short, if the "choice" table itself is not updated, the "choice_map" table will not be updated. Any ideas on why it is not persisted when the children are re-ordered or moved to another parent? Any help would be greatly appreciated.

Here is my hibernate mapping:

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

<hibernate-mapping default-cascade="all">
<class name="com.test.Choice" table="choice" schema="test" mutable="false">
<cache usage="read-only"/>
<id name="uid" column="uid" type="long">
<generator class="hilo"/>
</id>
<version name="version"/>
<list name="choices" table="choice_map" schema="test" cascade="all" lazy="true">
<key column="choiceId"/>
<index column="listIndex"/>
<many-to-many class="com.test.Choice"/>
</list>
<component name="data" class="com.test.ChoiceData">
<property name="id" length="25" not-null="true"/>
<property name="name" length="100" not-null="true"/>
<property name="value" length="50" not-null="true"/>
<property name="description" length="500"/>
<property name="language" length="25"/>
<property name="isGroup" type="boolean"/>
</component>
</class>

</hibernate-mapping>


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

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.