-->
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.  [ 3 posts ] 
Author Message
 Post subject: POJO Generation
PostPosted: Wed Mar 09, 2011 11:07 am 
Newbie

Joined: Mon Jun 23, 2008 11:45 am
Posts: 3
Hi,

I'm using JPA annotations on some interfaces and using the hibernate tools hbm2ddl and hbm2java with a jpaconfiguration to generate my SQL schema and model POJOs.

All is working fine apart from two serious issues with the generated POJOs:
  • The generated POJOs are created with the same package name-space and with the same name as my interfaces (which obviously leads to compilation errors)
  • The generated POJOs do not inherit from the annotated interfaces.

I originally tried to solve this by looking for some property to set in the hbm2java tag but none seem appropriate for my needs.

I then found some documentation on using the <meta> tag in the hbm.xml mapping files to specify which interfaces the generated POJOs should implement. However as I do not use hbm.xml mapping files this isn't an option for me. Is there a way to achieve the same thing using hibernate annotations? (I had a look but could not find anything)

The only other thing I've read about that might provide a solution for me is customizing an *.ftl file.

Could some knowledgeable person tell me if the *.flt route is the right one for my needs or is there a simpler way to alter the behaviour of the hbm2java tool that I have not come across yet.

Many thanks in advance,

Tim


Top
 Profile  
 
 Post subject: Re: POJO Generation
PostPosted: Tue Mar 15, 2011 6:56 am 
Newbie

Joined: Mon Jun 23, 2008 11:45 am
Posts: 3
Ok, so looks like I had higher expectations of ORM than are currently possible.

I was trying to get hibernate to generate my database schema, DAOs and concrete POJOs from my JPA annotated interfaces. Reading this forum post:

http://stackoverflow.com/questions/2912 ... -hibernate

I found that: "From Java Persistence with Hibernate (p.210): Note that the JPA specification doesn’t support any mapping annotation on an interface! This will be resolved in a future version of the specification; when you read this book, it will probably be possible with Hibernate Annotations."

From what I've seen it is still not currently possible with Hibernate Annotations.

So I've resigned myself to having to hand-craft my POJOs and annotate them to generate my DAOs and database schema.

Tim


Top
 Profile  
 
 Post subject: Re: POJO Generation
PostPosted: Mon Apr 11, 2011 6:21 pm 
Newbie

Joined: Mon Apr 11, 2011 5:56 pm
Posts: 1
Maybe you should try @Inheritance annotation, it worked for me when working with abstract classes. But not sure for interfaces, it didn't work for me but maybe you'll get it to work.

_________________
Got my new pioneer avh-p6300bt and I feel happy!!


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