Unable to insert data into a NOT NULL field
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Theresa_Betts
Posted On:   Friday, September 28, 2001 10:44 AM

I am using Websphere 3.5 and oracle. I am using VisualAge to create EJBs I have a table with 3 fields, all 3 fields are NOT NULL, 2 of the fields are the primary key. I have checked to make sure I have data to populate all of the fields. When I try to insert data using the entity bean, I get the following exception: record.RemoteException occurred in server thread; nested exception is: com.ibm.ejs.persistence.EJSPersistenceException: java.sql.SQLException: ORA-01400: cannot insert NULL into ("CAS"."REMARKS"."REMARK") ; nested exception is: java.sql.SQLException: ORA-01400: cannot insert NULL into ("CAS"."REMARKS"."REMARK") java.rmi.ServerException: Remote   More>>

I am using Websphere 3.5 and oracle. I am using VisualAge to create EJBs


I have a table with 3 fields, all 3 fields are NOT NULL, 2 of the fields are the primary key. I have checked to make sure I have data to populate all of the fields. When I try to insert data using the entity bean, I get the following exception:


record.RemoteException occurred in server thread; nested exception is: com.ibm.ejs.persistence.EJSPersistenceException: java.sql.SQLException: ORA-01400: cannot insert NULL into ("CAS"."REMARKS"."REMARK") ; nested exception is: java.sql.SQLException: ORA-01400: cannot insert NULL into ("CAS"."REMARKS"."REMARK")
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: com.ibm.ejs.persistence.EJSPersistenceException: java.sql.SQLException: ORA-01400: cannot insert NULL into ("CAS"."REMARKS"."REMARK") ; nested exception is: java.sql.SQLException: ORA-01400: cannot insert NULL into ("CAS"."REMARKS"."REMARK") com.ibm.ejs.persistence.EJSPersistenceException: java.sql.SQLException: ORA-01400: cannot insert NULL into ("CAS"."REMARKS"."REMARK") ; nested exception is: java.sql.SQLException: ORA-01400: cannot insert NULL into ("CAS"."REMARKS"."REMARK") java.sql.SQLException: ORA-01400: cannot insert NULL into ("CAS"."REMARKS"."REMARK")


If the REMARK field in the database allows NULL, the data inserts with no problems.


Can anyone please tell me if they have seen this problem and how to fix it?

   <<Less

Re: Unable to insert data into a NOT NULL field

Posted By:   Shai_Almog  
Posted On:   Saturday, September 29, 2001 05:41 AM

You need to modify the create method for the Entity bean to initialize ALL the not null fields.



VAJ defaults to initializing the primary key but it doesn't initialize the NOT NULL fields, this won't work because any invocation of create() immediately causes insert. Take a look (or debug) the deployed code generated by VAJ to see what I mean.

Re: Unable to insert data into a NOT NULL field

Posted By:   Shanks75_shanks75  
Posted On:   Friday, September 28, 2001 10:47 AM

When you create a schema in visual age
to make sure it has the NOT NULL check box checked.

Also you can put a break point in the acutal method that sets the values ( if you are updating) or in the ejb create method in the bean implementation class to find out what value u are passing.

Shanks
About | Sitemap | Contact