Quantcast

OpenJPA 2.1.1 and read entitys being marked as dirty

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

OpenJPA 2.1.1 and read entitys being marked as dirty

Michael Baylis
Hi Folks,
         I am experiencing an oddity that I can't google my way out of.

I am running OpenJPA 2.1.1 under Tomcat 7.0.23 by using my own
EntityManager object that I create when the application starts.

What I am noticing is when I update a field in an entity and then commit
the transaction,  all entities that I have read so far appear to be
dirty and is updated in the backend database, even though I have not
updated them.

I have performed further testing by amending a query to be surrounded by
a begin() and commit() and the commit causes the db records to be
updated even though I know that no updates have taken place.

I am obviously missing something in the setup that causes this, but I am
at a loss to what.

If I run a similar query outside of a Tomcat servlet, ie in native Java,
I don't seem to encounter this problem.

Any help in diagnosing this would be appreciated.

Cheers,

Michael
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: OpenJPA 2.1.1 and read entitys being marked as dirty

Rick Curtis
Michael -

How are you enhancing your Entities?

> I have performed further testing by amending a query to be surrounded by
a begin() and commit() and the commit causes the db records to be updated
even though I know that no updates have taken place.
What fields are being updated? All of them? Are you running with SQL trace
enabled?

On Tue, Jan 17, 2012 at 9:12 AM, Michael Baylis
<[hidden email]>wrote:

> Hi Folks,
>        I am experiencing an oddity that I can't google my way out of.
>
> I am running OpenJPA 2.1.1 under Tomcat 7.0.23 by using my own
> EntityManager object that I create when the application starts.
>
> What I am noticing is when I update a field in an entity and then commit
> the transaction,  all entities that I have read so far appear to be dirty
> and is updated in the backend database, even though I have not updated them.
>
> I have performed further testing by amending a query to be surrounded by a
> begin() and commit() and the commit causes the db records to be updated
> even though I know that no updates have taken place.
>
> I am obviously missing something in the setup that causes this, but I am
> at a loss to what.
>
> If I run a similar query outside of a Tomcat servlet, ie in native Java, I
> don't seem to encounter this problem.
>
> Any help in diagnosing this would be appreciated.
>
> Cheers,
>
> Michael
>



--
*Rick Curtis*
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: OpenJPA 2.1.1 and read entitys being marked as dirty

Michael Baylis
Rick,
       As I am developing I am relying on runtime enhancement,  however
I have to have
<property name="openjpa.RuntimeUnenhancedClasses" value="supported"/>

set.

Cheers,

Michael


On 01/17/2012 03:20 PM, Rick Curtis wrote:

> Michael -
>
> How are you enhancing your Entities?
>
>> I have performed further testing by amending a query to be surrounded by
> a begin() and commit() and the commit causes the db records to be updated
> even though I know that no updates have taken place.
> What fields are being updated? All of them? Are you running with SQL trace
> enabled?
>
> On Tue, Jan 17, 2012 at 9:12 AM, Michael Baylis
> <[hidden email]>wrote:
>
>> Hi Folks,
>>         I am experiencing an oddity that I can't google my way out of.
>>
>> I am running OpenJPA 2.1.1 under Tomcat 7.0.23 by using my own
>> EntityManager object that I create when the application starts.
>>
>> What I am noticing is when I update a field in an entity and then commit
>> the transaction,  all entities that I have read so far appear to be dirty
>> and is updated in the backend database, even though I have not updated them.
>>
>> I have performed further testing by amending a query to be surrounded by a
>> begin() and commit() and the commit causes the db records to be updated
>> even though I know that no updates have taken place.
>>
>> I am obviously missing something in the setup that causes this, but I am
>> at a loss to what.
>>
>> If I run a similar query outside of a Tomcat servlet, ie in native Java, I
>> don't seem to encounter this problem.
>>
>> Any help in diagnosing this would be appreciated.
>>
>> Cheers,
>>
>> Michael
>>
>
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: OpenJPA 2.1.1 and read entitys being marked as dirty

Rick Curtis
Michael -

I'm nearly certain that is your problem. I'd recommend getting build time
enhancement[1] working.

[1] http://openjpa.apache.org/entity-enhancement.html

Thanks,
Rick

On Tue, Jan 17, 2012 at 9:22 AM, Michael Baylis
<[hidden email]>wrote:

> Rick,
>      As I am developing I am relying on runtime enhancement,  however I
> have to have
> <property name="openjpa.**RuntimeUnenhancedClasses" value="supported"/>
>
> set.
>
> Cheers,
>
> Michael
>
>
>
> On 01/17/2012 03:20 PM, Rick Curtis wrote:
>
>> Michael -
>>
>> How are you enhancing your Entities?
>>
>>  I have performed further testing by amending a query to be surrounded by
>>>
>> a begin() and commit() and the commit causes the db records to be updated
>> even though I know that no updates have taken place.
>> What fields are being updated? All of them? Are you running with SQL trace
>> enabled?
>>
>> On Tue, Jan 17, 2012 at 9:12 AM, Michael Baylis
>> <[hidden email]>**wrote:
>>
>>  Hi Folks,
>>>        I am experiencing an oddity that I can't google my way out of.
>>>
>>> I am running OpenJPA 2.1.1 under Tomcat 7.0.23 by using my own
>>> EntityManager object that I create when the application starts.
>>>
>>> What I am noticing is when I update a field in an entity and then commit
>>> the transaction,  all entities that I have read so far appear to be dirty
>>> and is updated in the backend database, even though I have not updated
>>> them.
>>>
>>> I have performed further testing by amending a query to be surrounded by
>>> a
>>> begin() and commit() and the commit causes the db records to be updated
>>> even though I know that no updates have taken place.
>>>
>>> I am obviously missing something in the setup that causes this, but I am
>>> at a loss to what.
>>>
>>> If I run a similar query outside of a Tomcat servlet, ie in native Java,
>>> I
>>> don't seem to encounter this problem.
>>>
>>> Any help in diagnosing this would be appreciated.
>>>
>>> Cheers,
>>>
>>> Michael
>>>
>>>
>>
>>
>


--
*Rick Curtis*
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: OpenJPA 2.1.1 and read entitys being marked as dirty

Michael Baylis
Rick,
       Ok,  I'll switch over,  using Eclipse so shouldn't be difficult.

Cheers,

Michael

On 01/17/2012 03:29 PM, Rick Curtis wrote:

> Michael -
>
> I'm nearly certain that is your problem. I'd recommend getting build time
> enhancement[1] working.
>
> [1] http://openjpa.apache.org/entity-enhancement.html
>
> Thanks,
> Rick
>
> On Tue, Jan 17, 2012 at 9:22 AM, Michael Baylis
> <[hidden email]>wrote:
>
>> Rick,
>>       As I am developing I am relying on runtime enhancement,  however I
>> have to have
>> <property name="openjpa.**RuntimeUnenhancedClasses" value="supported"/>
>>
>> set.
>>
>> Cheers,
>>
>> Michael
>>
>>
>>
>> On 01/17/2012 03:20 PM, Rick Curtis wrote:
>>
>>> Michael -
>>>
>>> How are you enhancing your Entities?
>>>
>>>   I have performed further testing by amending a query to be surrounded by
>>> a begin() and commit() and the commit causes the db records to be updated
>>> even though I know that no updates have taken place.
>>> What fields are being updated? All of them? Are you running with SQL trace
>>> enabled?
>>>
>>> On Tue, Jan 17, 2012 at 9:12 AM, Michael Baylis
>>> <[hidden email]>**wrote:
>>>
>>>   Hi Folks,
>>>>         I am experiencing an oddity that I can't google my way out of.
>>>>
>>>> I am running OpenJPA 2.1.1 under Tomcat 7.0.23 by using my own
>>>> EntityManager object that I create when the application starts.
>>>>
>>>> What I am noticing is when I update a field in an entity and then commit
>>>> the transaction,  all entities that I have read so far appear to be dirty
>>>> and is updated in the backend database, even though I have not updated
>>>> them.
>>>>
>>>> I have performed further testing by amending a query to be surrounded by
>>>> a
>>>> begin() and commit() and the commit causes the db records to be updated
>>>> even though I know that no updates have taken place.
>>>>
>>>> I am obviously missing something in the setup that causes this, but I am
>>>> at a loss to what.
>>>>
>>>> If I run a similar query outside of a Tomcat servlet, ie in native Java,
>>>> I
>>>> don't seem to encounter this problem.
>>>>
>>>> Any help in diagnosing this would be appreciated.
>>>>
>>>> Cheers,
>>>>
>>>> Michael
>>>>
>>>>
>>>
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: OpenJPA 2.1.1 and read entitys being marked as dirty

