refer to:
http://www.youtube.com/watch?v=ReAZmA83Myg&feature=related
and
http://www.java-forums.org/database/1467-variables-hibernate-cfg-xml-file.html
what I understand:
in hibernate.cfg.xml you can setup;
<property name="hibernate.default_schema">exampleDB</property>
or you can construct the hibernate.cfg file at execution time;
cfg.setProperty(Environment.DEFAULT_SCHEMA, "exampleDB");
how you can create default schema for later use;
new SchemaExport(config).create(true,true); //First parameter (true) creates new schema
edit:
and another reference:
http://docs.jboss.org/hibernate/core/3.3/api/org/hibernate/cfg/Environment.html
Provides access to configuration info passed in Properties objects.
Hibernate has two property scopes:
Factory-level properties may be passed to the SessionFactory when it instantiated. Each instance might have different property values. If no properties are specified, the factory calls Environment.getProperties().
System-level properties are shared by all factory instances and are always determined by the Environment properties.
The only system-level properties are
hibernate.jdbc.use_streams_for_binary
hibernate.cglib.use_reflection_optimizer
Environment properties are populated by calling System.getProperties() and then from a resource named /hibernate.properties if it exists. System properties override properties specified in hibernate.properties.
The SessionFactory is controlled by the following properties. Properties may be either be System properties, properties defined in a resource named /hibernate.properties or an instance of java.util.Properties passed to Configuration.buildSessionFactory()