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: Can you add mappings at runtime?
PostPosted: Thu Jun 16, 2005 5:18 pm 
Regular
Regular

Joined: Thu Aug 28, 2003 10:54 am
Posts: 67
I have an application that needs to add new database mappings at runtime from plugins. Can this be done? Can I just add them to the configuration programmatically or do I need to rebuild the session factory as well?

thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 16, 2005 5:29 pm 
Regular
Regular

Joined: Thu Apr 21, 2005 9:05 am
Posts: 50
Location: Boston, U.S
Here you go....

SessionFactory sessfact = new Configuration()
.addClass(xx.class)
.addClass(yy.class)
.setProperties(System.getProperties())
.buildSessionFactory();


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 17, 2005 5:21 am 
Regular
Regular

Joined: Thu Aug 28, 2003 10:54 am
Posts: 67
What i mean is after the first session factory is created. So suppose I initialize my session factory. Then, at a later time my app loads a plugin which has its own hbm.xml file.

I then plan to create a new configuration and add the new mapping file to it. Then create a new session factory and replace the old one.

Is this going to work? Can session factories be replaced at runtime?


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.