Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB 1.1/CMP and oracle triggers

 
Raj Puri
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have some old code based on EJB 1.1 ,CMP 1.1 works on OC4J(9.0.02). Now going forward seems this does not work(seems it calls getprimarykey in ejbcreate in generated wrappers). Basically, I have a before insert trigger that generates nextval from oracle sequnece and we call create with
all required columns and set the PK to null. Will this setting work in CMP
for generating PK using oracle sequence. We are on OC4J so that is the hard part. Please share your experience. I am sure it will be valuable to many as this is a standard way in Oracle to use sequence.
 
Raj Puri
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Will anyone take a take on this. I am finding that code i have with ejb 1.1 and CMP on OC4J is braking when I move to higher version. This will mean a rewrite. I did not expect this. Has anyone taken code from EJB 1.1.
and moved to EJB 2.0 without any changes. Really code I have is straight from Petstore EJB 1.1 but it is quite big as I have a number of beans. It complaints that I am calling getprimarykey in create method and it is not per EJB 2.0 chapter 10.5.4. Really the code is generated by OC4J/Orion as
wrappers and when I debug it does call at a number of places getprimarykey.
So I will think generated code is messy.

Any one with these kinds of issues. I want to use Oracle trigger(pre-insert) to make PK. I have in code PK value=9999 as containre needs to have some bogus value to work with. Before I tried using null for that it did not work also. I am not sure if that is an issue or the syntax of EJB 1.1 is not supported anyomre and one needs to use different methods(portable) to istantiate the EJB.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic