-->
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: Using Hibernate Tools to generate plain POJOs
PostPosted: Thu Jul 27, 2006 11:46 am 
Newbie

Joined: Thu Jul 27, 2006 11:36 am
Posts: 10
Hibernate tools version: 3.2.0 beta 6

(Using the tools inside Eclipse)

I am a bit of a noob but I just spend a couple hours trying to find this answer in the forums with no luck so hopefully some kind soul will point me in the right direction. I want to use the hibernate tools to generate simple POJOs from my database. It generated some fantastic HBMs (which is very nice) but now I want to generate POJOs to go with those HBMs and I am having trouble.

When I choose the POJOs option it generates 2 files for each HBM for some strange reason. One appears to be the actual POJO but it is named with Id at the end. The other is named the way I would expect but has only one property (which is the matching POJO class with Id at the end).

Is there a way I can get the HIbernate Tools to just generate the value objects with the right name and not generate the odd wrapper classes?

I suspect it can be done with templates but after looking through the ftl files I am even more confused than I was before. I am hoping that if the answer is templates that someone who already wrote them (if they exist) would possibly post their templates.

Thanks
-AZ


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 30, 2006 9:32 pm 
Newbie

Joined: Fri Jul 14, 2006 10:52 am
Posts: 16
Just only check mark the 'Domain model' exporter in the "Hibernate Code Generation' Exporter tab.[/img]


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 31, 2006 12:49 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
looks to me like your tables does not have any primary key defined and thus the tools will choose to use all of the columns as the identifier.

solution: define primary keys.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 31, 2006 8:15 am 
Newbie

Joined: Thu Jul 27, 2006 11:36 am
Posts: 10
You're right. There are no primary keys on the views (which are something that is controlled by another group) so it looks like the tools worked correctly and I just didn't know enough about them.

Thanks Max. :-)
-AZ


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.