| To: | Cinjug <users@xxxxxxxxxx> |
|---|---|
| Subject: | BMP Entity will not insert a null value into db field that allows nulls. |
| From: | John Olmstead <jolmstead2k@xxxxxxxxx> |
| Date: | Mon, 3 May 2004 13:28:00 -0700 (PDT) |
| Delivered-to: | mailing list users@cinjug.org |
| Mailing-list: | contact users-help@cinjug.org; run by ezmlm |
|
Ladies and Gentlemen,
I have a BMP Entity Bean wrapped by a session bean that upon creation, inserts a record into the db. When inserting non null values for an int (Java Integer) into the field the insert is successfull. However, when inserting nulls for both the int field and the char field, an exception is thrown (included below). Inserting an int value and a null into the char field is successfull. It is only the int field that has a problem with the null value insert. I am using java.lang.Integer to represent this field.
The jdbc code to do this insert uses the setNull method of PreparedStatement class to do the insert. This code, when modified to change the connection source, does do the insert sucessfully from a stand alone client.
The local home and component interfaces for this entity bean are:
public interface TimeAccountHomeLocal extends EJBLocalHome
{ public TimeAccountLocal create(int employeeNum, Integer serverNum,
String instance, String date, int mworked, int clientDescNum) throws CreateException; public TimeAccountLocal findByPrimaryKey(Integer primaryKey) throws FinderException;
}
public interface TimeAccountLocal extends EJBLocalObject
{ public int getEmployeeNum() ; public Integer getServerNum() ; public String getInstanceName() ; public String getDate() ; public int getMinutesWorked() ; public int getClientDescNum() ; public void setEmployeeNum(int employeeNum);
public void setServerNum(Integer serverNum); public void setInstanceName(String instance); public void setDate(String date); public void setMinutesWorked(int minutesWorked); public void setClientDescNum(int descNum); } Any assistance is appreciated.
The exception stack trace follows.
Thanks;
John Olmstead
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: java.rmi.RemoteException: nested exception is: javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean; nested exception is: javax.ejb.EJBException: nested exception is: java.sql.SQLException: [DBSQL01]Line 1: Incorrect syntax near ','.; nested exception is: javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean; nested exception is: javax.ejb.EJBException: nested exception is: java.sql.SQLException: [DBSQL01]Line 1: Incorrect syntax near ','. at com.sun.corba.ee.internal.iiop.ShutdownUtilDelegate.mapSystemException(ShutdownUtilDelegate.java:64) at javax.rmi.CORBA.Util.mapSystemException(Util.java:65) at dbadirect.administration.timekeeping.session._TimeAccountManage_Stub.insertTimeAccount(Unknown Source) at ejbClient.TimeAccountClient.insertBeanRecord(TimeAccountClient.java:113) at ejbClient.TimeAccountClient.main(TimeAccountClient.java:44) Caused by: java.rmi.RemoteException: nested exception is: javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean; nested exception is: javax.ejb.EJBException: nested exception is: java.sql.SQLException: [DBSQL01]Line 1: Incorrect syntax near ','.; nested exception is: javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean; nested exception is: javax.ejb.EJBException: nested exception is: java.sql.SQLException: [DBSQL01]Line 1: Incorrect syntax near ','. at com.sun.enterprise.iiop.POAProtocolMgr.mapException(POAProtocolMgr.java:389) at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:431) at dbadirect.administration.timekeeping.session.TimeAccountManageBean_EJBObjectImpl.insertTimeAccount(TimeAccountManageBean_EJBObjectImpl.java:44) at dbadirect.administration.timekeeping.session._TimeAccountManageBean_EJBObjectImpl_Tie._invoke(Unknown Source) at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatchToServant(GenericPOAServerSC.java:520) at com.sun.corba.ee.internal.POA.GenericPOAServerSC.internalDispatch(GenericPOAServerSC.java:210) at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatch(GenericPOAServerSC.java:112) at com.sun.corba.ee.internal.iiop.ORB.process(ORB.java:255) at com.sun.corba.ee.internal.iiop.RequestProcessor.process(RequestProcessor.java:84) at com.sun.corba.ee.internal.orbutil.ThreadPool$PooledThread.run(ThreadPool.java:99) Caused by: javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean; nested exception is: javax.ejb.EJBException: nested exception is: java.sql.SQLException: [DBSQL01]Line 1: Incorrect syntax near ','. at com.sun.ejb.containers.BaseContainer.checkExceptionClientTx(BaseContainer.java:1434) at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:1294) at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:403) at dbadirect.administration.timekeeping.entity.TimeAccountBean_LocalHomeImpl.create(TimeAccountBean_LocalHomeImpl.java:40) at dbadirect.administration.timekeeping.session.TimeAccountManageBean.insertTimeAccount(TimeAccountManageBean.java:46) at dbadirect.administration.timekeeping.session.TimeAccountManageBean_EJBObjectImpl.insertTimeAccount(TimeAccountManageBean_EJBObjectImpl.java:40) John Olmstead jolmstead2k@xxxxxxxxx
Do you Yahoo!? Win a $20,000 Career Makeover at Yahoo! HotJobs |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | RE: [cinjug-users] odd db2 insert behavior, Robert Casto |
|---|---|
| Next by Date: | Sorry - Wrong Stack Trace, John Olmstead |
| Previous by Thread: | odd db2 insert behavior, Jason Kretzer/STAR BASE Consulting Inc. |
| Next by Thread: | Sorry - Wrong Stack Trace, John Olmstead |
| Indexes: | [Date] [Thread] [Top] [All Lists] |