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:
Code:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>
<property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
<session-factory>
<property name="connection.datasource">java:comp/env/jdbc/scapeDB</property>
<property name="show_sql">false</property>
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<property name="batch_size">25</property>
<property name="use_outer_join">true</property>
<!-- Mapping files -->
<mapping resource="scape.hbm.xml"/>
</session-factory>
</hibernate-configuration>
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?
Code:
Configuration config = new Configuration();
config.setProperty("batch_size", "25");
sessionFactory = config.configure().buildSessionFactory();
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 are the properties for the Configuration object read? I assume it is on construction....
Thanks!