-->
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: Mapping same object twice in same transaction
PostPosted: Wed Feb 22, 2006 3:09 am 
Beginner
Beginner

Joined: Sun Feb 19, 2006 5:13 am
Posts: 22
Hello

I have a problem where i am using a object that has a Map holding all it property values. The reasaon is that i am mapping it to 2 different tables, once in EntityModePOJO mode and once in EntityMode.MAP. The effect i am looking for is to bind metadata to the object though the EntityMode.MAP mapping. So I am using spring and JTA running the transaction over my command pojo. The command needs to save the object for both mappings in same transaction. Offcause the EntityMode.MAo fails, or rather it succeds but make no commit to the database. Im guessing tat its because the dirty check says that nothing is dirty when i am trying to saveOrUpdate for the Entitymode.MAP mapping.
(which is done after the EntityMode.POJO).

So my questions are:

    How do I handle saving the same object to two different mappings in the same transaction?

    Is the problem that the Hibernat proxy marks the object as being clean after EntityMode.POJO has seen the changes?



THX

Magnus





Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


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.