-->
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: Map String, Map Class and Reload Hibernate
PostPosted: Wed Oct 20, 2010 1:57 pm 
Newbie

Joined: Sat Dec 12, 2009 11:51 pm
Posts: 2
I have three interrelated questions. Any help would be greatly appreciated. At this point I'm just asking for high level responses, if you have supporting sections of either the hibernate manual or blogs/informational sections that would also be greatly appreciated. I hope I defined my questions out well enough.

1: Using the "classic" hibernate paridigm (User.hbm.xml, Role.hbm.xml, Address.hbm.xml, Contact.hbm.xml) instead of having hibernate auto-detect these xml files could I pass in the value of the xml files as string/dom and then tell hibernate to initialize based on those xml strings? In this example I have no line of sight to the direct xml files, rather they are stored in some arbitrary system where I Can only get the contents in string values (example: new User().toHBMXML() returns a hbm.xml style xml Document). In this example I'm looking for something like Session.addMapping(String xml) / Session.getMappings() List<String> / Session.loadMappings()

2: Using the annotations system can I tell hibernate to use X classes. These classes aren't available right at startup, rather they are in a jar that I dynamically load, after loading the jar I would like to tell hibernate to have the User, Role, Access and Contact classes included when it initializes. So like the example above it would be Session.addMapping(Class c), Session.getMappings() List<Class>, Session.loadMappings()

3: Reloading hibernate completely. If I can do #1 or #2 could I tell hibernate to use a NEW list of XML documents and then have it flush/reload without stopping and starting the server (tomcat)? This would be a "clean" flush, meaning that it would recompile all hbm files, not just the "new" or "changed" ones. For example, I have User, Role, Address, Contact then I add in Project. I'll supply all hbm.xml files and Hibernate will recompile the whole lot and add in Project.

I hope this makes sense


Top
 Profile  
 
 Post subject: Re: Map String, Map Class and Reload Hibernate
PostPosted: Wed Oct 20, 2010 4:24 pm 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
Quote:
1: Using the "classic" hibernate paridigm (User.hbm.xml, Role.hbm.xml, Address.hbm.xml, Contact.hbm.xml) instead of having hibernate auto-detect these xml files could I pass in the value of the xml files as string/dom and then tell hibernate to initialize based on those xml strings?


You can do this with the Configuration.addXML() or Configuration.addDocument() methods. Check chapter 3 in the Hibernate reference documentation: http://docs.jboss.org/hibernate/stable/ ... ation.html


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.