我收到错误: javax.transaction.TransactionalException:提交事务注释和TQUType为REQUIRED的托管bean在提交期间遇到异常javax.transaction.RollbackException:标记为回滚的事务。
@Transactional
public int registerAccountinDB(Accounts acc)
{
boolean ok;
try{
em.persist(acc);
ok = true;
}
catch(Exception e)
{
ok = false;
e.printStackTrace();
return 0;
}
return 1;
}
@Transactional
public int registerAdresseinDB(Adresse adr)
{
boolean ok;
try{
em.persist(adr);
ok = true;
}
catch(Exception e)
{
ok = false;
e.printStackTrace();
return 0;
}
return 1;
}