Michael Baylis
In reply to this post by Rick Curtis
Ok,  switched to buildtime enhancement and getting different problems
now!!  Switched to working with a basic java project to resolve all the
problems.....

When attempting to use :-

Account account = em.find(Account.class, "JL");

I get:-
Exception in thread "main" <openjpa-2.1.1-r422266:1148538 nonfatal store
error> org.apache.openjpa.persistence.EntityNotFoundException: Cannot
perform find using null object id.
FailedObject: null [java.lang.String]
     at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:920)
     at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:902)
     at
org.apache.openjpa.kernel.DelegatingBroker.find(DelegatingBroker.java:231)
     at
org.apache.openjpa.persistence.EntityManagerImpl.find(EntityManagerImpl.java:486)

I have googled and found references by no solutions,  tried to step into
the code bt I get lost along the way!!  The key is a simple string and
does exist in the DB.

I do, however, notice this message:-

12263 [main] INFO  openjpa.Runtime  - The Entity
"uk.me.baylishome.homeaccounts.jpa.Account" was enhanced at level "2",
but the current level of enhancement is "1,055,128".

which doesn't sound right.  Only OpenJPA 2.1.1 is on the classpath, and
build path, so I don't understand the version match,  any ideas?

Getting very frustrated with this  :-(

Cheers,

Michael





On 01/17/2012 03:29 PM, Rick Curtis wrote:

> Michael -
>
> I'm nearly certain that is your problem. I'd recommend getting build time
> enhancement[1] working.
>
> [1] http://openjpa.apache.org/entity-enhancement.html
>
> Thanks,
> Rick
>
> On Tue, Jan 17, 2012 at 9:22 AM, Michael Baylis
> <[hidden email]>wrote:
>
>> Rick,
>>       As I am developing I am relying on runtime enhancement,  however I
>> have to have
>> <property name="openjpa.**RuntimeUnenhancedClasses" value="supported"/>
>>
>> set.
>>
>> Cheers,
>>
>> Michael
>>
>>
>>
>> On 01/17/2012 03:20 PM, Rick Curtis wrote:
>>
>>> Michael -
>>>
>>> How are you enhancing your Entities?
>>>
>>>   I have performed further testing by amending a query to be surrounded by
>>> a begin() and commit() and the commit causes the db records to be updated
>>> even though I know that no updates have taken place.
>>> What fields are being updated? All of them? Are you running with SQL trace
>>> enabled?
>>>
>>> On Tue, Jan 17, 2012 at 9:12 AM, Michael Baylis
>>> <[hidden email]>**wrote:
>>>
>>>   Hi Folks,
>>>>         I am experiencing an oddity that I can't google my way out of.
>>>>
>>>> I am running OpenJPA 2.1.1 under Tomcat 7.0.23 by using my own
>>>> EntityManager object that I create when the application starts.
>>>>
>>>> What I am noticing is when I update a field in an entity and then commit
>>>> the transaction,  all entities that I have read so far appear to be dirty
>>>> and is updated in the backend database, even though I have not updated
>>>> them.
>>>>
>>>> I have performed further testing by amending a query to be surrounded by
>>>> a
>>>> begin() and commit() and the commit causes the db records to be updated
>>>> even though I know that no updates have taken place.
>>>>
>>>> I am obviously missing something in the setup that causes this, but I am
>>>> at a loss to what.
>>>>
>>>> If I run a similar query outside of a Tomcat servlet, ie in native Java,
>>>> I
>>>> don't seem to encounter this problem.
>>>>
>>>> Any help in diagnosing this would be appreciated.
>>>>
>>>> Cheers,
>>>>
>>>> Michael
>>>>
>>>>
>>>
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: OpenJPA 2.1.1 and read entitys being marked as dirty

Pinaki Poddar
shows that Account.class had been enhanced before (possibly with a different version of openjpa library).
Simply delete the Account.class file, recompile Account.java and run org.apache.openjpa.enhance.PCEnhancer on it.
Pinaki Poddar
Chair, Apache OpenJPA Project
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: OpenJPA 2.1.1 and read entitys being marked as dirty

Michael Baylis
In reply to this post by Michael Baylis
Thanks guys,  all working now.   Build time enhancement resolves the
entity dirty problems.

The message:-

12263 [main] INFO  openjpa.Runtime  - The Entity
"uk.me.baylishome.homeaccounts.jpa.Account" was enhanced at level "2",
but the current level of enhancement is "1,055,128".

was caused by downlevel enhancement,  which I would have resolved
myself, however I feel the message is backwards.  It should have said
Account is enhanced at 1,055,128.

Cheers,

Michael


On 01/17/2012 07:03 PM, Michael Baylis wrote:

> Ok,  switched to buildtime enhancement and getting different problems
> now!!  Switched to working with a basic java project to resolve all
> the problems.....
>
> When attempting to use :-
>
> Account account = em.find(Account.class, "JL");
>
> I get:-
> Exception in thread "main" <openjpa-2.1.1-r422266:1148538 nonfatal
> store error> org.apache.openjpa.persistence.EntityNotFoundException:
> Cannot perform find using null object id.
> FailedObject: null [java.lang.String]
>     at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:920)
>     at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:902)
>     at
> org.apache.openjpa.kernel.DelegatingBroker.find(DelegatingBroker.java:231)
>     at
> org.apache.openjpa.persistence.EntityManagerImpl.find(EntityManagerImpl.java:486)
>
> I have googled and found references by no solutions,  tried to step
> into the code bt I get lost along the way!!  The key is a simple
> string and does exist in the DB.
>
> I do, however, notice this message:-
>
> 12263 [main] INFO  openjpa.Runtime  - The Entity
> "uk.me.baylishome.homeaccounts.jpa.Account" was enhanced at level "2",
> but the current level of enhancement is "1,055,128".
>
> which doesn't sound right.  Only OpenJPA 2.1.1 is on the classpath,
> and build path, so I don't understand the version match,  any ideas?
>
> Getting very frustrated with this  :-(
>
> Cheers,
>
> Michael
>
>
>
>
>
> On 01/17/2012 03:29 PM, Rick Curtis wrote:
>> Michael -
>>
>> I'm nearly certain that is your problem. I'd recommend getting build
>> time
>> enhancement[1] working.
>>
>> [1] http://openjpa.apache.org/entity-enhancement.html
>>
>> Thanks,
>> Rick
>>
>> On Tue, Jan 17, 2012 at 9:22 AM, Michael Baylis
>> <[hidden email]>wrote:
>>
>>> Rick,
>>>       As I am developing I am relying on runtime enhancement,  
>>> however I
>>> have to have
>>> <property name="openjpa.**RuntimeUnenhancedClasses" value="supported"/>
>>>
>>> set.
>>>
>>> Cheers,
>>>
>>> Michael
>>>
>>>
>>>
>>> On 01/17/2012 03:20 PM, Rick Curtis wrote:
>>>
>>>> Michael -
>>>>
>>>> How are you enhancing your Entities?
>>>>
>>>>   I have performed further testing by amending a query to be
>>>> surrounded by
>>>> a begin() and commit() and the commit causes the db records to be
>>>> updated
>>>> even though I know that no updates have taken place.
>>>> What fields are being updated? All of them? Are you running with
>>>> SQL trace
>>>> enabled?
>>>>
>>>> On Tue, Jan 17, 2012 at 9:12 AM, Michael Baylis
>>>> <[hidden email]>**wrote:
>>>>
>>>>   Hi Folks,
>>>>>         I am experiencing an oddity that I can't google my way out
>>>>> of.
>>>>>
>>>>> I am running OpenJPA 2.1.1 under Tomcat 7.0.23 by using my own
>>>>> EntityManager object that I create when the application starts.
>>>>>
>>>>> What I am noticing is when I update a field in an entity and then
>>>>> commit
>>>>> the transaction,  all entities that I have read so far appear to
>>>>> be dirty
>>>>> and is updated in the backend database, even though I have not
>>>>> updated
>>>>> them.
>>>>>
>>>>> I have performed further testing by amending a query to be
>>>>> surrounded by
>>>>> a
>>>>> begin() and commit() and the commit causes the db records to be
>>>>> updated
>>>>> even though I know that no updates have taken place.
>>>>>
>>>>> I am obviously missing something in the setup that causes this,
>>>>> but I am
>>>>> at a loss to what.
>>>>>
>>>>> If I run a similar query outside of a Tomcat servlet, ie in native
>>>>> Java,
>>>>> I
>>>>> don't seem to encounter this problem.
>>>>>
>>>>> Any help in diagnosing this would be appreciated.
>>>>>
>>>>> Cheers,
>>>>>
>>>>> Michael
>>>>>
>>>>>
>>>>
>>
>

Loading...