-->
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 dynamic models
PostPosted: Mon Jun 08, 2009 2:45 am 
Newbie

Joined: Mon Jun 08, 2009 2:32 am
Posts: 2
Hi,
Is there a way to dynamically load hbm files (meaning after the java process startup and before I start using the database)? If so can I just load it using my class loader?
Where should I place the hbm files when I use Dynamic models?


Thanks,
Adi.


Top
 Profile  
 
 Post subject: Re: Using dynamic models
PostPosted: Mon Jun 08, 2009 2:52 am 
Beginner
Beginner

Joined: Mon Jun 01, 2009 5:39 am
Posts: 34
This is not built into Hibernate.

But I'm on such a project and I can dynamically load mappings... But I do NOT use POJOs. This therefore means that if you do and your classes do not exist, you will fail to spawn a new session factory - which is no biggy since it won't scrap the existing one.

If you're interested, let me know.


Top
 Profile  
 
 Post subject: Re: Using dynamic models
PostPosted: Mon Jun 08, 2009 6:46 am 
Newbie

Joined: Mon Jun 08, 2009 2:32 am
Posts: 2
Sure I'm interested, I use dynamic models so if I could load hbm files after startup it will be great.
Where do you load the mapping to? Is it to memory or you just add it as a resource in your class loader?

Regards,
Adi.


Top
 Profile  
 
 Post subject: Re: Using dynamic models
PostPosted: Mon Jun 08, 2009 8:01 am 
Beginner
Beginner

Joined: Mon Jun 01, 2009 5:39 am
Posts: 34
adim wrote:
Sure I'm interested, I use dynamic models so if I could load hbm files after startup it will be great.

Where do you load the mapping to? Is it to memory or you just add it as a resource in your class loader?


Well, I take a different approach: it's the user who submits a new mapping (I call this "object model") to the core via a Web interface. I then validate this model using Hibernate's Configuration object, and if the validation is OK, I replace the current SessionFactory.

I don't use the Configuration's .addResource(), or .addFile() method (although it could be possible). I use .addXML(), which takes an XML string corresponding to the mapping (and which I serialize to the database).


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.