Hi:
Working on my first spring/hibernate project. We have a DB2 database, which uses different schema names for test and production. For instance,
to access table policy in test I have to code select * from test.policy, and for production, select * from prod.policy.
Here is my hdm.xml file. I hope there is a way to use some setting, which will allow me to set the schema name from a helper class at run time and still preserving hibernate good coding practices.
In place of schema I put question marks.
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping package="com.fpi.domain.impl">
<class name="PolicySpecificsImpl" schema="???" table="policy">
<composite-id name="policyKey" class="com.fpi.domain.impl.PolSpecDb2PrimaryKey">
<key-property name="companyNumber" column="c_num"/> <key-property name="prefix" column="prfx" type="string"/>
<key-property name="policyId" column="polNum" type="integer"/>
</composite-id>
</class>
</hibernate-mapping>
Thank you.
|