If you're using BMP you can mitigate part of the cost of the generation by
batching it with the insert statement in ejbCreate.
Cheers
Jay Walters
-----Original Message-----
From: Rahman, Zahid [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 06, 2001 7:59 AM
To: [EMAIL PROTECTED]
Subject: Re: Autonumber primary keys
If the java random generator doesn't give the result you require
to generator a Unique Number which is what you are after
then another approach can be if you are using Oracle is to create a SEQUENCE
on the database.
Then each time you retrieve the sequence it is incremented by 1 by default
therefore it is a unqiue number
.You can set the incremental value. This way you will always have a unqiue
Integer number.
Your overhead costs are that you will obviously have to retrieve the number
from the database ( execute a quey)
whether that causes significant performance problem I cannot say
Regards,
Zahid
> -----Original Message-----
> From: Jose González Gómez [SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday, February 06, 2001 12:35 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Autonumber primary keys
>
> Reddy,
>
> As Myles says, you must change the type of your primary keys if you
> want to use VMID/UID classes for generating your keys. We are using
> this, and it works great, but we first investigated the impact of using
> such a primary key in the performance of our database. We are using
> Oracle, and we took a look at the documentation about this. Oracle
> doesn't perform worse if you use char or varchar primary keys, but maybe
> your RDBMS does, so you couldn't use this approach.
>
> Just another thing about UID/VMID. I think the maximum length of the
> string generated by this algorithm is 47, based on the types used by the
> algorithm. We use a VARCHAR(50) in our database to hold this value.
>
> regards
> Jose
>
> Jeffery, Myles wrote:
>
> > Sorry Reddy but I think that the VMID/UID classes will not help you
> unless
> > you change the data type of your database. The VMID/UID classes cannot
> be
> > reduced to a simple integer as an integer does not give enough
> combinations
> > to gaurantee uniqueness. The data type you would need would be a char
> of at
> > least 40 in size (you will have to work that out yourself), or you could
> use
> > a combination of data types.
> >
> > Perhaps the VMID/UID classes will not work with your project and a
> simple
> > counter system will work better - it is a decision you must make.
> >
> > Myles
> >
> >> -----Original Message-----
> >> From: E Bakka Reddy [SMTP:[EMAIL PROTECTED]]
> >> Sent: 06 February 2001 11:02
> >> To: [EMAIL PROTECTED]
> >> Subject: Re: Autonumber primary keys
> >>
> >> Hi Myles
> >>
> >> I am getting the keys like following
> >>
> >> UID random key gen...111f71:e15229e846:-8000 VMID random key
> >> gen...9cce8edc2a0eb045:111f71:e15229e846:-7fff
> >>
> >> but my database field is integer type, how this is useful, but there is
> a
> >> hashCode() method on these classes, can we use it, is it correct way.
> >>
> >> Thanks,
> >> Reddy
> >>
> >>
> ==========================================================================
> >> =
> >> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> >> body
> >> of the message "signoff EJB-INTEREST". For general help, send email to
> >> [EMAIL PROTECTED] and include in the body of the message "help".
> >>
> >
> >
> ==========================================================================
> =
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> > of the message "signoff EJB-INTEREST". For general help, send email to
> > [EMAIL PROTECTED] and include in the body of the message "help".
> >
>
> ==========================================================================
> =
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> of the message "signoff EJB-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".