File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
EJB and other Java EE Technologies
How to insert a row using entity bean, but only setting some of the fields
Joined: Jan 13, 2009
Feb 11, 2009 11:16:47
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.
author & internet detective
Joined: May 26, 2003
Feb 11, 2009 18:45:43
Ravi Danum wrote:
I've gotten errors in my attempts thus far.
What did you try? What error did you get?
OCA 8 book
How To Ask Questions The Smart Way
SCEA Part 1
Part 2 & 3
Core Spring 3
TOGAF part 1
I agree. Here's the link:
subject: How to insert a row using entity bean, but only setting some of the fields
How to update row in CMP
PreparedStatement - Performance
Does CREATE a EntityBean mean insert a new record into DB?
Is there a way to change the insert statement generated by an entity bean?
delete a record from db
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015