wood burning stoves 2.0*
The moose likes EJB and other Java EE Technologies and the fly likes How to tell a CMP to ignore a field on insert? 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 "How to tell a CMP to ignore a field on insert?" Watch "How to tell a CMP to ignore a field on insert?" New topic
Author

How to tell a CMP to ignore a field on insert?

Rusty Enisin
Ranch Hand

Joined: May 26, 2005
Posts: 107
Our database will not allow the CMP to insert a value for a timestamp because there is a trigger that does it. The trigger sets the value on insert so the CMP cannot. If the CMP sets the value, I get an error. Unfortunately, the CMP tries to insert a value for ALL fields.

In order to get the app to work I had to remove the field. But I really need this field value later on in the app.

Is there a way to tell the CMP to ignore that field on insert?


The squeaky wheel gets the grease. Well, that or replaced...
Karthik Guru
Ranch Hand

Joined: Mar 06, 2001
Posts: 1209
Its been a while since i did entity beans. But will having just a getter for that field help?
Rusty Enisin
Ranch Hand

Joined: May 26, 2005
Posts: 107
Yeah. I thought that too. But the EJB framework (2.0 is what I am using...) requires both a setter and a getter for each field.
rajeev rana
Greenhorn

Joined: Dec 30, 2004
Posts: 5
Rusty,

you would define the abstract getters and setters for your Entity EJB as per 2.0 specification, What you need to modify is your create method. Here you won't invoke the setter for the field which you don't want to set at insertion.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to tell a CMP to ignore a field on insert?
 
Similar Threads
Identity keys, WebLogic and EJB CMP CMR
oracle date format
How to distinguish between two different button clicks on servlet
how to insert clob data using CMP
ejbCreate's return value(Entity Bean)