General J2EE: insert in nullable number field through CMP
I am using oracle with weblogic 6.1. I have one field viz. id (NUMBER datatype)in one of my database tables and that filed allows null value in it. Records in this table are being insterted through CMP 1.1 entity bean. My requirement is to have null values in this field for some of the records. Although I am calling create() method without any value for this field, 0 is insterted in database table.
- Posted by: Gopal Sharma
- Posted on: September 15 2003 09:00 EDT
Try this: make your CMP field type a primitive object wrapper instead of a primitive (Integer instead of int). Then set this value to null when you want a null value in the database.
Thanx Mr. Paul
It got resolved.