Hi there.
We have a working application using
hibernate3. Configuration is done use mapping mapping files.
Current database is
Oracle 10g
We need to extend the application to support
SQL Server for a new client and this raises a number of issues.
First ff is the issue of sequences(oracle) and identities(SQL Server).
At the moment we specify the id in each of the mapping files as follows:
Code:
<id name="id" type="java.lang.Long">
<meta attribute="use-in-tostring">true</meta>
<column name="ID" not-null="true"/>
<generator class="native">
<param name="sequence">SEQ_TABLE_NAME_PK</param>
</generator>
</id>
This will not work with SQL Server as it needs to be an
identity.
One option would be to create a whole duplicate set of mapping files with all the problems that will entail.
Can someone suggest a better solution ?
I was wonderring if one solution might be to implement our own
IdentifierGenerator that could determine the d/b type and then use the
existing ones but the existing ones are quite different to each other and have quite different public APIs.