• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

CMP and sequence in oracle

 
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How do i handle the following situation?
I have a CMP bean whose create method takes 4 paramters.These fields are inserted into the database by the container after I deploy the bean.But i also have a field in my oracle database table(primary key) that is sequence.
Oracle doesnot autogenerate sequences and i cannot insert code into a CMP.How do i go about it?How do i tell the container that my PK is a sequence that has to be generated before insertion?
Any pointers for the same will also do.
 
Ranch Hand
Posts: 8946
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Pasted from Oracle 9ias ejb doc
Defining an Auto-Generated Primary Key
If you specify a java.lang.Object as the primary key class type in <prim-key-class>, but do not specify the primary key name in <primkey-field>, then the primary key is auto-generated by the container.
The employee example defines its primary key as a java.lang.Object. Thus, the container auto-generates the primary key.

Once defined, the container creates a column called autoid in the entity bean table for the primary key of type LONG. The container uses random numbers for the primary key values.
 
Pradeep bhatt
Ranch Hand
Posts: 8946
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The doc is for Oracle 9ias 9.0.3
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic