openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Blevins <david.blev...@visi.com>
Subject Fwd: Newbie troubles attempting CMP entity insert
Date Thu, 10 Feb 2011 23:37:41 GMT
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 <timsaker@gmail.com>
> Date: February 10, 2011 2:33:40 PM PST
> To: dev@openejb.apache.org
> Subject: Re: Newbie troubles attempting CMP entity insert
> Reply-To: dev@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);
>    }


Mime
View raw message