-->
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: How to persist runtime inheritance
PostPosted: Tue May 30, 2006 2:55 pm 
Newbie

Joined: Tue May 30, 2006 2:35 pm
Posts: 3
Hi!

I am using hibernate for quite sometime now and has been a happy user.
Recently my project required a solution where runtime inheritance and its persistance was required (so I thought) and its difficult to solve in hibernate.

Let me tell you about the problem....
I have an accounting system which has Object model as follows

AccountBook (Contains multiple account groups)
AccountGroup (Can contain multiple Account Sub groups or Account Heads)
AccountHead (Can contain multiple Account Entries)
AccountEntry

To model this object graph bidirectionally is not difficult in hibernate until you know this that AccountEntries can be of different types and will be configured by users at runtime. For eg, I as an user can configure AccountEntry types to be anything depending on my organizations requirement. For eg, I can choose ...

1) GeneralLedger
2) AccountsReceivable
3) AccountsPayables
4) ProfitLossAccount

Typically, user will name the AccountEntry type on a webpage and will define the fields each type of AccountEntry will contain.

To model this requirement, I needed to create a subclass for AccountEntry dynamically (GeneralLedger extends AccountEntry, for eg) with all the fields as specified by the user at runtime and then I have to compile dynamic class as well at runtime and then have to create mapping files, update hibernate configuration and rebuild the factory.

I am successful to do all that dynamically but its very tedious and does not work on JBoss because when I load dynamically created class (which I generate in an external folder than Jboss) which extends from AccountEntry, the classloader upperdelegation model fails to load dynamically generated class though it can find it because it extends from AccountEntry which resides within WAR file and hence scoped and cannot be accessed by classloader which loads GeneralLedger dynamic class which is not scoped.

can somebody suggest a different way to model the above problem or suggest a workaround so that works on JBoss

Rgds


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.