Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Teneo: Issue with Merge()(Teneo: Issue with Merge())
Teneo: Issue with Merge() [message #1228004] Mon, 06 January 2014 07:24 Go to next message
Chandre Gowda is currently offline Chandre GowdaFriend
Messages: 56
Registered: April 2013
Member
Hello,

Iam using TENEO framework and tried to update then object using session.merge().But Iam getting below error:
'Entity not Merged: object references an unsaved transient instance - save the transient instance before flushing'.
The object has list of children of same type. Also I have set following two properties during datastore initialization.

props.setProperty(PersistenceOptions.CASCADE_POLICY_ON_CONTAINMENT, "REMOVE,REFRESH,PERSIST,MERGE");
props.setProperty(PersistenceOptions.CASCADE_POLICY_ON_NON_CONTAINMENT, "MERGE,PERSIST,REFRESH,DELETE_ORPHAN");

Thanks
Chandru
Re: Teneo: Issue with Merge() [message #1228013 is a reply to message #1228004] Mon, 06 January 2014 07:46 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Chandre,
Yes with these properties things should be fine normally. The next thing is to debug into hibernate, set a breakpoint
where hibernate throws the exception, check which entity it is and then check the hbm (dataStore.getMappingXML) if
indeed the mapping is correct.
If you don't see any special then can you post the hbm here with info on which entity/association it fails?

gr. Martin

On 01/06/2014 08:24 AM, Chandre Gowda wrote:
> Hello,
>
> Iam using TENEO framework and tried to update then object using session.merge().But Iam getting below error:
> 'Entity not Merged: object references an unsaved transient instance - save the transient instance before flushing'.
> The object has list of children of same type. Also I have set following two properties during datastore initialization.
>
> props.setProperty(PersistenceOptions.CASCADE_POLICY_ON_CONTAINMENT, "REMOVE,REFRESH,PERSIST,MERGE");
> props.setProperty(PersistenceOptions.CASCADE_POLICY_ON_NON_CONTAINMENT, "MERGE,PERSIST,REFRESH,DELETE_ORPHAN");
>
> Thanks
> Chandru


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: Teneo: Issue with Merge() [message #1228488 is a reply to message #1228013] Tue, 07 January 2014 10:38 Go to previous messageGo to next message
Chandre Gowda is currently offline Chandre GowdaFriend
Messages: 56
Registered: April 2013
Member
Thanks Martin.
Please find the hbm below. Iam getting issues when i try to merge execution with children into db. List of children refers to list of executions.

<subclass name="com.test.ExecutionImpl" entity-name="Execution" abstract="false" lazy="false" extends="PropertyContainer" discriminator-value="Execution">
<meta attribute="eclassName" inherit="false">Execution</meta>
<meta attribute="epackage" inherit="false">http://execution/1.0</meta>
<property name="comment" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`comment`"/>
</property>
<property name="uri" lazy="false" insert="true" update="true" not-null="false" unique="false" type="core.URI">
<column not-null="false" unique="false" name="`uri`"/>
</property>
<property name="id" lazy="false" insert="true" update="true" not-null="false" unique="false" type="long">
<column not-null="false" unique="false" name="`id`"/>
</property>
<property name="name" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`name`"/>
</property>
<list name="slots" lazy="false" cascade="persist,merge,delete,refresh,save-update,lock">
<key update="true">
<column name="`slot_owninginstance_e_id`" unique="false"/>
</key>
<list-index column="`execution_slots_idx`"/>
<one-to-many entity-name="Slot"/>
</list>
<many-to-one name="executable" entity-name="Executable" lazy="false" cascade="merge,persist,save-update,lock,refresh" foreign-key="execution_executable" insert="true" update="true" not-null="false">
<column not-null="false" unique="false" name="`executable_executable_e_id`"/>
</many-to-one>
<one-to-one name="executor" entity-name="Executor" cascade="merge,persist,save-update,lock,refresh" lazy="false" property-ref="execution"/>
<list name="children" lazy="false" cascade="persist,merge,delete,refresh,save-update,lock">
<key foreign-key="execution_children_key" update="true">
<column name="`execution_children_e_id`" unique="false"/>
</key>
<list-index column="`execution_children_idx`"/>
<one-to-many entity-name="Execution"/>
</list>

<list name="settings" lazy="false" cascade="persist,merge,delete,refresh,save-update,lock">
<key foreign-key="execution_settings_key" update="true">
<column name="`execution_settings_e_id`" unique="false"/>
</key>
<list-index column="`execution_settings_idx`"/>
<one-to-many entity-name="Property"/>
</list>
<list name="events" lazy="false" cascade="persist,merge,delete,refresh,save-update,lock">
<key foreign-key="execution_events_key" update="true">
<column name="`execution_events_e_id`" unique="false"/>
</key>
<list-index column="`execution_events_idx`"/>
<one-to-many entity-name="ExecutionEvent"/>
</list>
</subclass>
Re: Teneo: Issue with Merge() [message #1228540 is a reply to message #1228488] Tue, 07 January 2014 13:10 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Chandre,
Okay and the transient instance is an instance of Execution (and the association it uses to get their is the
'children')? I mean this is what your debugging found?
To be sure that I/we are looking at the correct association...
(I ask because the mapping looks fine to me, the merge is part of the cascade settings.., so not sure why it does not work)

gr. Martin

On 01/07/2014 11:38 AM, Chandre Gowda wrote:
> Thanks Martin.
> Please find the hbm below. Iam getting issues when i try to merge execution with children into db. List of children
> refers to list of executions.
>
> <subclass name="com.test.ExecutionImpl" entity-name="Execution" abstract="false" lazy="false"
> extends="PropertyContainer" discriminator-value="Execution">
> <meta attribute="eclassName" inherit="false">Execution</meta>
> <meta attribute="epackage" inherit="false">http://execution/1.0</meta>
> <property name="comment" lazy="false" insert="true" update="true" not-null="false" unique="false"
> type="java.lang.String">
> <column not-null="false" unique="false" name="`comment`"/>
> </property>
> <property name="uri" lazy="false" insert="true" update="true" not-null="false" unique="false" type="core.URI">
> <column not-null="false" unique="false" name="`uri`"/>
> </property>
> <property name="id" lazy="false" insert="true" update="true" not-null="false" unique="false" type="long">
> <column not-null="false" unique="false" name="`id`"/>
> </property>
> <property name="name" lazy="false" insert="true" update="true" not-null="false" unique="false"
> type="java.lang.String">
> <column not-null="false" unique="false" name="`name`"/>
> </property>
> <list name="slots" lazy="false" cascade="persist,merge,delete,refresh,save-update,lock">
> <key update="true">
> <column name="`slot_owninginstance_e_id`" unique="false"/>
> </key>
> <list-index column="`execution_slots_idx`"/>
> <one-to-many entity-name="Slot"/>
> </list>
> <many-to-one name="executable" entity-name="Executable" lazy="false"
> cascade="merge,persist,save-update,lock,refresh" foreign-key="execution_executable" insert="true" update="true"
> not-null="false">
> <column not-null="false" unique="false" name="`executable_executable_e_id`"/>
> </many-to-one>
> <one-to-one name="executor" entity-name="Executor" cascade="merge,persist,save-update,lock,refresh"
> lazy="false" property-ref="execution"/>
> <list name="children" lazy="false" cascade="persist,merge,delete,refresh,save-update,lock">
> <key foreign-key="execution_children_key" update="true">
> <column name="`execution_children_e_id`" unique="false"/>
> </key>
> <list-index column="`execution_children_idx`"/>
> <one-to-many entity-name="Execution"/>
> </list>
> <list name="settings" lazy="false" cascade="persist,merge,delete,refresh,save-update,lock">
> <key foreign-key="execution_settings_key" update="true">
> <column name="`execution_settings_e_id`" unique="false"/>
> </key>
> <list-index column="`execution_settings_idx`"/>
> <one-to-many entity-name="Property"/>
> </list>
> <list name="events" lazy="false" cascade="persist,merge,delete,refresh,save-update,lock">
> <key foreign-key="execution_events_key" update="true">
> <column name="`execution_events_e_id`" unique="false"/>
> </key>
> <list-index column="`execution_events_idx`"/>
> <one-to-many entity-name="ExecutionEvent"/>
> </list>
> </subclass>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: Teneo: Issue with Merge() [message #1228557 is a reply to message #1228540] Tue, 07 January 2014 13:52 Go to previous message
Chandre Gowda is currently offline Chandre GowdaFriend
Messages: 56
Registered: April 2013
Member
Yes, Execution contains list of children which are of type execution again. if i don't set children, persistence(merge) of execution works fine Smile

Thanks
Chandru
Previous Topic:Teneo: Issue with multiple sessions
Next Topic:[Texo] Obtaining last version with Xcore support
Goto Forum:
  


Current Time: Mon Mar 01 07:24:10 GMT 2021

Powered by FUDForum. Page generated in 0.01610 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top