This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes Is there a way to change the insert statement generated by an entity bean? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Is there a way to change the insert statement generated by an entity bean?" Watch "Is there a way to change the insert statement generated by an entity bean?" New topic
Author

Is there a way to change the insert statement generated by an entity bean?

Ravi Danum
Ranch Hand

Joined: Jan 13, 2009
Posts: 104

Is there a way to change the insert statement generated by an entity bean?

I'm using the Toplink JPA.

Thanks in advance.

Ravi

Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30123
    
150

Ravi,
Change it how?


[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
Ravi Danum
Ranch Hand

Joined: Jan 13, 2009
Posts: 104
Jeanne,

I have a table, PERSON and fields: NAME, ADDRESS, PHONE, and TIMESTAMP.

I have an entity bean PERSON with the 4 fields above.

When I insert a row, I want the insert statement to be:

insert into PERSON (NAME, ADDRESS, PHONE) values ("Mary", "111 Maple Lane", "888-888-8888");

Notice that TIMESTAMP is left out...that is because I want the database to fill this in. I want to use the database's default value for this.

Thanks so much.

Ravi
Ravi Danum
Ranch Hand

Joined: Jan 13, 2009
Posts: 104
Hello Jeanne,

Previously I was working with an entity bean generated from a database table. I just created a new entity bean (not generated from database) and left off the timestamp field. This worked. Thanks for your interest.

-Ravi

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is there a way to change the insert statement generated by an entity bean?
 
Similar Threads
Pooling vs Instance Caches
Testing @ManyToOne Relationships
EJB Transaction Problem
JPA - Many to Many Question
Jboss:Hypersonic:Manual table creation:CreateException