File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes DB default values with CMPs 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 "DB default values with CMPs" Watch "DB default values with CMPs" New topic
Author

DB default values with CMPs

Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2850
    
  11

We are using a CMP for data access. One of the fields is defined in our database (Oracle) as non-null and has a default value. However, if that field is not set on the CMP, the create() method ends up trying to insert a null into the field, which doesn't work. Is there any way to have it simply leave that field out of the insert and let the database use its default?
Vinay Raj
Ranch Hand

Joined: Jun 19, 2006
Posts: 81
Most of the app. servers would not support such a feature. The app. server that typically supports such advanced features is weblogic. If you are using one check out its documentation else my humble suggestion is to set the default value explicitly in your ejbCreate implementation.
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2850
    
  11

Oh, right. I forgot to mention that we are using WebLogic, but we're back a rev. on 8.1. It's in the documentation? Where? I did look for it, but so far without success.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DB default values with CMPs