File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes EJB 1.1/CMP and oracle triggers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB 1.1/CMP and oracle triggers" Watch "EJB 1.1/CMP and oracle triggers" New topic

EJB 1.1/CMP and oracle triggers

Raj Puri
Ranch Hand

Joined: Apr 24, 2003
Posts: 189
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

Joined: Apr 24, 2003
Posts: 189
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.
I agree. Here's the link:
subject: EJB 1.1/CMP and oracle triggers
It's not a secret anymore!