-->
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.  [ 13 posts ] 
Author Message
 Post subject: Does hbm2java generate <component> mapping java code
PostPosted: Mon Apr 24, 2006 12:55 am 
Newbie

Joined: Mon Jan 09, 2006 8:17 am
Posts: 19
hi,

Just wanted to check if hbm2java generates the relevant java code for a <component> mapping ?

thanks
Tony


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 24, 2006 3:16 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
sure - did you try ? :)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: RE: Does hbm2java generate <component> mapping code ?
PostPosted: Mon Apr 24, 2006 7:05 am 
Newbie

Joined: Mon Jan 09, 2006 8:17 am
Posts: 19
hi,

Yes i did. here is the snippet. I am newbie to HIbernate so i am not surprise if i did something wrong :)

I am not getting any getter/setter for the "Address" class declared in the <component> tag.
Or should i be expecting hbm2java to generate this at all ?
All i am getting is the normal POJO (see the code snippet below).

Thanks for any help
------------------- TbUser.hbm.xml ----------------

<class name="TbUser" table="TB_USER" catalog="auction">
<id name="id" type="short">
<column name="ID" />
<generator class="assigned" />
</id>
<component name="billingAddress" class="Address">
<property name="firstnameC" type="string" column="FIRSTNAME_C />
</component>

....

</class>

---------------------------------------------------------------

-------------- Generated code -----------------------
public class TbUser implements java.io.Serializable {
private short id;
private String firstnameC;
private String middlenameC;
private String lastnameC;
....

public String getFirstnameC() {
return this.firstnameC;
}

public void setFirstnameC(String firstnameC) {
this.firstnameC = firstnameC;
}

....
}

==============


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 24, 2006 7:11 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
how are you generating this ?

which version of the tools ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: RE: Does hbm2java generate <component> mapping code ?
PostPosted: Mon Apr 24, 2006 9:41 am 
Newbie

Joined: Mon Jan 09, 2006 8:17 am
Posts: 19
Hibernate Tools 3.1 beta via Eclipse IDE 3.2

I use Hibernate Console to generate the POJO based hbm.xml file (reverse engineer via JDBC).
I get it to generate the hbm.xml file and then add the hbm.xml file to include the <component> tag and then generate again the POJO.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 24, 2006 9:48 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
1) eclipse 3.2 is not supported yet (should not affect you, but just a warning)

2) when you are doing the second code generation you are not by any chance still reverse engineering via jdbc ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 24, 2006 9:49 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
1) eclipse 3.2 is not supported yet (should not affect you, but just a warning)

2) when you are doing the second code generation you are not by any chance still reverse engineering via jdbc ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 24, 2006 10:06 am 
Newbie

Joined: Mon Jan 09, 2006 8:17 am
Posts: 19
Yes. I am using the reverse engineering via JDBC ...
Would that cause it to ignore the edited hbm.xml file and just go and generate POJO based on the table characteristics instead ?
If that is the case, how can i get hbm2java to generate based on my edited hbm.xml file (with the <component> tag change) ?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 24, 2006 10:13 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
how about trying *not* to enable the reverse engineering via jdbc ? :)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 24, 2006 10:22 am 
Newbie

Joined: Mon Jan 09, 2006 8:17 am
Posts: 19
It does not generate any code without the JDBC reverse engineer selection off.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 24, 2006 10:23 am 
Newbie

Joined: Mon Jan 09, 2006 8:17 am
Posts: 19
Oops ! please let me rephrase ...
The reverse engineer via JDBC needs to be toggled to 'ON' for it to be able to generate POJOs.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 24, 2006 10:27 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
says who ?

the console configuration you point to should just include the mappings via its hibernate.cfg.xml then pojo generation will just pick it up.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 24, 2006 10:49 am 
Newbie

Joined: Mon Jan 09, 2006 8:17 am
Posts: 19
uhhh ! .... thanks. Yes. It worked !

Much appreciated.


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