if (!accountExists(user))
{
throw new UnknownEntityException("The account '" +
user.getName() + "' does not exist");
}
Criteria crit = new Criteria();
if (!((Persistent) user).isNew())
{
crit.add(TurbineUserPeer.USER_ID, ((Persistent) user).getPrimaryKey());
}
Hashtable permStorage = (Hashtable) user.getPermStorage().clone();
crit.add(TurbineUserPeer.LAST_LOGIN, permStorage.remove(TurbineUserPeer.LAST_LOGIN));
// The OBJECT_DATA column only stores data not mapped to a column. We must
// remove all of the extra data and serialize the rest. Access Counter
// is not mapped to a column so it will be serialized into OBJECT_DATA.
for (int i = 1; i < TurbineUserPeer.columnNames.length; i++)
{
if (permStorage.containsKey(TurbineUserPeer.columnNames[i]))
{
permStorage.remove(TurbineUserPeer.columnNames[i]);
}
}
crit.add(TurbineUserPeer.OBJECT_DATA, permStorage);
try
{
TurbineUserPeer.doUpdate(crit);
}