-->
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: components - hbm2java.CodeGenerator
PostPosted: Tue Oct 21, 2003 9:47 am 
Regular
Regular

Joined: Tue Oct 14, 2003 11:11 pm
Posts: 62
Location: Brasil/Curitiba
I'm studying "Chapter 6. Components", and I did the the following example:

Code:
<class name="vo.PersonVO" table="person">
      <id name="id" column="id" type="int">
         <generator class="sequence"/>
      </id>
      <property name="birthday" type="date"/>
      <component name="name" class="vo.NamePerson">
         <parent name="person"/> <!-- reference back to the Person -->
         <property name="initial" type="char"/>
         <property name="first" type="string"/>
         <property name="last" type="string"/>
      </component>
   </class>


In this component, I put a <parent> subelement...
Quote:
The <component> element allows a <parent> subelement that maps a property of the component class as a reference back to the containing entity.


When I run the hbm2java.CodeGenerator to generate the class, two classes are generated, the PersonVO and the NamePerson.
Shouldn't the NamePerson class have a property "person" that references the PersonVO ? If not, How can I accomplish that?

Code:
/** @author Hibernate CodeGenerator */
public class NamePerson implements Serializable {

    /** nullable persistent field */
    private char initial;

    /** nullable persistent field */
    private String first;

    /** nullable persistent field */
    private String last;


then, when I run the SchemaExport, the following error happens:

net.sf.hibernate.PropertyNotFoundException: Could not find a setter for property person in class vo.NamePerson...

I think that the NamePerson class needs a property "PersonVO person;", then when I put the "private PersonVO person;" attribute in the NamePerson class, the SchemaExport runs successfully!

am I right?

thanks

_________________
Ricardo Lecheta


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.