*
The moose likes Object Relational Mapping and the fly likes Hibernate properties Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate properties" Watch "Hibernate properties" New topic
Author

Hibernate properties

Brian R. Wainwright
Ranch Hand

Joined: Aug 12, 2003
Posts: 92
Hi guys (and gals),
I've a general question regarding setting Hibernate properties when using hibernate.cfg.xml. What are (if any) valid property names for not only the root element <hibernate-configuration> but for <session-factory> as well? In other words, I want to be able to set thehibernate.query.substitutions or the hibernate.jdbc.fetch_size values in my xml config file. Are they just the name of the property in hibernate.properties sans the "hibernate" prefix? For example:

I haven't been able to find any info on valid property names (the DTD wasn't helpful in this regard). I know that the API allows you to set properties programmatically after instantiation of a Configuration object, but I haven't been able to find any examples. Perhaps this is the rout I need to go, but again... what are valid property names?

My question here as well is if, as the javadoc states, "A new Configuration will use the properties specified in hibernate.properties by default" does the use of the constructor preclude me from using the values in hibernate.cfg.xml? At what point is are the properties for the Configuration object read? I assume it is on construction....
More than one question, but... I'm evaluating this and need to gain a greater understanding of it before I present my findings. THANKS!
--BW
[ December 19, 2003: Message edited by: Brian R. Wainwright ]
[ December 19, 2003: Message edited by: Brian R. Wainwright ]
Brian R. Wainwright
Ranch Hand

Joined: Aug 12, 2003
Posts: 92
From the Hibernate.org forum:
net.sf.hibernate.cfg.Environment contains the keys of available properties.
does the use of the constructor preclude me from using the values in hibernate.cfg.xml? At what point are the properties for the Configuration object read? I assume it is on construction....

No,
hibernate.properties is read once for the lifetime of the JVM
hibernate.cfg.xml is read every single time you call configuration.configure();
properties are overriden except those considered as System level (see the reference guide).
Have a look a the net.sf.hibernate.cfg package for more infos
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Hibernate properties