public void updateEvent(EventVO eventVO) throws BOException {
DefaultTransactionDefinition def=new DefaultTransactionDefinition();
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
TransactionStatus status=this.transactionManager.getTransaction(def);
try {
// 查询 返回 OBJECT UPDATE
EventEvents event =
this.eventRepository.findEventByID(Long.parseLong(eventVO.getEventId())
);
event.setEventName(eventVO.getEventName());
event.setArea(eventVO.getArea());
event.setTypeId(Long.parseLong(eventVO.getTypeId()));
event.setLimitNumber(Long.parseLong(eventVO.getLimitNumber()));
event.setJoinType(Long.parseLong(eventVO.getJoinType()));
event.setPoseter(eventVO.getPoseter());
event.setTemplate(eventVO.getTemplate());
this.eventRepository.modifyEvent(event);
transactionManager.commit(status);
} catch (Exception e) {
transactionManager.rollback(status);
throw new BOException(e,this.getClass());
}
}
EventEvents event =
this.eventRepository.findEventByID(Long.parseLong(eventVO.getEventId()));
public EventEvents findEventByID(long eventId) throws DAOException {
return (EventEvents)this.getByID(EventEvents.class, eventId);
}
hibernate update更新对象
最新推荐文章于 2022-07-14 14:16:24 发布