You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by Stuart Belden <SB...@bjc.org> on 2003/06/27 19:16:53 UTC

Possible Solution - DB2 and Jetspeed

see http://issues.apache.org/bugzilla/show_bug.cgi?id=11535; I think this bug is still valid and not fixed.  Essentially the  problem is that Torque is wrapping integer table values in ticks (e.g. '3'), causing DB2 to throw fits.

After a lot of digging through Torque, I believe I've found the cause of the integer tick wrapping problem.  JetspeedRole, JetspeedPermission, JetspeedUser, and JetspeedGroup all have their "id" fields defined as Strings as opposed to Integers or ints even though they're defined as integers in the database.  Torque correctly maps the id fields in BaseTurbineWhatever to ints.  

When those id Strings are added to a Criteria obj, Torque assumes they're char/varchar fields and builds the sql statements accordingly.  There are two possible solutions that I see:

1) change all references to Role, User, Permission, and Group ids to ints.  I haven't looked at this, so it's possible this is a bigger change than I envision.

2) Don't pass String ids in TurbineRoleManagement (also Group & Permission mgmt); e.g. change lines like:
criteria.add(TurbineUserGroupRolePeer.USER_ID, user.getUserId());  to
criteria.add(TurbineUserGroupRolePeer.USER_ID, new BigDecimal(user.getUserId()));

The second fix I've tested today, and it looks like it fixes the problem entirely.  However, I feel that the first fix is the better one.  Does someone with more JS experience than me foresee any horrible pitfalls with fix #1?

There are other issues with Torque's DB2 sql generation that I've gotten around by manually editing the sql generation scripts DB2 generates.  I'll post my comments/workarounds to those bugs probably today or early next week. For reference, they are:
http://issues.apache.org/bugzilla/show_bug.cgi?id=20101
http://issues.apache.org/bugzilla/show_bug.cgi?id=20104
http://issues.apache.org/bugzilla/show_bug.cgi?id=20105


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org