-->
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.  [ 3 posts ] 
Author Message
 Post subject: Using hypersonic for development and oracle for production
PostPosted: Sat Aug 05, 2006 5:10 pm 
Newbie

Joined: Sat Aug 05, 2006 5:05 pm
Posts: 1
Hi,

We are planning on using hibernate and spring on a new project. In our development environment we are planning on using hypersonic as
our database but in our production environment we will be using oracle.

In oracle we plan to use "sequence" as the generator for primary keys
and for hypersonic we plan to use "identity" (both options are not
supported by either database)

I can't see of a way of switching between the two without having to
change the hibernate mapping for every class. I was hoping to just
change the SQL driver, dialect etc when switching between development
and prod and not have to change any source code or mapping files. Has
anyone come across this problem before and have a more elegant way to
solve this problem.

thanks
Josh


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 05, 2006 11:26 pm 
Regular
Regular

Joined: Fri Oct 01, 2004 2:19 am
Posts: 111
Location: Melbourne, Australia
Hi,

I can see two options here which would not require you to create multiple
mapping files, but they're not necessarily pretty:

1. You can write your own generator class, as per the Hibernate reference
section 6.1.4 and configure it using spring at runtime to do the appropriate thing.
2. Use XML include directives to include an XML fragment for the id generator
and use your build system to provide the correct include file based on
your development environment.

HTH.

_________________
Cheers,

Bonny

please don't forget to rate :)


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 06, 2006 8:10 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
There is no need to have multiple mapping document for this case.
Assumming your using XML, set the id generate as 'native' and include the sequence name and an argument just as you would for a sequence generator so all will be fine in Oracle - see manual. In the case of HSQL the sequence name argument is ignored since Hibernate will know its using an Identiy (rather than the sequence) generator via the selected dialect.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.