Eclipse Plugin Central

Hibernate Synchronizer - mapping bug?

Anonymous - Jun 21, 2006 - 03:14 PM
Post subject: mapping bug?
When I use this code:
Code:

<set name="comments" table="TRACK_COMMENTS">
   <key column="TRACK_ID" />
   <element type="string" column="COMMENT" />
</set>


It creates a set of type null, but shouldn't it be of type String?
private java.util.Set<null> comments;

Anyone know why this is the case?
Anonymous - Jun 22, 2006 - 10:35 AM
Post subject:
Same Guy ^^

Here is another mapping that causes the generated code to give a type of null:
Code:

<list name="tracks" table="ALBUM_TRACKS">
         <meta attribute="use-in-tostring">true</meta>
         <key column="ALBUM_ID" />
         <index column="POSITION" />
         <composite-element class="com.orielly.hh.AlbumTrack">
            <many-to-one name="track"
               class="com.orielly.hh.Track">
               <meta attribute="use-in-tostring">true</meta>
               <column name="TRACK_ID" />
            </many-to-one>
            <property name="disc" type="integer" />
            <property name="positionOnDisc" type="integer" />
         </composite-element>
      </list>


It maps to this: private java.util.List<null> tracks;

But it should be private java.util.List<com.orielly.hh.AlbumTrack> tracks;



I am using Hibernate 3.0, and the examples I am getting this from is 2.0. Did the semantics change between versions which h-sync doesn't look out for?
huangjd - Jun 22, 2006 - 10:52 AM
Post subject:
I was those (huangjd) ^^
Anonymous - Jun 29, 2006 - 04:45 AM
Post subject:
Hi there !

I got mapping generation bug too, don't know if it's the same as you two...

I use SQLServer05, Hibernate3.0 and jtds1.2, and when I want to generate hbm files, sometimes (and I just don't understand the rule for that), it didn't take the constraint to generate code...

Ex :
It put an pk in a property tag and not in an id tag
It did't make many-to-one and other relation, it put all in property tag

Did someone know something about this bug ?

Thx

Khazrak

PS : s'cuse my english, I'm from switzerland ^^
maxxyme - Feb 04, 2008 - 04:36 AM
Post subject:
As mentioned in this thread the support of nested <composite-element> seems to be unsupported in HibernateSynchronizer, or... in fact, BADLY supported.

I found the following threads related to this problem :
(Aug 19, 2005)
http://www.eclipseplugincentral.com/PNp ... ement.html
(Jul 20, 2004)
http://www.eclipseplugincentral.com/PNp ... ement.html
(Mar 25, 2004)
http://www.eclipseplugincentral.com/PNp ... ement.html


The last one (2005) let me to a possible work-around: setting the class="..." on the <set> tags, not just only on the <composite-element>, make the synchronization correctly generates what's expected.
But unfortunately, you have to remove the "fake" attribute as its not supported in the Hibernate DTD.
maxxyme - Feb 04, 2008 - 05:38 AM
Post subject:
I reported the problem into the Hibernate Synchronizer bug tracker hosted on SourceForge.net:

https://sourceforge.net/tracker/index.p ... tid=623990

Hope we'll an answer one day... if the project leader is not sleeping...?!
All times are GMT - 6 Hours
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits