wood burning stoves 2.0*
The moose likes JBoss/WildFly and the fly likes Autogenerated field as String datatype Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Autogenerated field as String datatype" Watch "Autogenerated field as String datatype" New topic

Autogenerated field as String datatype

Mike Thomson
Ranch Hand

Joined: Nov 07, 2007
Posts: 115
I have query regarding the primary key generation for entity bean (EJB 2.0) in JBoss Application server.
For Example:
I am having a table product with product_id and product_name as two columns with product_id as primary key.

I want the product_id to be autogenerated with the user specified format. For example, by defining product_id as auto_increment, it will increment the value with integer data type.
However, I want the primaty key to be String datatype. i want the auotgenerated number plus the string definition.
I want the primary as,
product1 (product+auto_incremented_number)

PLease help to throw some ligh on it.
It is sorta covered in the JavaRanch Style Guide.
subject: Autogenerated field as String datatype
Similar Threads
Auto generated Primary Key handling with CMP EJB
Primary Key generation in CMP EJB
Generating a unique id
ManyToMany relationship with extra field in the joinTable
Splitting records in pages