Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to insert a row using entity bean, but only setting some of the fields

 
Ravi Danum
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I want to insert a row into a table using an entity bean. My problem is I want to use the database default for one of the fields.

For example I want:

insert into MY_TABLE (name, phone_number) values ("Mary", "800-000-0000"),

where MY_TABLE consists of the fields: name, phone_number, todays_date.

The field, todays_date will be set to the current_date by the database at the time a record is inserted.

My entity consists of fields: name, phoneNumber, todaysDate.

I just want to know how to insert a record using an entity bean, but only setting some of the fields.

Does anyone know how to do this? I've gotten errors in my attempts thus far.

Thank you so much for your time and hopefully solutions.

-Rava







 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34681
367
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ravi Danum wrote: I've gotten errors in my attempts thus far.

What did you try? What error did you get?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic