-->
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.  [ 1 post ] 
Author Message
 Post subject: Proprietary hibernate ( .hbm.xml files question )
PostPosted: Mon Jun 04, 2012 5:04 pm 
Newbie

Joined: Wed Sep 14, 2011 12:36 am
Posts: 4
We are using the old style (proprietary hibernate - not JPA ) using .hbm.xml files. The plan is to eventually go to JPA the next release but not right now.

We have a product that ships where the customer may choose any one of four databases:

PostgreSQL
MySQL
Oracle
SQL Server

Both MySQL and SQL Server have database constructs that support self-incrementing primary keys. For PostgreSQL and Oracle we are using sequences.

In the .hbm.xml file for the primary sequence, we specify 'native' and for the PostgreSQL / Oracle .hbm.xml files we use the named sequence.

We have not found an easy way to maintain two sets of .hbm.xml files and I wanted to get some suggestions.

My ideal solution would be to not/ever check in any .hbm.xml file but have it generated during the build from a DB the build can connect to. We use maven so would setup two profiles:
1) MySQL / SQL Server
2) Oracle / PostgreSQL

and have the correct entry created there for the sequence. I am not sure if this can be done and if there is a maven plugin that will do this, and do not even know if .hbm.xml files can be generated from a model alone. The only way to do this would be to have some sort of mapping file that would have hard coded the name of the sequence per table.

At any rate, if there is an easier way to manage multiple DB's like this and manage multiple .hbm.xml files (per table), please let me know.


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

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.