-->
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: create new id generator
PostPosted: Fri Jun 10, 2005 7:05 am 
Newbie

Joined: Thu Nov 25, 2004 5:56 am
Posts: 7
Location: Slovenia, Europe
Hibernate version: 3


Hi !

I am trying to creat new id generator and I have some problems.

I need generator that will look at id, and if id is set, and more than zero then it will use it, if id is not set or/and less or equal to 0 , then it will return next free id. So this generator will be Assign/Increment.

Method generate() is quite straightforward, but I am little confused with configure() method.

Can somebody point to any documentation on how to do this? Or if there are any samples?

Thanks for all help in advance.
Andy


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 10, 2005 7:14 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
You know that Hibernate is open source?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 10, 2005 9:39 am 
Regular
Regular

Joined: Wed Feb 02, 2005 6:33 am
Posts: 70
As Christian hinted, take a look at the id generators themselves, esp. the ones you want to fall back on if the id is not already assigned.

Having looked at doing something similar myself, I must remind you to set the unsaved-value parameter of the id fields to something suitable (in my case, I ended up using 'undefined'). Otherwise, when it comes to cascading a save or update, the update option would always be taken.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 13, 2005 4:50 am 
Newbie

Joined: Thu Nov 25, 2004 5:56 am
Posts: 7
Location: Slovenia, Europe
Hi guys !

Thanks for info. I know that software is Open Source (and I know definition of Open Source).

I have two classes to which I will fall back, first is Asssigned and second is IncrementGenerator.

Problem is with second method (implemented from Configurable). I don't know exactly when it's called. If it's called before generate, then I have a problem, but if not then everything will be ok.

I will send message here how I am proceeding...

Andy


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 04, 2008 5:29 pm 
Newbie

Joined: Thu Nov 25, 2004 5:56 am
Posts: 7
Location: Slovenia, Europe
Hi !

It's been quite some time since my last post. I have created this id generator and called it AssignedIncrementGenerator. I have been using it for few years now and it seems to work ok.

I would like to contribute it to hibernate source code, since there are probably some users who would find it's functionality helpful.
How can I do that?

Andy


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.