-->
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.  [ 4 posts ] 
Author Message
 Post subject: id generator within EJB
PostPosted: Fri Jun 25, 2004 11:36 am 
Beginner
Beginner

Joined: Sun Mar 28, 2004 9:01 am
Posts: 21
Can anyone give me an advice which id Generator to use within EJB's?

increment: The documentation gives the advice 'Do not use in a cluster', but we have a cluster -> NO

identity and sequence: Depends on the database, but I want to be database independent! -> NO

hilo: Documentation says 'Do not use this generator with connections enlisted with JTA or with a user-supplied connection' but I use EJB's so I have JTA! -> NO

uuid.hex: Could be used, but char(32) keys are quite inefficient. -> YES

So the only solution to me seems an unefficient uuid.hex generator. As listed in a previous post the HILO EJB doesn't seem to work using Hibernate within MBeans!

Can anyone give me an advice?
Thx Rene!


Top
 Profile  
 
 Post subject: to trivial
PostPosted: Sat Jun 26, 2004 12:43 pm 
Beginner
Beginner

Joined: Sun Mar 28, 2004 9:01 am
Posts: 21
Sorry, is the question to trivial or is it too complicated to answer. I really need a solution until monday!

I wonder what other J2EE developers did? There's a lot of literature about using Hibernate in Web applications but only few literature on how to use it within an managed architecture?

I wonder what the advice from the Hibernate developers would be? The uuid.hex generator is not a popular approach as told by Gaving King in 'Hibernate in Action' page 91 as varchar primary keys consume more database space than numeric keys and are marginally slower.

But again, how can numeric primary keys be achieved without using proprietary features like identity and sequence that are additionally slow because the need two database transactions?

Please help!
Thx Rene


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 27, 2004 12:25 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
They don't, use a sequence if your database supports it. Thats what they are made for.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 06, 2004 11:26 am 
Regular
Regular

Joined: Mon Jun 14, 2004 1:42 pm
Posts: 80
Location: Brazil
I have the same doubt. And I hate sequences, it makes you be bound to database specific problems. I'm searching for advice on that topic. Looks like everybody is just trying to ignore the existence of this problem.
Even a ejb stateless solution is not good: I may not want to use EJB at all and still have a managed set using servlets.
I was thinking about implementing an alien generator that goes directly in a datasource and gets a new connection. This goes beyond hibernate, is a weak point in the J2EE-JCA "mono connection" way of work.
I'd like to see a good reply on this topic.


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