Re: [JBoss-user] automatic primary key generation for CMP entityBeans?

2003-12-13 Thread Alexey Loubyansky
[EMAIL PROTECTED] wrote:
The generator I have in mind will increment the values.
Where do you plan to store the values? Database?

In the interfaces, I cant see some init(startValue) method or something
similar. This method should be there and should be called on initializing
the generator.
Couldn't you initialize the generator in 
KeyGeneratorFactory.getKeyGenerator()?

The UUIDGeneratorFactory returns a new instance of
the generator every time. This is no problem with random keys,
but for incrementing, I have to synchronize the multiple instances
of the keygenerator in some way.
Yes.

Does somebody have any comments on that or can point me in the
right direction ? Thanks in advance
Do you know how the HiLo generators work? It seems to me it is what you 
need.



---
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278alloc_id=3371op=click
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


Re: [JBoss-user] automatic primary key generation for CMP entityBeans?

2003-12-12 Thread stscit04
I have seen the UUIDKeyGeneratorFactory, where can I find information
about how to write my own factory ? I also need to know how to
use entity-commands/how to use the default keygenerator.

Thanks in advance,

Stefan

 select max() is not safe. Look at standardjbosscmp-jdbc.xml file for
 entity-commands for avaliable key generations.

 [EMAIL PROTECTED] wrote:

 Hello, everyone

 I have a Entity Bean with a String as PK.
 The String consists of the characters [0-9]and[A-Z].

 My approach is to get the latest key from the DB
 with an ejbSelect method(select MAX()). Is this
 safe, or is it possible that I assign accidentially the same PK
 to 2 entitys because the PK of the first one doenst show up
 in the DB while generating the second key ?

 Does JBoss have any sort of PK generator which I can
 configure ? Or can I use the auto-increment function of the
 Database (I want Jboss to create the tables).

 Thanks for any suggestion,

 Stefan


 ---
 This SF.net email is sponsored by: IBM Linux Tutorials.
 Become an expert in LINUX or just sharpen your skills.  Sign up for
 IBM's
 Free Linux Tutorials.  Learn everything from the bash shell to sys
 admin.
 Click now! http://ads.osdn.com/?ad_id=1278alloc_id=3371op=click
 ___
 JBoss-user mailing list
 [EMAIL PROTECTED]
 https://lists.sourceforge.net/lists/listinfo/jboss-user





 ---
 This SF.net email is sponsored by: IBM Linux Tutorials.
 Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
 Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
 Click now! http://ads.osdn.com/?ad_id=1278alloc_id=3371op=click
 ___
 JBoss-user mailing list
 [EMAIL PROTECTED]
 https://lists.sourceforge.net/lists/listinfo/jboss-user




---
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278alloc_id=3371op=click
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


Re: [JBoss-user] automatic primary key generation for CMP entityBeans?

2003-12-12 Thread Alexey Loubyansky
[EMAIL PROTECTED] wrote:

I have seen the UUIDKeyGeneratorFactory, where can I find information
about how to write my own factory ?
You need to implement two interfaces:
org.jboss.ejb.plugins.keygenerator.KeyGeneratorFactory and 
org.jboss.ejb.plugins.keygenerator.KeyGenerator.
Check the org.jboss.ejb.plugins.keygenerator.uuid for an example.
This is in the server module. Count on my guidance. We are interested in 
contributions.

I also need to know how to
use entity-commands/how to use the default keygenerator.
A field that should use a generator is marked with auto-increment/ in 
jbosscmp-jdbc.xml. And the entity that has an auto-incremented field 
should have an entity-command element that says what generation is used 
for that field. For example, the command that uses a key-generator is

!-- uses key generator to fetch the next key value --
entity-command
   name=key-generator 
class=org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCKeyGeneratorCreateCommand
   attribute
  name=key-generator-factoryUUIDKeyGeneratorFactory/attribute
/entity-command

The UUIDKeyGeneratorFactory is the JNDI name under which the key 
generator factory is bound.

The UUID key generator is an MBean that is bound into the JNDI on the 
start. It produces String values.

Thanks in advance,

