Advertisement

06.30.2008 at 05:56PM PDT, ID: 23528832 | Points: 125
[x]
Attachment Details

mapping list of polymorphic classes

Asked by bhomass in J2EE Frameworks

Category is a self-referencing class with a list<Category> under it. however, there is a subclass LeafCategory extends Category, which could be an item in the list.

for mapping, I have

<class name="model.Category"  table="Category">
            <id name="objectId" type="int" column="OBJECTID">
                  <generator class="hilo">
                        <param name="table">hi_value</param>
                        <param name="column">next_value</param>
                        <param name="max_lo">100</param>
                  </generator>
            </id>
            <property name="name" column="NAME"  not-null="true" />
            <property name="ownerId" column="OWNERID"  />
            <many-to-one name="parentCategory"      class="model.Category" column="PARENTCATEGORYID" not-null="true" insert="false" update="false"  />
            <list name="categories" cascade="all-delete-orphan">
                  <key column="PARENTCATEGORYID" not-null="true" />
                  <list-index column="categoriesIdx"/>
                   <one-to-many class="model.Category"/>
            </list>

            <union-subclass name="model.LeafCategory" table="LeafCategory">

            </union-subclass>

      </class>

I find that I am able to add new Category in its parent's list. but when adding a LeafCategory to the list, I get a
org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1

I have successfully implemented both self-referencing class, and polymorphic classes. it is only when I mix the two into one, that I get this error.

any experts see what is wrong with my mapping?Start Free Trial
 
Loading Advertisement...
 
[+][-]07.01.2008 at 03:14AM PDT, ID: 21906206

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.01.2008 at 10:03AM PDT, ID: 21909554

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.01.2008 at 11:40PM PDT, ID: 21913965

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.02.2008 at 11:41AM PDT, ID: 21919339

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.03.2008 at 12:18AM PDT, ID: 21923344

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.03.2008 at 11:18AM PDT, ID: 21927893

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.14.2008 at 01:56PM PDT, ID: 22234175

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.14.2008 at 04:04PM PDT, ID: 22235009

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628