-->
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.  [ 4 posts ] 
Author Message
 Post subject: Bug HibernateToolTask with parent child to composite-element
PostPosted: Fri Oct 28, 2005 2:36 pm 
Beginner
Beginner

Joined: Sun Oct 09, 2005 3:21 pm
Posts: 40
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: Hibernate version: 3.1.0 (Hibernate Tools 3.1.0 beta1)

Mapping documents:
<class name="Resurs" table="RESURS">

<id name="id" column="RESURSID">
<generator class="identity">
</generator>
</id>

<many-to-one name="typ" class="Resurstyp" property-ref="typ" foreign-key="FK_RESURSRESURSTYP">
<column name="RESURSTYP" length="50" not-null="true"/>
</many-to-one>

<property name="beteckning">
<column name="BETECKNING" length="50" not-null="true"/>
</property>

<set name="resurser" table="RELRESURS">
<key column="RESURSID1" not-null="true" foreign-key="FK_RELRESURSID1"/>
<composite-element class="RelResurs">
<parent name="resursid1"/>
<many-to-one name="resursid2" column="RESURSID2" not-null="true" class="Resurs" foreign-key="FK_RELRESURSID2"/>
<property name="fromdatum" length="50" not-null="true"/>
<property name="tomdatum" length="50"/>
</composite-element>
</set>

</class>


Name and version of the database you are using: MySql 5.0.13

Running the mapping document above through the HibernateToolTask to generate Java POJO classes I expected that the parent element would result in a property named "resursid1" of type "Resurs" in the resulting "RelResurs" class. But the setter/getter methods are never writen which causes the following exception to be thrown:

Code:
Caused by: org.hibernate.PropertyNotFoundException: Could not find a setter for property resursid1 in class RelResurs


How can composite-element classes be used if they don't mirror the columns in the underlying table?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 28, 2005 5:42 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
i dont understand your last point, but the part about <parent> is simply just a bug.

add it to our jira with the testcase.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Thought the parent tag would generate a resursid1 property
PostPosted: Sun Oct 30, 2005 4:39 am 
Beginner
Beginner

Joined: Sun Oct 09, 2005 3:21 pm
Posts: 40
Excepted the parent tag to create a "resursid1" property in the class for the composite-element but the getter/setter methods are nevered produced automatically. If I add them everything works fine.

Ended up removing the composite-element from the set relation and created a new class mapping with a composite-id instead then using a "one-to-many" association in the set element. Works.

Sorry about the dubble post before.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 30, 2005 5:32 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
put the bug in jira please.

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.