-->
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: composite-element creation with all properties null
PostPosted: Thu Mar 06, 2008 1:54 pm 
Beginner
Beginner

Joined: Mon Feb 19, 2007 4:22 am
Posts: 22
Location: Poland
I have this this kind of situation:

Code:
<class name="Item">
   ...

   <map name="map" table="map_table">
      <key column="FKitem"/>
      <map-key column="locale" type="string"/>
      <composite-element class="MapEntry">
         <property name="description" column="description" type="string"/>
         <property name="colour" column="colour" type="string"/>
         </composite-element>
   </map>


Ie, There is a class 'Item' that contains map 'map' with multilanguage map of some data.

This implies table structure to store map content:
Code:
map_table (FKitem integer, locale varchar, description varchar, colour varchar);


With this data in the table
Code:
(1, "pl", null, null),
(1, "en, "desc", "red")


hibernate does not create entry for key 'pl' in the map when I load an #1 instance of 'Item', because every property in 'MapEntry'is null.

Now, if I put some data into the map under the 'pl' key (which seem to be a new record from the point of view of the map, but remember that it already exists in db), hibernate issues 'insert' instead of 'update' clause. This leads to 'duplicate entry' error.

So my question is: how to force hibernate to create composite entries with all null properties? Maybe there is other way to handle such situations?

Basically I am interested in solutions for Hibernate 3.2.6.


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.