-->
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: UnresolvableObjectException
PostPosted: Wed Jan 28, 2004 1:16 am 
Newbie

Joined: Tue Jan 06, 2004 12:57 am
Posts: 14
I am trying to map a pretty simple master detail relationship, but now I am getting this exception:

javax.servlet.ServletException: net.sf.hibernate.UnresolvableObjectException: No row with the given identifier exists: au.com.countryenergy.legacyarchive.common.model.CustomerHistory@e37e8a98, of class: au.com.countryenergy.legacyarchive.common.model.CustomerHistory
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:545)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:486)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


The master table (CustomerMaster) can have multiple child records (CustomerHistory). There is no primary key defined in CustomerHistory, so I decide to make all the fields part of the primary key (since the key is required?)

"No row with the given identifier exists" may mean that there is a customer number in CustomerHistory that does not exist in CustomerMaster?? (or something is null?)

What should I do to fix the mappings?

Thanks.



<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>

<class name="au.com.countryenergy.legacyarchive.common.model.CustomerMaster" table="customer_master">
<id name="customerNumber" column="customer_number" type="java.lang.String">
<generator class="hilo"/>
</id>
<property name="searchKey" column="search_key"/>
<property name="customerName" column="customer_name"/>
<property name="firstNames" column="first_names"/>
<property name="customerAddress" column="customer_address"/>
<property name="customerType" column="customer_type"/>
<set name="history" cascade="all">
<key column="customer_number"/>
<one-to-many class="au.com.countryenergy.legacyarchive.common.model.CustomerHistory"/>
</set>
</class>

<class name="au.com.countryenergy.legacyarchive.common.model.CustomerHistory" table="customer_history">
<composite-id>
<key-property name="customerNumber" type="java.lang.String" column="customer_number"/>
<key-property name="serviceNumber" type="java.lang.String" column="service_number"/>
<key-property name="batchDate" type="java.sql.Date" column="batch_date"/>
<key-property name="tranDate" type="java.sql.Date" column="tran_date"/>
<key-property name="tranDetail" type="java.lang.String" column="tran_detail"/>
</composite-id>
</class>



</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 29, 2004 6:25 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
There is probably an unsaved-value mismatch in your app. If you cascade, Hibernate will use saveOrUpdate() on children, this usage has some drawbacks when using composite-id or assigned generator. Have a look at the FAQ and the reference guide on that subject.

_________________
Emmanuel


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.