On 2/7/07, Matt Raible <[EMAIL PROTECTED]> wrote:
Forwarding to mailing list as that's where this belongs. I'll answer the
question there.
Matt
---------- Forwarded message ----------
From: Sergi Almar i Graupera <[EMAIL PROTECTED]>
Date: Feb 7, 2007 9:53 AM
Subject: Appfuse Ibatis
To: [EMAIL PROTECTED]
Hi Matt,
I just have a quick question about the Ibatis implementation in Appfuse.
In the class UserDaoiBatis, the following method:
private void addUserRoles(final User user) {
if (user.getRoles () != null) {
for (Iterator it = user.getRoles().iterator(); it.hasNext();)
{
Role role = (Role) it.next();
Map newRole = new HashMap();
newRole.put ("userId", user.getId());
newRole.put("roleId", role.getId());
List userRoles =
getSqlMapClientTemplate().queryForList("getUserRoles", user.getUsername
());
if ( userRoles.isEmpty()) {
getSqlMapClientTemplate().update("addUserRole",
newRole);
}
}
}
}
why does it check all the time whether the user doesn't have roles? This
only allows the first role to be inserted, discarding the others
This could be a bug - I haven't looked at the iBATIS code in a couple years.
;-)
Matt
Thanks for your time.
Best regards,
Sergi Almar
--
http://raibledesigns.com
--
http://raibledesigns.com