Stefan


---
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278alloc_id=3371op=click
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


Re: [JBoss-user] automatic primary key generation for CMP entityBeans?

2003-12-12 Thread stscit04

 I have seen the UUIDKeyGeneratorFactory, where can I find information
 about how to write my own factory ?

 You need to implement two interfaces:
 org.jboss.ejb.plugins.keygenerator.KeyGeneratorFactory and
 org.jboss.ejb.plugins.keygenerator.KeyGenerator.
 Check the org.jboss.ejb.plugins.keygenerator.uuid for an example.
 This is in the server module. Count on my guidance. We are interested in
 contributions.

Thank you very much! I will take alook at this, I have to check
with my boss, maybe we can contribute the generator.

 I also need to know how to
 use entity-commands/how to use the default keygenerator.

 A field that should use a generator is marked with auto-increment/ in
 jbosscmp-jdbc.xml. And the entity that has an auto-incremented field
 should have an entity-command element that says what generation is used
 for that field. For example, the command that uses a key-generator is

 !-- uses key generator to fetch the next key value --
 entity-command
 name=key-generator
 class=org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCKeyGeneratorCreateCommand
 attribute
name=key-generator-factoryUUIDKeyGeneratorFactory/attribute
 /entity-command

 The UUIDKeyGeneratorFactory is the JNDI name under which the key
 generator factory is bound.

 The UUID key generator is an MBean that is bound into the JNDI on the
 start. It produces String values.




---
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278alloc_id=3371op=click
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


Re: [JBoss-user] automatic primary key generation for CMP entityBeans?

2003-12-12 Thread stscit04
 I have seen the UUIDKeyGeneratorFactory, where can I find information
 about how to write my own factory ?

 You need to implement two interfaces:
 org.jboss.ejb.plugins.keygenerator.KeyGeneratorFactory and
 org.jboss.ejb.plugins.keygenerator.KeyGenerator.
 Check the org.jboss.ejb.plugins.keygenerator.uuid for an example.
 This is in the server module. Count on my guidance. We are interested in
 contributions.

The generator I have in mind will increment the values.
In the interfaces, I cant see some init(startValue) method or something
similar. This method should be there and should be called on initializing
the generator.

The UUIDGeneratorFactory returns a new instance of
the generator every time. This is no problem with random keys,
but for incrementing, I have to synchronize the multiple instances
of the keygenerator in some way.

Does somebody have any comments on that or can point me in the
right direction ? Thanks in advance

Stefan


---
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278alloc_id=3371op=click
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] automatic primary key generation for CMP entityBeans ?

2003-12-11 Thread stscit04
Hello, everyone

I have a Entity Bean with a String as PK.
The String consists of the characters [0-9]and[A-Z].

My approach is to get the latest key from the DB
with an ejbSelect method(select MAX()). Is this
safe, or is it possible that I assign accidentially the same PK
to 2 entitys because the PK of the first one doenst show up
in the DB while generating the second key ?

Does JBoss have any sort of PK generator which I can
configure ? Or can I use the auto-increment function of the
Database (I want Jboss to create the tables).

Thanks for any suggestion,

Stefan


---
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278alloc_id=3371op=click
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


Re: [JBoss-user] automatic primary key generation for CMP entityBeans ?

2003-12-11 Thread Alexey Loubyansky
select max() is not safe. Look at standardjbosscmp-jdbc.xml file for 
entity-commands for avaliable key generations.

[EMAIL PROTECTED] wrote:

Hello, everyone

I have a Entity Bean with a String as PK.
The String consists of the characters [0-9]and[A-Z].
My approach is to get the latest key from the DB
with an ejbSelect method(select MAX()). Is this
safe, or is it possible that I assign accidentially the same PK
to 2 entitys because the PK of the first one doenst show up
in the DB while generating the second key ?
Does JBoss have any sort of PK generator which I can
configure ? Or can I use the auto-increment function of the
Database (I want Jboss to create the tables).
Thanks for any suggestion,

Stefan

---
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278alloc_id=3371op=click
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user



---
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278alloc_id=3371op=click
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user