-->
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: on the fly creation of entity classes
PostPosted: Thu Jul 03, 2008 8:47 pm 
Newbie

Joined: Thu Jul 03, 2008 8:31 pm
Posts: 1
Hi.

I really like how ActiveRecord or SQLObject make my life more easy when it comes to ORM. Ok, they miss certain features Hibernate has (e.g. good support for mapping inheritance). But you don't have to write as much of redundant code as you have to do with Hibernate/JPA. They automatically create methods to manipulate your entity classes while preserving referential integrity.

I figured using a code generation library like cglib something similar should be possible with Java, too. I thought it would be nice to just annotate an interface or abstract class and the framework builds the implementing class (including methods like toString, hashCode and equals) on the fly. The implementing classes of annotations are built that way, so this should be possible!

I wrote a little proof of concept implementation of this. However, this implementation is not an ORM, it just implements the things Hibernate/JPA doesn't. And it most certainly could be implemented better (there is room fro optimizations, I didn't handle inheritance and so there are a few hackish bits, that will cause problems there).

I wrote a blogpost about this. You can see a short example and download the source there, too:
http://twoday.tuwien.ac.at/pub/stories/316042/

I'd like to know how others think about this. Is this something that users could possible want? I think it would be a very nice feature and it could be implemented in a way where it doesn't interfere with the current behavior at all. Using abstract classes you could also combine both ways!

-panzi


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.