Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate properties

 
Brian R. Wainwright
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic