You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Bruno René Santos <br...@holos.pt> on 2011/01/24 02:03:51 UTC

Error on BaseContext - object is modified when committed is expected

Hello all,

Im having an error when I access an object:

Caused by: org.apache.cayenne.FaultFailureException: [v.3.0.1 Aug 25 
2010 19:38:17] Error resolving fault for ObjectId: 
<ObjectId:HoVPlanoContas, id=129> and state (modified). Possible cause - 
matching row is missing from the database.
     at 
org.apache.cayenne.BaseContext.prepareForAccess(BaseContext.java:171)
     at 
org.apache.cayenne.CayenneDataObject.readProperty(CayenneDataObject.java:230)

When I go to the line 171 of BaseContext there is this comment from Andrus:

// TODO: andrus 4/13/2006, modified and deleted states are possible due to
                 // a race condition, should we handle them here?

Why this happens? Any solutions?

Thanx
Bruno
-- 
Bruno René Santos | brunorene@holos.pt <ma...@holos.pt> | 
Gestor de Projectos | Analista | Programador | Investigador

Holos - Soluções Avançadas em Tecnologias de Informação S.A.
Parque de Ciência e Tecnologia de Almada/Setúbal . Edifício Madan Parque
Rua dos Inventores . Quinta da Torre . 2825 - 182 Caparica . Portugal
Phone: +351 210 438 686 . Fax: +351 210 438 687 . Web: www.holos.pt


This email and any files transmitted with it are confidential and 
intended solely for the use of the individual or entity to whom they are 
addressed. If you are not the intended recipient or the person 
responsible for delivering the email to the intended recipient, be 
advised that you have received this email in error and that any use, 
dissemination, forwarding, printing, or copying of this email is 
strictly prohibited. If you have received this email in error please 
notify Bruno René Santos by telephone on +351 210 438 686


Re: Error on BaseContext - object is modified when committed is expected

Posted by Bruno René Santos <br...@holos.pt>.
Only good news :). I have a first window on my application where I can 
search for items and then I can change each item on popup window. Do you 
think it will work if I create the write-context when I create the 
popup, copy into it the object, do all sorts of changes and commit 
everything when I close the window? By the way all relationships are 
mantained on the new Context? Or cayenne will try again to lazy-load all 
accessed objects related to the main object on the new context?

Thanx for the help
Bruno

Em 24-01-2011 11:33, Andrus Adamchik escreveu:
> On Jan 24, 2011, at 1:26 PM, Bruno René Santos wrote:
>
>> I'll try to modify the CommitChanges and CommitChangesToParent in order to create a very short lived context to where I copy all modifiedObjects and deletedObjects in order to commit them.
> There should be no modified or deleted objects in the shared context. The object must be copied to your shorty-lived context BEFORE it is modified or deleted.
>
> Andrus
>
>
>


-- 
Bruno René Santos | brunorene@holos.pt <ma...@holos.pt> | 
Gestor de Projectos | Analista | Programador | Investigador

Holos - Soluções Avançadas em Tecnologias de Informação S.A.
Parque de Ciência e Tecnologia de Almada/Setúbal . Edifício Madan Parque
Rua dos Inventores . Quinta da Torre . 2825 - 182 Caparica . Portugal
Phone: +351 210 438 686 . Fax: +351 210 438 687 . Web: www.holos.pt


This email and any files transmitted with it are confidential and 
intended solely for the use of the individual or entity to whom they are 
addressed. If you are not the intended recipient or the person 
responsible for delivering the email to the intended recipient, be 
advised that you have received this email in error and that any use, 
dissemination, forwarding, printing, or copying of this email is 
strictly prohibited. If you have received this email in error please 
notify Bruno René Santos by telephone on +351 210 438 686


Re: Error on BaseContext - object is modified when committed is expected

Posted by Andrus Adamchik <an...@objectstyle.org>.
On Jan 24, 2011, at 1:26 PM, Bruno René Santos wrote:

> I'll try to modify the CommitChanges and CommitChangesToParent in order to create a very short lived context to where I copy all modifiedObjects and deletedObjects in order to commit them.

There should be no modified or deleted objects in the shared context. The object must be copied to your shorty-lived context BEFORE it is modified or deleted.

Andrus


Re: Error on BaseContext - object is modified when committed is expected

