These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Supporting Oracle and SQL Server
PostPosted: Fri May 02, 2008 9:56 am 
Newbie

Joined: Sun Apr 06, 2008 10:58 am
Posts: 4
Location: UK
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.


Top
 Profile  
 
 Post subject: suggestion
PostPosted: Sun May 04, 2008 3:53 am 
Senior
Senior

Joined: Sun Jun 11, 2006 10:41 am
Posts: 164
AFAIK, the common approach is not to use db-specific features. In your case, a sequence table that allocates IDs for all other tables should be the way to go. Is there a problem with such an imlpementation?

If you feel you still wish to use db-specific features (for performance, etc), it is very popular to have the app installer modify the configuration just before deploying the app.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.