-->
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: hibernate mapping file
PostPosted: Tue Apr 07, 2009 9:04 am 
Newbie

Joined: Tue Dec 23, 2008 9:30 am
Posts: 14
hiii
i don't want to put the hibernate configuration file in the src... what can i do?

what we have:
different web sites and applications and we are using the same model (same entities and mapping files) for all of them .. the only thing that differs is the database name (which should be different for each application).


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 07, 2009 2:09 pm 
Beginner
Beginner

Joined: Sun Dec 28, 2008 6:01 pm
Posts: 24
You could specify the hibernate configuration filepath String or as a File object as a parameter of configure() method while creating the SessionFactory object. Something like this...
Code:
SessionFactory sF = new Configuration().configure("filepath String").buildSessionFactory();

OR

SessionFactory sF = new Configuration().configure(new File("filepath String")).buildSessionFactory();



This allows to create multiple SessionFactory objects with different hibernate configuration files connecting to different databases. Check out the API http://www.hibernate.org/hib_docs/v3/api/org/hibernate/cfg/Configuration.html

I hope this helps.

__________________________________________________________
Please don't forget to RATE if this post was helpful


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.