This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes How to insert a row using entity bean, but only setting some of the fields Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "How to insert a row using entity bean, but only setting some of the fields" Watch "How to insert a row using entity bean, but only setting some of the fields" New topic
Author

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

Ravi Danum
Ranch Hand

Joined: Jan 13, 2009
Posts: 104
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

Joined: May 26, 2003
Posts: 32635
    
215

Ravi Danum wrote: I've gotten errors in my attempts thus far.

What did you try? What error did you get?


[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to insert a row using entity bean, but only setting some of the fields
 
jQuery in Action, 3rd edition