A user had reported this to us, forwarding it over on their behalf. Do with it as you will :)
Here's the thread if you want the full stack trace: http://openejb.979440.n4.nabble.com/Newbie-troubles-attempting-CMP-entity-insert-tp3297911p3300418.html Begin forwarded message: > From: tjsaker <timsa...@gmail.com> > Date: February 10, 2011 2:33:40 PM PST > To: d...@openejb.apache.org > Subject: Re: Newbie troubles attempting CMP entity insert > Reply-To: d...@openejb.apache.org > > [...] > 2) The fact that OpenEjb reports the issue incorrectly. Here is the section > of code in class org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl > that handles the insert: > > protected void flushAndUpdate(RowImpl row) throws SQLException { > // prepare statement > String sql = row.getSQL(_dict); > PreparedStatement stmnt = prepareStatement(sql); > > // setup parameters and execute statement > if (stmnt != null) > row.flush(stmnt, _dict, _store); > try { > int count = executeUpdate(stmnt, sql, row); > if (count != 1) { > Object failed = row.getFailedObject(); > if (failed != null) > _exceptions.add(new OptimisticException(failed)); > else if (row.getAction() == Row.ACTION_INSERT) > . > . > . > > The problem is actually in the constructor OptimisticException(Object), > where it defaults the error message to "opt-lock": > > public OptimisticException(Object failed) { > this(_loc.get("opt-lock", Exceptions.toString(failed))); > setFailedObject(failed); > }