Posted by Bruno René Santos <br...@holos.pt>.
Great. I'll try to modify the CommitChanges and CommitChangesToParent in 
order to create a very short lived context to where I copy all 
modifiedObjects and deletedObjects in order to commit them. But what 
about the commit order on the DB? the change graph is followed on the 
new context? The problem here is that I have a team of 10 people 
developing on top of my app and I wanted to minimize the changes on the 
application in order to migrate to different read and write contexts.

Bruno

Em 24-01-2011 11:14, Andrus Adamchik escreveu:
> On Jan 24, 2011, at 1:04 PM, Bruno René Santos wrote:
>
>> So the best way to do this is to keep my shared DataContext for reading and when I need to change something I create a new DataContext, pass the object read to this new context (using for instants an ObjectIdQuery) and commit on this new Context.
> Correct. Or you can use ObjectContext.localObject(object.getObjectId(), null) to get a copy of an object in another context.
>
>> To refresh the read-only Context with the changes I will need to perform a new query?
> Actually Cayenne should refresh it for you after peer context commit.
>
> Andrus
>


-- 
Bruno René Santos | brunorene@holos.pt <ma...@holos.pt> | 
Gestor de Projectos | Analista | Programador | Investigador

Holos - Soluções Avançadas em Tecnologias de Informação S.A.
Parque de Ciência e Tecnologia de Almada/Setúbal . Edifício Madan Parque
Rua dos Inventores . Quinta da Torre . 2825 - 182 Caparica . Portugal
Phone: +351 210 438 686 . Fax: +351 210 438 687 . Web: www.holos.pt


This email and any files transmitted with it are confidential and 
intended solely for the use of the individual or entity to whom they are 
addressed. If you are not the intended recipient or the person 
responsible for delivering the email to the intended recipient, be 
advised that you have received this email in error and that any use, 
dissemination, forwarding, printing, or copying of this email is 
strictly prohibited. If you have received this email in error please 
notify Bruno René Santos by telephone on +351 210 438 686


Re: Error on BaseContext - object is modified when committed is expected

Posted by Andrus Adamchik <an...@objectstyle.org>.
On Jan 24, 2011, at 1:04 PM, Bruno René Santos wrote:

> So the best way to do this is to keep my shared DataContext for reading and when I need to change something I create a new DataContext, pass the object read to this new context (using for instants an ObjectIdQuery) and commit on this new Context.

Correct. Or you can use ObjectContext.localObject(object.getObjectId(), null) to get a copy of an object in another context.

> To refresh the read-only Context with the changes I will need to perform a new query?

Actually Cayenne should refresh it for you after peer context commit.

Andrus

Re: Error on BaseContext - object is modified when committed is expected

Posted by Bruno René Santos <br...@holos.pt>.
So the best way to do this is to keep my shared DataContext for reading 
and when I need to change something I create a new DataContext, pass the 
object read to this new context (using for instants an ObjectIdQuery) 
and commit on this new Context. To refresh the read-only Context with 
the changes I will need to perform a new query?

Thanx
Bruno

