ssh+dwr 报错 Write operations are not allowed in read-only mode

ssh+dwr,dwr调用的方法如果有对数据库执行insert,update,delete操作时,有可能会报异常:
Write operations are not allowed in read-only mode (FlushMode.NEVER/MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition.


解决如下:
  session.setFlushMode(FlushMode.AUTO);
  session.saveOrUpdate(entity);
  session.flush();

你可能感兴趣的:(DWR,ssh)