-->
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.  [ 2 posts ] 
Author Message
 Post subject: Autogenerating hibernate annotations....? is it possible?
PostPosted: Wed Mar 03, 2010 11:01 pm 
Newbie

Joined: Wed Mar 03, 2010 10:47 pm
Posts: 2
Hi! I want to make a tool that will autogenerate annotations (via Javassist) to some classes.

I have doubts about the classloaders... suppose I have House.java, I make magic with Javassist and then I have a new version of House.java, with Hibernate annotations...

Then, I will "start" hibernate with AnnotationConfiguration, using configuration.addAnnotatedClass(..) and I will pass the new version of House.java, it should work by now.

If I get to this point, everything working, ¿shouldn't I have some problems with both versions of House.java?

I mean, if I want to create a new House and I do this:
HibernateUtil.getSession().save( newHouse );

¿What happens if newHouse was using the first version (the one who did NOT have annotations)? I think it shouldn't work.

Any ideas? Thanks!


Top
 Profile  
 
 Post subject: Re: Autogenerating hibernate annotations....? is it possible?
PostPosted: Thu Mar 04, 2010 3:46 pm 
Newbie

Joined: Wed Mar 03, 2010 10:47 pm
Posts: 2
Answering myself: it IS possible. You can create a "meta language" using annotations, much simpler than real hibernate annotations. The only "cons" of processing and injecting annotations at runtime, is that you need reloading capabilities, in my case, I use javarebel, it does the job.

So, using javarebel.. no classLoader problems! Javassist does the rest.


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