Thanks,
alex
Ken Sipe wrote:
There appears to be an issue a friend discovered with some the logic of generated sql code. Here are his details:
Optimistic Locking problem when using SQL Server 2000 and JBoss 3.2.1
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.
Any help here?
Thanks, Ken
------------------------------------------------------- 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
------------------------------------------------------- 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