Em 24-01-2011 10:45, Andrus Adamchik escreveu:
> This is wrong. You shouldn't be sharing a read/write DataContext between requests. I can't say with 100% certainty that this is causing this particular problem, but it is guaranteed to cause various consistency issues.
>
> I often use a pattern of 1 shared app-scoped DataContext for reads, and then create short-lived throwaway DataContexts to change objects ("short-lived" means a lifespan<= request duration).
>
> Andrus
>
> On Jan 24, 2011, at 12:35 PM, Bruno René Santos wrote:
>> In the init() phase of each portlet (I'm using liferay) I call the DataContext.createDataContext() to create a DataContext that is used throughout the application (always the same instance, I create an object that is passed as parameter to all other objects). And yes my app is not readonly but I also do not try to write on the view... Have you ever thought how we could handle these cases near the comment you left on the code? Could I try like a commitChanges there? Any ideas are welcome :)
>>
>> Thanx
>> Bruno
>>
>> Em 24-01-2011 10:18, Andrus Adamchik escreveu:
>>>>   I am developing a web application so it is possible that some thread is interfering on the refreshing of the Object Cache?
>>> This depends on how you share a DataContext. If your app is not read-only, DataContext should not be shared.
>>>
>>> Andrus
>>>
>>> On Jan 24, 2011, at 12:09 PM, Bruno René Santos wrote:
>>>
>>>> HoVPlanoContas is a view. And yes the id 129 exists. On that piece of code you're expecting a committed object but you're getting a modified one... I am going to analyze a little further why on this region of code this happens (On other parts I dont get this error). But it would help to know the purpose of this PrepareForAccess method and how the object starts as HOLLOW and all of a sudden it is supposed to be committed (but in the end is modified...). I am developing a web application so it is possible that some thread is interfering on the refreshing of the Object Cache? Any other ideas?
>>>>
>>>> Thanx
>>>> Bruno
>>>>
>>>> Em 24-01-2011 09:43, Andrus Adamchik escreveu:
>>>>> Can you confirm that there is a record for HoVPlanoContas in the database with id of 129? Is it reproducible?
>>>>>
>>>>> Andrus
>>>>>
>>>>> On Jan 24, 2011, at 3:03 AM, Bruno René Santos wrote:
>>>>>
>>>>>> Hello all,
>>>>>>
>>>>>> Im having an error when I access an object:
>>>>>>
>>>>>> Caused by: org.apache.cayenne.FaultFailureException: [v.3.0.1 Aug 25 2010 19:38:17] Error resolving fault for ObjectId:<ObjectId:HoVPlanoContas, id=129>    and state (modified). Possible cause - matching row is missing from the database.
>>>>>>     at org.apache.cayenne.BaseContext.prepareForAccess(BaseContext.java:171)
>>>>>>     at org.apache.cayenne.CayenneDataObject.readProperty(CayenneDataObject.java:230)
>>>>>>
>>>>>> When I go to the line 171 of BaseContext there is this comment from Andrus:
>>>>>>
>>>>>> // TODO: andrus 4/13/2006, modified and deleted states are possible due to
>>>>>>                 // a race condition, should we handle them here?
>>>>>>
>>>>>> Why this happens? Any solutions?
>>>>>>
>>>>>> Thanx
>>>>>> Bruno
>>>>>> -- 
>>>>>> Bruno René Santos | brunorene@holos.pt<ma...@holos.pt>    | Gestor de Projectos | Analista | Programador | Investigador
>>>>>>
>>>>>> Holos - Soluções Avançadas em Tecnologias de Informação S.A.
>>>>>> Parque de Ciência e Tecnologia de Almada/Setúbal . Edifício Madan Parque
>>>>>> Rua dos Inventores . Quinta da Torre . 2825 - 182 Caparica . Portugal
>>>>>> Phone: +351 210 438 686 . Fax: +351 210 438 687 . Web: www.holos.pt
>>>>>>
>>>>>>
>>>>>> This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended recipient or the person responsible for delivering the email to the intended recipient, be advised that you have received this email in error and that any use, dissemination, forwarding, printing, or copying of this email is strictly prohibited. If you have received this email in error please notify Bruno René Santos by telephone on +351 210 438 686
>>>>>>
>>>> -- 
>>>> Bruno René Santos | brunorene@holos.pt<ma...@holos.pt>   | Gestor de Projectos | Analista | Programador | Investigador
>>>>
>>>> Holos - Soluções Avançadas em Tecnologias de Informação S.A.
>>>> Parque de Ciência e Tecnologia de Almada/Setúbal . Edifício Madan Parque
>>>> Rua dos Inventores . Quinta da Torre . 2825 - 182 Caparica . Portugal
>>>> Phone: +351 210 438 686 . Fax: +351 210 438 687 . Web: www.holos.pt
>>>>
>>>>
>>>> This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended recipient or the person responsible for delivering the email to the intended recipient, be advised that you have received this email in error and that any use, dissemination, forwarding, printing, or copying of this email is strictly prohibited. If you have received this email in error please notify Bruno René Santos by telephone on +351 210 438 686
>>>>
>>>
>>
>> -- 
>> Bruno René Santos | brunorene@holos.pt<ma...@holos.pt>  | Gestor de Projectos | Analista | Programador | Investigador
>>
>> Holos - Soluções Avançadas em Tecnologias de Informação S.A.
>> Parque de Ciência e Tecnologia de Almada/Setúbal . Edifício Madan Parque
>> Rua dos Inventores . Quinta da Torre . 2825 - 182 Caparica . Portugal
>> Phone: +351 210 438 686 . Fax: +351 210 438 687 . Web: www.holos.pt
>>
>>
>> This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended recipient or the person responsible for delivering the email to the intended recipient, be advised that you have received this email in error and that any use, dissemination, forwarding, printing, or copying of this email is strictly prohibited. If you have received this email in error please notify Bruno René Santos by telephone on +351 210 438 686
>>
>
>


-- 
Bruno René Santos | brunorene@holos.pt <ma...@holos.pt> | 
Gestor de Projectos | Analista | Programador | Investigador

Holos - Soluções Avançadas em Tecnologias de Informação S.A.
Parque de Ciência e Tecnologia de Almada/Setúbal . Edifício Madan Parque
Rua dos Inventores . Quinta da Torre . 2825 - 182 Caparica . Portugal
Phone: +351 210 438 686 . Fax: +351 210 438 687 . Web: www.holos.pt


This email and any files transmitted with it are confidential and 
intended solely for the use of the individual or entity to whom they are 
addressed. If you are not the intended recipient or the person 
responsible for delivering the email to the intended recipient, be 
advised that you have received this email in error and that any use, 
dissemination, forwarding, printing, or copying of this email is 
strictly prohibited. If you have received this email in error please 
notify Bruno René Santos by telephone on +351 210 438 686


Re: Error on BaseContext - object is modified when committed is expected

Posted by Andrus Adamchik <an...@objectstyle.org>.
This is wrong. You shouldn't be sharing a read/write DataContext between requests. I can't say with 100% certainty that this is causing this particular problem, but it is guaranteed to cause various consistency issues.  

I often use a pattern of 1 shared app-scoped DataContext for reads, and then create short-lived throwaway DataContexts to change objects ("short-lived" means a lifespan <= request duration).

Andrus

On Jan 24, 2011, at 12:35 PM, Bruno René Santos wrote:
> In the init() phase of each portlet (I'm using liferay) I call the DataContext.createDataContext() to create a DataContext that is used throughout the application (always the same instance, I create an object that is passed as parameter to all other objects). And yes my app is not readonly but I also do not try to write on the view... Have you ever thought how we could handle these cases near the comment you left on the code? Could I try like a commitChanges there? Any ideas are welcome :)
> 
> Thanx
> Bruno
> 
> Em 24-01-2011 10:18, Andrus Adamchik escreveu:
>>>  I am developing a web application so it is possible that some thread is interfering on the refreshing of the Object Cache?
>> This depends on how you share a DataContext. If your app is not read-only, DataContext should not be shared.
>> 
>> Andrus
>> 
>> On Jan 24, 2011, at 12:09 PM, Bruno René Santos wrote:
>> 
>>> HoVPlanoContas is a view. And yes the id 129 exists. On that piece of code you're expecting a committed object but you're getting a modified one... I am going to analyze a little further why on this region of code this happens (On other parts I dont get this error). But it would help to know the purpose of this PrepareForAccess method and how the object starts as HOLLOW and all of a sudden it is supposed to be committed (but in the end is modified...). I am developing a web application so it is possible that some thread is interfering on the refreshing of the Object Cache? Any other ideas?
>>> 
>>> Thanx
>>> Bruno
>>> 
>>> Em 24-01-2011 09:43, Andrus Adamchik escreveu:
>>>> Can you confirm that there is a record for HoVPlanoContas in the database with id of 129? Is it reproducible?
>>>> 
>>>> Andrus
>>>> 
>>>> On Jan 24, 2011, at 3:03 AM, Bruno René Santos wrote:
>>>> 
>>>>> Hello all,
>>>>> 
>>>>> Im having an error when I access an object:
>>>>> 
>>>>> Caused by: org.apache.cayenne.FaultFailureException: [v.3.0.1 Aug 25 2010 19:38:17] Error resolving fault for ObjectId:<ObjectId:HoVPlanoContas, id=129>   and state (modified). Possible cause - matching row is missing from the database.
>>>>>    at org.apache.cayenne.BaseContext.prepareForAccess(BaseContext.java:171)
>>>>>    at org.apache.cayenne.CayenneDataObject.readProperty(CayenneDataObject.java:230)
>>>>> 
>>>>> When I go to the line 171 of BaseContext there is this comment from Andrus:
>>>>> 
>>>>> // TODO: andrus 4/13/2006, modified and deleted states are possible due to
>>>>>                // a race condition, should we handle them here?
>>>>> 
>>>>> Why this happens? Any solutions?
>>>>> 
>>>>> Thanx
>>>>> Bruno
>>>>> -- 
>>>>> Bruno René Santos | brunorene@holos.pt<ma...@holos.pt>   | Gestor de Projectos | Analista | Programador | Investigador
>>>>> 
>>>>> Holos - Soluções Avançadas em Tecnologias de Informação S.A.
>>>>> Parque de Ciência e Tecnologia de Almada/Setúbal . Edifício Madan Parque
>>>>> Rua dos Inventores . Quinta da Torre . 2825 - 182 Caparica . Portugal
>>>>> Phone: +351 210 438 686 . Fax: +351 210 438 687 . Web: www.holos.pt
>>>>> 
>>>>> 
>>>>> This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended recipient or the person responsible for delivering the email to the intended recipient, be advised that you have received this email in error and that any use, dissemination, forwarding, printing, or copying of this email is strictly prohibited. If you have received this email in error please notify Bruno René Santos by telephone on +351 210 438 686
>>>>> 
>>>> 
>>> 
>>> -- 
>>> Bruno René Santos | brunorene@holos.pt<ma...@holos.pt>  | Gestor de Projectos | Analista | Programador | Investigador
>>> 
>>> Holos - Soluções Avançadas em Tecnologias de Informação S.A.
>>> Parque de Ciência e Tecnologia de Almada/Setúbal . Edifício Madan Parque
>>> Rua dos Inventores . Quinta da Torre . 2825 - 182 Caparica . Portugal
>>> Phone: +351 210 438 686 . Fax: +351 210 438 687 . Web: www.holos.pt
>>> 
>>> 
>>> This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended recipient or the person responsible for delivering the email to the intended recipient, be advised that you have received this email in error and that any use, dissemination, forwarding, printing, or copying of this email is strictly prohibited. If you have received this email in error please notify Bruno René Santos by telephone on +351 210 438 686
>>> 
>> 
>> 
> 
> 
> -- 
> Bruno René Santos | brunorene@holos.pt <ma...@holos.pt> | Gestor de Projectos | Analista | Programador | Investigador
> 
> Holos - Soluções Avançadas em Tecnologias de Informação S.A.
> Parque de Ciência e Tecnologia de Almada/Setúbal . Edifício Madan Parque
> Rua dos Inventores . Quinta da Torre . 2825 - 182 Caparica . Portugal
> Phone: +351 210 438 686 . Fax: +351 210 438 687 . Web: www.holos.pt
> 
> 
> This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended recipient or the person responsible for delivering the email to the intended recipient, be advised that you have received this email in error and that any use, dissemination, forwarding, printing, or copying of this email is strictly prohibited. If you have received this email in error please notify Bruno René Santos by telephone on +351 210 438 686
> 


Re: Error on BaseContext - object is modified when committed is expected

Posted by Bruno René Santos <br...@holos.pt>.
In the init() phase of each portlet (I'm using liferay) I call the 
DataContext.createDataContext() to create a DataContext that is used 
throughout the application (always the same instance, I create an object 
that is passed as parameter to all other objects). And yes my app is not 
readonly but I also do not try to write on the view... Have you ever 
thought how we could handle these cases near the comment you left on the 
code? Could I try like a commitChanges there? Any ideas are welcome :)

Thanx
Bruno

Em 24-01-2011 10:18, Andrus Adamchik escreveu:
>>   I am developing a web application so it is possible that some thread is interfering on the refreshing of the Object Cache?
> This depends on how you share a DataContext. If your app is not read-only, DataContext should not be shared.
>
> Andrus
>
> On Jan 24, 2011, at 12:09 PM, Bruno René Santos wrote:
>
>> HoVPlanoContas is a view. And yes the id 129 exists. On that piece of code you're expecting a committed object but you're getting a modified one... I am going to analyze a little further why on this region of code this happens (On other parts I dont get this error). But it would help to know the purpose of this PrepareForAccess method and how the object starts as HOLLOW and all of a sudden it is supposed to be committed (but in the end is modified...). I am developing a web application so it is possible that some thread is interfering on the refreshing of the Object Cache? Any other ideas?
>>
>> Thanx
>> Bruno
>>
>> Em 24-01-2011 09:43, Andrus Adamchik escreveu:
>>> Can you confirm that there is a record for HoVPlanoContas in the database with id of 129? Is it reproducible?
>>>
>>> Andrus
>>>
>>> On Jan 24, 2011, at 3:03 AM, Bruno René Santos wrote:
>>>
>>>> Hello all,
>>>>
>>>> Im having an error when I access an object:
>>>>
>>>> Caused by: org.apache.cayenne.FaultFailureException: [v.3.0.1 Aug 25 2010 19:38:17] Error resolving fault for ObjectId:<ObjectId:HoVPlanoContas, id=129>   and state (modified). Possible cause - matching row is missing from the database.
>>>>     at org.apache.cayenne.BaseContext.prepareForAccess(BaseContext.java:171)
>>>>     at org.apache.cayenne.CayenneDataObject.readProperty(CayenneDataObject.java:230)
>>>>
>>>> When I go to the line 171 of BaseContext there is this comment from Andrus:
>>>>
>>>> // TODO: andrus 4/13/2006, modified and deleted states are possible due to
>>>>                 // a race condition, should we handle them here?
>>>>
>>>> Why this happens? Any solutions?
>>>>
>>>> Thanx
>>>> Bruno
>>>> -- 
>>>> Bruno René Santos | brunorene@holos.pt<ma...@holos.pt>   | Gestor de Projectos | Analista | Programador | Investigador
>>>>
>>>> Holos - Soluções Avançadas em Tecnologias de Informação S.A.
>>>> Parque de Ciência e Tecnologia de Almada/Setúbal . Edifício Madan Parque
>>>> Rua dos Inventores . Quinta da Torre . 2825 - 182 Caparica . Portugal
>>>> Phone: +351 210 438 686 . Fax: +351 210 438 687 . Web: www.holos.pt
>>>>
>>>>
>>>> This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended recipient or the person responsible for delivering the email to the intended recipient, be advised that you have received this email in error and that any use, dissemination, forwarding, printing, or copying of this email is strictly prohibited. If you have received this email in error please notify Bruno René Santos by telephone on +351 210 438 686
>>>>
>>>
>>
>> -- 
>> Bruno René Santos | brunorene@holos.pt<ma...@holos.pt>  | Gestor de Projectos | Analista | Programador | Investigador
>>
>> Holos - Soluções Avançadas em Tecnologias de Informação S.A.
>> Parque de Ciência e Tecnologia de Almada/Setúbal . Edifício Madan Parque
>> Rua dos Inventores . Quinta da Torre . 2825 - 182 Caparica . Portugal
>> Phone: +351 210 438 686 . Fax: +351 210 438 687 . Web: www.holos.pt
>>
>>
>> This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended recipient or the person responsible for delivering the email to the intended recipient, be advised that you have received this email in error and that any use, dissemination, forwarding, printing, or copying of this email is strictly prohibited. If you have received this email in error please notify Bruno René Santos by telephone on +351 210 438 686
>>
>
>


-- 
Bruno René Santos | brunorene@holos.pt <ma...@holos.pt> | 
Gestor de Projectos | Analista | Programador | Investigador

Holos - Soluções Avançadas em Tecnologias de Informação S.A.
Parque de Ciência e Tecnologia de Almada/Setúbal . Edifício Madan Parque
Rua dos Inventores . Quinta da Torre . 2825 - 182 Caparica . Portugal
Phone: +351 210 438 686 . Fax: +351 210 438 687 . Web: www.holos.pt


This email and any files transmitted with it are confidential and 
intended solely for the use of the individual or entity to whom they are 
addressed. If you are not the intended recipient or the person 
responsible for delivering the email to the intended recipient, be 
advised that you have received this email in error and that any use, 
dissemination, forwarding, printing, or copying of this email is 
strictly prohibited. If you have received this email in error please 
notify Bruno René Santos by telephone on +351 210 438 686


Re: Error on BaseContext - object is modified when committed is expected

Posted by Andrus Adamchik <an...@objectstyle.org>.
>  I am developing a web application so it is possible that some thread is interfering on the refreshing of the Object Cache?

This depends on how you share a DataContext. If your app is not read-only, DataContext should not be shared.

Andrus

On Jan 24, 2011, at 12:09 PM, Bruno René Santos wrote:

> HoVPlanoContas is a view. And yes the id 129 exists. On that piece of code you're expecting a committed object but you're getting a modified one... I am going to analyze a little further why on this region of code this happens (On other parts I dont get this error). But it would help to know the purpose of this PrepareForAccess method and how the object starts as HOLLOW and all of a sudden it is supposed to be committed (but in the end is modified...). I am developing a web application so it is possible that some thread is interfering on the refreshing of the Object Cache? Any other ideas?
> 
> Thanx
> Bruno
> 
> Em 24-01-2011 09:43, Andrus Adamchik escreveu:
>> Can you confirm that there is a record for HoVPlanoContas in the database with id of 129? Is it reproducible?
>> 
>> Andrus
>> 
>> On Jan 24, 2011, at 3:03 AM, Bruno René Santos wrote:
>> 
>>> Hello all,
>>> 
>>> Im having an error when I access an object:
>>> 
>>> Caused by: org.apache.cayenne.FaultFailureException: [v.3.0.1 Aug 25 2010 19:38:17] Error resolving fault for ObjectId:<ObjectId:HoVPlanoContas, id=129>  and state (modified). Possible cause - matching row is missing from the database.
>>>    at org.apache.cayenne.BaseContext.prepareForAccess(BaseContext.java:171)
>>>    at org.apache.cayenne.CayenneDataObject.readProperty(CayenneDataObject.java:230)
>>> 
>>> When I go to the line 171 of BaseContext there is this comment from Andrus:
>>> 
>>> // TODO: andrus 4/13/2006, modified and deleted states are possible due to
>>>                // a race condition, should we handle them here?
>>> 
>>> Why this happens? Any solutions?
>>> 
>>> Thanx
>>> Bruno
>>> -- 
>>> Bruno René Santos | brunorene@holos.pt<ma...@holos.pt>  | Gestor de Projectos | Analista | Programador | Investigador
>>> 
>>> Holos - Soluções Avançadas em Tecnologias de Informação S.A.
>>> Parque de Ciência e Tecnologia de Almada/Setúbal . Edifício Madan Parque
>>> Rua dos Inventores . Quinta da Torre . 2825 - 182 Caparica . Portugal
>>> Phone: +351 210 438 686 . Fax: +351 210 438 687 . Web: www.holos.pt
>>> 
>>> 
>>> This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended recipient or the person responsible for delivering the email to the intended recipient, be advised that you have received this email in error and that any use, dissemination, forwarding, printing, or copying of this email is strictly prohibited. If you have received this email in error please notify Bruno René Santos by telephone on +351 210 438 686
>>> 
>> 
>> 
> 
> 
> -- 
> Bruno René Santos | brunorene@holos.pt <ma...@holos.pt> | Gestor de Projectos | Analista | Programador | Investigador
> 
> Holos - Soluções Avançadas em Tecnologias de Informação S.A.
> Parque de Ciência e Tecnologia de Almada/Setúbal . Edifício Madan Parque
> Rua dos Inventores . Quinta da Torre . 2825 - 182 Caparica . Portugal
> Phone: +351 210 438 686 . Fax: +351 210 438 687 . Web: www.holos.pt
> 
> 
> This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended recipient or the person responsible for delivering the email to the intended recipient, be advised that you have received this email in error and that any use, dissemination, forwarding, printing, or copying of this email is strictly prohibited. If you have received this email in error please notify Bruno René Santos by telephone on +351 210 438 686
> 


Re: Error on BaseContext - object is modified when committed is expected

Posted by Bruno René Santos <br...@holos.pt>.
HoVPlanoContas is a view. And yes the id 129 exists. On that piece of 
code you're expecting a committed object but you're getting a modified 
one... I am going to analyze a little further why on this region of code 
this happens (On other parts I dont get this error). But it would help 
to know the purpose of this PrepareForAccess method and how the object 
starts as HOLLOW and all of a sudden it is supposed to be committed (but 
in the end is modified...). I am developing a web application so it is 
possible that some thread is interfering on the refreshing of the Object 
Cache? Any other ideas?

Thanx
Bruno

Em 24-01-2011 09:43, Andrus Adamchik escreveu:
> Can you confirm that there is a record for HoVPlanoContas in the database with id of 129? Is it reproducible?
>
> Andrus
>
> On Jan 24, 2011, at 3:03 AM, Bruno René Santos wrote:
>
>> Hello all,
>>
>> Im having an error when I access an object:
>>
>> Caused by: org.apache.cayenne.FaultFailureException: [v.3.0.1 Aug 25 2010 19:38:17] Error resolving fault for ObjectId:<ObjectId:HoVPlanoContas, id=129>  and state (modified). Possible cause - matching row is missing from the database.
>>     at org.apache.cayenne.BaseContext.prepareForAccess(BaseContext.java:171)
>>     at org.apache.cayenne.CayenneDataObject.readProperty(CayenneDataObject.java:230)
>>
>> When I go to the line 171 of BaseContext there is this comment from Andrus:
>>
>> // TODO: andrus 4/13/2006, modified and deleted states are possible due to
>>                 // a race condition, should we handle them here?
>>
>> Why this happens? Any solutions?
>>
>> Thanx
>> Bruno
>> -- 
>> Bruno René Santos | brunorene@holos.pt<ma...@holos.pt>  | Gestor de Projectos | Analista | Programador | Investigador
>>
>> Holos - Soluções Avançadas em Tecnologias de Informação S.A.
>> Parque de Ciência e Tecnologia de Almada/Setúbal . Edifício Madan Parque
>> Rua dos Inventores . Quinta da Torre . 2825 - 182 Caparica . Portugal
>> Phone: +351 210 438 686 . Fax: +351 210 438 687 . Web: www.holos.pt
>>
>>
>> This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended recipient or the person responsible for delivering the email to the intended recipient, be advised that you have received this email in error and that any use, dissemination, forwarding, printing, or copying of this email is strictly prohibited. If you have received this email in error please notify Bruno René Santos by telephone on +351 210 438 686
>>
>
>


-- 
Bruno René Santos | brunorene@holos.pt <ma...@holos.pt> | 
Gestor de Projectos | Analista | Programador | Investigador

Holos - Soluções Avançadas em Tecnologias de Informação S.A.
Parque de Ciência e Tecnologia de Almada/Setúbal . Edifício Madan Parque
Rua dos Inventores . Quinta da Torre . 2825 - 182 Caparica . Portugal
Phone: +351 210 438 686 . Fax: +351 210 438 687 . Web: www.holos.pt


This email and any files transmitted with it are confidential and 
intended solely for the use of the individual or entity to whom they are 
addressed. If you are not the intended recipient or the person 
responsible for delivering the email to the intended recipient, be 
advised that you have received this email in error and that any use, 
dissemination, forwarding, printing, or copying of this email is 
strictly prohibited. If you have received this email in error please 
notify Bruno René Santos by telephone on +351 210 438 686


Re: Error on BaseContext - object is modified when committed is expected

Posted by Andrus Adamchik <an...@objectstyle.org>.
Can you confirm that there is a record for HoVPlanoContas in the database with id of 129? Is it reproducible?

Andrus

On Jan 24, 2011, at 3:03 AM, Bruno René Santos wrote:

> Hello all,
> 
> Im having an error when I access an object:
> 
> Caused by: org.apache.cayenne.FaultFailureException: [v.3.0.1 Aug 25 2010 19:38:17] Error resolving fault for ObjectId: <ObjectId:HoVPlanoContas, id=129> and state (modified). Possible cause - matching row is missing from the database.
>    at org.apache.cayenne.BaseContext.prepareForAccess(BaseContext.java:171)
>    at org.apache.cayenne.CayenneDataObject.readProperty(CayenneDataObject.java:230)
> 
> When I go to the line 171 of BaseContext there is this comment from Andrus:
> 
> // TODO: andrus 4/13/2006, modified and deleted states are possible due to
>                // a race condition, should we handle them here?
> 
> Why this happens? Any solutions?
> 
> Thanx
> Bruno
> -- 
> Bruno René Santos | brunorene@holos.pt <ma...@holos.pt> | Gestor de Projectos | Analista | Programador | Investigador
> 
> Holos - Soluções Avançadas em Tecnologias de Informação S.A.
> Parque de Ciência e Tecnologia de Almada/Setúbal . Edifício Madan Parque
> Rua dos Inventores . Quinta da Torre . 2825 - 182 Caparica . Portugal
> Phone: +351 210 438 686 . Fax: +351 210 438 687 . Web: www.holos.pt
> 
> 
> This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended recipient or the person responsible for delivering the email to the intended recipient, be advised that you have received this email in error and that any use, dissemination, forwarding, printing, or copying of this email is strictly prohibited. If you have received this email in error please notify Bruno René Santos by telephone on +351 210 438 686
>