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.  [ 5 posts ] 
Author Message
 Post subject: Swing and Hibernate Configuration
PostPosted: Tue Jan 31, 2006 9:00 pm 
Newbie

Joined: Fri Dec 30, 2005 12:47 pm
Posts: 11
Hibernate version: 3.0

Hi.. i am developing an application using Swing, now i need that administrator user can change database configuration (username, password, url or port of connection to DB).

How can i do that and still using hibernate.cfg.xml for mapping resources and common properties??


Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 01, 2006 5:31 am 
Newbie

Joined: Fri Dec 23, 2005 7:54 am
Posts: 12
I think you'll have to re-create your SessionFactory.
Additionally you will have to drain your persistence before doing that.

Why do you want to use the hibernate.cfg.xml file BTW?

Francesco


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 01, 2006 6:11 am 
Expert
Expert

Joined: Tue Nov 23, 2004 7:00 pm
Posts: 570
Location: mostly Frankfurt Germany
DrVillo is right, in addition look in the reference or Wiki.
Somewhere are examples for setting Hibernate properties directly from Java.
I think it's
configuration.setProperty

Regards Sebastian

_________________
Best Regards
Sebastian
---
Training for Hibernate and Java Persistence
Tutorials for Hibernate, Spring, EJB, JSF...
eBook: Hibernate 3 - DeveloperGuide
Paper book: Hibernate 3 - Das Praxisbuch
http://www.laliluna.de


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 01, 2006 12:03 pm 
Newbie

Joined: Fri Dec 30, 2005 12:47 pm
Posts: 11
hi.

I try with configuration.setProperty but when buildSessionFactory() is called throw a exception sayng: user must supply database connection.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 01, 2006 12:39 pm 
Newbie

Joined: Fri Dec 30, 2005 12:47 pm
Posts: 11
Thanks now i only using progamatic configuration and the problem with setProperty is solved.

The cause was the name of property for example in XML is:
connection.driver_class but in properties is:
hibernate.connection.driver_classs

Thanks again..


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.