Hi Adam,
Thanks again for all your help and suggestions. Just implemented your
OQL suggestion as below and got the same error. It's very odd!
Here are the details of how I did it, the only difference from your
suggestion is that it takes the employee id from the form post still and
uses a lock on the employee.
employeeId = new Integer(request.getParameter("employeeId"));
twOql = db.getOQLQuery("SELECT e from
com.fc.fortunecookie.beans.Employee e WHERE id=$1");
twOql.bind(employeeId);
results = twOql.execute();
if (results.hasMore()) { <-- use an if 'cos there should be only one!
employee = (Employee)results.next();
db.lock(employee); <-- an attempt to use locking to solve the problem
employee.setName(request.getParameter("name"));
//excluded endless mundane employee fields etc below...
}
db.commit(); <-- this line throws the exception
Thanks for all your help again.
Patrick
Adam Esterline wrote:
> Have you tried creating a OQL Query to retrieve the Object?
>
> OQLQuery query = db.getOQLQuery( "SELECT e FROM
> com.fc.fortunecookie.beans.Employee WHERE id = $1" );
>
> query.bind( new Integer( 50 ) );
>
> I don't know if this will help, but just wondering if there is a difference
> between db.load and using the query.
>
> Give this a try and let us know.
>
> Adam
>
> -----Original Message-----
> From: Patrick van Kann [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, September 04, 2001 11:20 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [castor-dev] Possible JDO bug ("ObjectModifiedException")
>
>
> Adam Esterline wrote:
>
>
>>Have you tried the lazy load feature on the relationship fields?
>>
>
> Thanks for the suggestion Adam, I have tried this, as well as different
> transaction levels (db.lock() as well as in the mapping). I still get
> the error, and in addition to this I have discovered it is ONLY employee
> id of 50 which causes the problem.
>
> In any case, it is clearly a bug in JDO as there are no other
> transactions in progress anywhere, either within the Castor app or via
> JDBC/ODBC/etc elsewhere that could be changing this record in mid
> transaction. Therefore, somehow the transaction is interfering with
> itself in some bizarre way.
>
> I would welcome any other hints as to what the nature of the problem is
> and how it can be avoided. I am tempted to manually delete the offending
> record from the database and pray that this never happens again, but
> that wouldn't be a very satisfactory outcome. I would rather help to
> understand what is wrong with JDO!
>
> Patrick
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev
>
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev