0 Replies Latest reply on Mar 28, 2005 10:12 AM by akilsubramanian

    setNull() gives a syntax error and jboss cannot commit. Plea

    akilsubramanian

      Hi

      I am having problems with my SQL if i use setNull method to set the string value to null.In the database,the table allows null for the Texts.

      Here is a part of the code. that is in ejbStore()

      ps2 = con.prepareStatement ("update table1 set L1Text = ?, L2Text = ?, L3Text = ? where ID = ?");

      if(L1Text == null)
      {
      ps2.setNull(1,Types.VARCHAR);

      }
      else
      {
      ps2.setString (1,L1Text);
      }


      etc..,


      This is the error from server.log

      2005-03-25 10:31:11,336 ERROR [org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackException in method: public abstract transcore.sunnav.DMSTextEditorBean.DMSTextEditorRemote transcore.sunnav.DMSTextEditorBean.DMSTextEditorHomeRemote.create(java.lang.String,int,int,int,int,int,int,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) throws java.rmi.RemoteException,javax.ejb.CreateException, causedBy:
      org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=DCZZ8L51/388, BranchQual=, localId=388] status=STATUS_NO_TRANSACTION; - nested throwable: (javax.ejb.EJBException: null; CausedByException is:
      Incorrect syntax near '='.
      )
      at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:344)
      at org.jboss.ejb.plugins.TxInterceptorCMT.endTransaction(TxInterceptorCMT.java:457)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:325)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:129)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:106)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:120)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:93)
      at org.jboss.ejb.EntityContainer.internalInvokeHome(EntityContainer.java:508)
      at org.jboss.ejb.Container.invoke(Container.java:881)
      at sun.reflect.GeneratedMethodAccessor82.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:236)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
      at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:155)
      at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:104)
      at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:90)
      at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
      at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:55)
      at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:169)
      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:86)
      at $Proxy62.create(Unknown Source)
      at com.transcore.sunnav.dmscontrol.DMSTableData.getDMSTableData(DMSTableData.java:280)
      at com.transcore.sunnav.dmscontrol.DMSTableData.initDMSDMSTableData(DMSTableData.java:220)
      at com.transcore.sunnav.dmscontrol.DMSTableData.(DMSTableData.java:141)
      at com.transcore.sunnav.dmscontrol.DMSTableHandler.(DMSTableHandler.java:78)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
      at java.lang.Class.newInstance0(Class.java:308)
      at java.lang.Class.newInstance(Class.java:261)
      at java.beans.Beans.instantiate(Beans.java:204)
      at java.beans.Beans.instantiate(Beans.java:48)
      at com.sun.faces.config.ManagedBeanFactory.newInstance(ManagedBeanFactory.java:135)
      at com.sun.faces.application.ApplicationImpl.createAndMaybeStoreManagedBeans(ApplicationImpl.java:863)
      at com.sun.faces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:79)
      at com.sun.faces.el.impl.NamedValue.evaluate(NamedValue.java:120)
      at com.sun.faces.el.impl.ComplexValue.evaluate(ComplexValue.java:141)
      at com.sun.faces.el.impl.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorImpl.java:238)
      at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:155)
      at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:136)
      at javax.faces.component.UIOutput.getValue(UIOutput.java:147)
      at com.sun.faces.renderkit.html_basic.MenuRenderer.getCurrentSelectedValues(MenuRenderer.java:614)