-->
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: net.sf.hibernate.TransientObjectException
PostPosted: Fri Jun 18, 2004 6:08 am 
Newbie

Joined: Tue Jun 08, 2004 3:51 am
Posts: 8
hi all,


I am having the exception :
net.sf.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: atchik.app.postcards.kernel.model.PostcardStatus
at net.sf.hibernate.impl.SessionImpl.throwTransientObjectException(SessionImpl.java:2764)
at net.sf.hibernate.impl.SessionImpl.getEntityIdentifierIfNotUnsaved(SessionImpl.java:2756)
at net.sf.hibernate.type.EntityType.getIdentifier(EntityType.java:66)
at net.sf.hibernate.type.ManyToOneType.nullSafeSet(ManyToOneType.java:47)



My object are postcards and postcardStatus, a postcard contains a list of postcardStatus.

This exception happens when i load a stored postcard, add a postcardStatus to the list, and do a saveOrUpdate.


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

<hibernate-mapping>
   
    <class name="atchik.app.postcards.kernel.manager.storage.impl.PostcardHibernateAdapter" table="Postcard">       
        <id name="databaseId" column="id" type="long" unsaved-value="null">
            <generator class="native"/>
        </id>
        <property name="reference" column="reference" type="string" length="18" not-null="true"/>
        <property name="status" column="status" type="int" not-null="true"/>
        <property name="receptionDate" column="receptionDate" type="timestamp" not-null="true" />
        <property name="originalText" column="originalText" type="text"/>
        <property name="message" column="message" type="text"/>
        <property name="aggregatePage" column="aggregatePage" type="int"/>
       
        <component name="address" class="atchik.app.postcards.kernel.model.DeliveryAddress">
            <property name="postcode" column="postcode" type="string" length="63" />
            <property name="country" column="country" type="string" length="63" />
            <property name="name" column="address" type="string" length="63" />
            <property name="city" column="city" type="string" length="63" />     
        </component>
        <!-- printedAddress property is mapped in PostcardHibernateAdapter -->
        <property name="printedAddress" column="printedAddress" type="text" />     
             
        <property name="postcardUserId" column="userId" type="int" />
        <property name="originalImageContentId" column="originalImageContentId" type="string" length="255" />
        <property name="aggregateId" column="aggregateId" type="string" length="255" />
        <property name="backContentId" column="backContentId" type="string" length="255" />
        <property name="frontContentId" column="frontContentId" type="string" length="255" />
                         
        <list name="postcardStatus" table="PostcardStatus" cascade="all" >
            <key column="postcardId"/>
            <index column="status_number"/>
            <one-to-many class="atchik.app.postcards.kernel.model.PostcardStatus"/>
        </list>   
    </class>
   
    <class name="atchik.app.postcards.kernel.model.PostcardStatus" table="PostcardStatus">
        <id name="databaseId" column="id" type="long" unsaved-value="null">
            <generator class="native"/>
        </id>
        <property name="value" column="value" type="int" not-null="true"/>
        <property name="date" column="date" type="timestamp" not-null="true"/>
        <property name="reason" column="reason" type="string"/>           
    </class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 18, 2004 10:12 am 
Beginner
Beginner

Joined: Mon Jun 07, 2004 4:21 pm
Posts: 44
Location: Boston
Perhaps - saving the added instance first would help?

net.sf.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: atchik.app.postcards.kernel.model.PostcardStatus


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.