• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Rusty Enisin
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Karthik Guru
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its been a while since i did entity beans. But will having just a getter for that field help?
 
Rusty Enisin
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic