Bugs item #791946, was opened at 2003-08-20 09:39
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=791946&group_id=22866

Category: JBossServer
Group: v3.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Jerrold E Eads (jeeads)
Assigned to: Nobody/Anonymous (nobody)
Summary: Optimistic Locking Problem with v.3.2.1

Initial Comment:
All updates fail if any locked field has been intialized with 
null as its value.

Windows XP client
Windows 2000 Server
MicroSoft SQL Server 2000
JBoss 3.2.1
JAVA j2sdk1.4.1_01

Server error log:
2003-08-19 10:57:13,366 DEBUG 
[org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand
.Project] Executing SQL: UPDATE Project SET Priority=?, 
Status=?, AssignedTo=? WHERE ID=? AND Priority=? AND 
Status=? AND AssignedTo=?
2003-08-19 10:57:13,382 DEBUG 
[com.genecodes.dfa.project.project.ProjectBean] 
ejbPassivate
2003-08-19 10:57:13,382 DEBUG 
[com.genecodes.dfa.project.folder.FolderBean] 
ejbPassivate
2003-08-19 10:57:13,382 ERROR 
[org.jboss.ejb.plugins.LogInterceptor] 
TransactionRolledbackException, causedBy:
javax.ejb.EJBException: Update failed. Expected one 
affected row: rowsAffected=0id=Primary key: 731
        at 
org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand.
execute(JDBCStoreEntityCommand.java:165)
        at 
org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.storeEn
tity(JDBCStoreManager.java:649)
        at 
org.jboss.ejb.plugins.CMPPersistenceManager.storeEntity
(CMPPersistenceManager.java:434)
        at 
org.jboss.resource.connectionmanager.CachedConnection
Interceptor.storeEntity
(CachedConnectionInterceptor.java:388)
        at org.jboss.ejb.EntityContainer.storeEntity
(EntityContainer.java:702)
        at 
org.jboss.ejb.GlobalTxEntityMap.synchronizeEntities
(GlobalTxEntityMap.java:163)
        at 
org.jboss.ejb.GlobalTxEntityMap$GlobalTxEntityMapCleanu
p.beforeCompletion(GlobalTxEntityMap.java:227)
        at 
org.jboss.tm.TransactionImpl.doBeforeCompletion
(TransactionImpl.java:1297)
        at org.jboss.tm.TransactionImpl.commit
(TransactionImpl.java:338)
        at 
org.jboss.ejb.plugins.TxInterceptorCMT.endTransaction
(TxInterceptorCMT.java:369)
        at 
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransacti
ons(TxInterceptorCMT.java:253)
        at 
org.jboss.ejb.plugins.TxInterceptorCMT.invoke
(TxInterceptorCMT.java:104)
        at 
org.jboss.ejb.plugins.SecurityInterceptor.invoke
(SecurityInterceptor.java:117)
        at org.jboss.ejb.plugins.LogInterceptor.invoke
(LogInterceptor.java:191)
        at 
org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invok
e(ProxyFactoryFinderInterceptor.java:122)
        at 
org.jboss.ejb.StatelessSessionContainer.internalInvoke
(StatelessSessionContainer.java:322)
        at org.jboss.ejb.Container.invoke
(Container.java:674)
        at 
sun.reflect.GeneratedMethodAccessor86.invoke
(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke
(Method.java:324)
        at 
org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke
(ReflectedMBeanDispatcher.java:284)
        at org.jboss.mx.server.MBeanServerImpl.invoke
(MBeanServerImpl.java:549)
        at 
org.jboss.invocation.jrmp.server.JRMPInvoker.invoke
(JRMPInvoker.java:359)
        at 
sun.reflect.GeneratedMethodAccessor85.invoke
(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke
(Method.java:324)
        at sun.rmi.server.UnicastServerRef.dispatch
(UnicastServerRef.java:261)
        at sun.rmi.transport.Transport$1.run
(Transport.java:148)
        at java.security.AccessController.doPrivileged
(Native Method)
        at sun.rmi.transport.Transport.serviceCall
(Transport.java:144)
        at 
sun.rmi.transport.tcp.TCPTransport.handleMessages
(TCPTransport.java:460)
        at 
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.ru
n(TCPTransport.java:701)
        at java.lang.Thread.run(Thread.java:536)


When using SQL Server with JBoss 3.2.1 the following 
problem occurs.
When updating an optimistically locked field that has an 
initial value of null the update fails.
 
Code related:
JDBCStoreCommand.java  line 00108
sql.append(" WHERE").append(SQLUtil.getWhereClause
(whereFields));
 
The where fields are the primary key field and the 
optimistically  locked fields.
 
String jdbc::SQLUtil::getWhereClause(List fields) [inline 
static]
Returns columnName0=? [AND columnName1=? [AND 
columnName2=? [....]]]
 
In SQL Server 2000 if a field is null the syntax has to be
columnName0 is ?  where ? is null
 
The columnName=? syntax fails the update.
 
The call on line 00108 should not be completed until the 
values for the lockedFields are 
known.  This could be done in the for loop between lines 
00142 and 00147.  After getting 
the values a call to SQLUtil.getWhereClause
(JDBCFieldBridge field) or
SQLUtil.getIsNullClause(boolean not, JDBCFieldBridge 
field, String identifier) could be
appended to make the SQL statement correct.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=791946&group_id=22866


-------------------------------------------------------
This SF.net email is sponsored by Dice.com.
Did you know that Dice has over 25,000 tech jobs available today? From
careers in IT to Engineering to Tech Sales, Dice has tech jobs from the
best hiring companies. http://www.dice.com/index.epl?rel_code=104
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to