public Object update(Object entity) {
Session session = null;
try {
session = PersistenceManagerUtils.getSession(this.getPersistenceManager(), true);
PrevaylerCallback callback = new UpdateCallback(entity);
Object saved = session.execute(callback);
if (entity != saved) {
session.execute(new MergeCallback(saved, entity));
}
return saved;