求救:rowsAffected=0

03-12-12 licy

我创建了一个一个Entity实体,然后修改数据,出现了0 rows affected的错误,好多天前我已经解决了这个问题,最近几天心情太乱想不起来了,请大家帮忙一下:)

出错信息如下:

2003-12-12 17:51:40,604 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.PensionRetireapply] [PensionRetireapply.ejbCreate] Executing SQL: INSERT INTO PENSION_RETIREAPPLY (SERVICEID, PID, CID, RETIRETYPE, RETIRETIME, DELIVERYTYPE, OPERATOR, OPERATEDATE, OPERATETIME, AUDITOR, AUDITDATE, APPROVER, APPROVEDATE, STATUS, DISCARDTAG, REJECTREASON, NOTE, CHANGE_DATE, SITE, REMOVE_DATE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)

2003-12-12 17:51:40,624 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.PensionRetireapply] Rows affected = 1

2003-12-12 17:51:40,644 INFO [STDOUT] ##################--==>436547:12345`

2003-12-12 17:51:40,644 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand.PensionRetireapply] Executing SQL: UPDATE PENSION_RETIREAPPLY SET CID=?, RETIRETYPE=?, RETIRETIME=?, DELIVERYTYPE=?, OPERATOR=?, OPERATEDATE=?, OPERATETIME=?, AUDITOR=?, AUDITDATE=?, APPROVER=?, APPROVEDATE=?, STATUS=?, DISCARDTAG=?, REJECTREASON=?, NOTE=?, CHANGE_DATE=?, SITE=?, REMOVE_DATE=? WHERE SERVICEID=? AND PID=?

2003-12-12 17:51:40,684 ERROR [org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackException, causedBy:

javax.ejb.EJBException: Update failed. Expected one affected row: rowsAffected=0id=...

banq
2003-12-15 09:41

可能是主键为空。

licy
2003-12-16 15:14

已经解决了,是char类型数据的问题,如果主键数据长度不够,插入数据后,数据更改不成功