-->
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.  [ 5 posts ] 
Author Message
 Post subject: Hibernate Mapping - Cross platform development
PostPosted: Fri Mar 24, 2006 10:06 am 
Newbie

Joined: Thu Aug 04, 2005 9:48 pm
Posts: 5
Location: Brazil
Morning, People.

I'm starting with Hibernate 3.0, and I have a doubt.

I'm trying to develop a system that could be used in various DB engines (Oracle, MS SQL Server, PostgreSQL, MySQL).

I've already read the Hibernate documentation, about mapping the id column in database. I use sequences, in Oracle and Postgre, and auto-increment columns, in MS SQL Server and MySQL. So, I should use the "native" generator class, as the documentation says.

But, how could I tell Hibernate what sequence it should gets the id?

Thanks for helping me.

Buosi.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 24, 2006 12:12 pm 
Regular
Regular

Joined: Wed Nov 17, 2004 11:49 am
Posts: 65
Location: Pittsburgh
Why not use one of the other generators available in org.hibernate.id, such as MultipleHiLoPerTableGenerator or TableHiLoGenerator? Both of these generators have the advantage of removing any dependency on the underlying database for primary key generation and are very performant if you set max_lo to something > 1.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 24, 2006 1:38 pm 
Newbie

Joined: Thu Aug 04, 2005 9:48 pm
Posts: 5
Location: Brazil
Ok, I've read about it in Hibernate Documentation, but it says that HiLo couldn't be used when the user supplies the connection. What does it mean?

I use Tomcat pooling for my connections. Will it work with HiLo?

Thanks again.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 24, 2006 1:56 pm 
Beginner
Beginner

Joined: Sun Feb 19, 2006 3:50 am
Posts: 34
I haven't used HiLo myself so I can't guarantee anything, but normally a "user supplied connection" means that you're manually using Session.disconnect() and Session.reconnect(Connection) on all your sessions instead of letting the session deal with the JDBC connections automatically. Since you're using a tomcat connection pool I don't think you're doing user supplied connection management.

HiLo should work for you I think.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 24, 2006 2:02 pm 
Newbie

Joined: Thu Aug 04, 2005 9:48 pm
Posts: 5
Location: Brazil
Ok, I understood, I'll test.

Thanks for everybody.
Carlos Buosi.


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