try
{
TurbinePermission tpermission = new TurbinePermission();
tpermission.setPermissionName(permission.getName());
Criteria criteria = TurbinePermissionPeer.buildCriteria(tpermission);
NumberKey key = (NumberKey)TurbinePermissionPeer.doInsert(criteria);
permission.setId(key.toString());
}
catch(Exception e)
{
String message = "Failed to create permission '" + permission.getName() + "'";
logger.error( message, e );