Hibernate version: 2.16
Name and version of the database you are using:
DB2 UDB for AS/400. 05.02.0000 V5R2m0
AS/400 Toolbox for Java JDBC Driver v6.0
I am connecting to a DB2 database running on AS/400. We have an existing table structure and schema that is generated by Synon on the AS/400.
Synon is a 4th generation programming language to AS/400 developed by CA.
We connect to the database and must retrieve data's from different database schemas.
I can set the default database schema in the hibernate configuration file.
Code:
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">net.sf.hibernate.dialect.DB2400Dialect</prop>
<prop key="hibernate.default_schema">xx</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
The example above will use
xx as schema name for all my hibernate quries.
How do I change to use another schema name?I would like to change the schema name "on-the-fly". Kinda like a parameter to my Hibernate finder code.
I checked the JavaDOC API and found two methods named setSchema but they are used during configuration and parsing of the mapping files.
Code:
setSchema(String) - Method in class net.sf.hibernate.mapping.Table
setSchemaName(String) - Method in class net.sf.hibernate.cfg.Mappings
Sets the schemaName.
/Claus