aspose file tools*
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
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: 30908
    
158

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

What did you try? What error did you get?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, 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