Question about services transactions and GenericModelException

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Question about services transactions and GenericModelException

Cimballi
Hi,

I have written a service which create several entities.
But I noticed that if there is a GenericModelException thrown, then
the transaction is not rolled back.
The exception is thrown after the first creation, and at the end of
the service call, the first entity is still present in the DB.

Is this a normal behaviour ?

Cimballi
Reply | Threaded
Open this post in threaded view
|

Re: Question about services transactions and GenericModelException

Scott Gray-2
Hi Cimballi

A decent size snippet from the logs almost always helps people to give  
more meaningful answers.

Regards
Scott

HotWax Media
http://www.hotwaxmedia.com

On 3/07/2009, at 7:07 AM, Cimballi wrote:

> Hi,
>
> I have written a service which create several entities.
> But I noticed that if there is a GenericModelException thrown, then
> the transaction is not rolled back.
> The exception is thrown after the first creation, and at the end of
> the service call, the first entity is still present in the DB.
>
> Is this a normal behaviour ?
>
> Cimballi


smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Question about services transactions and GenericModelException

Ashish Vijaywargiya
+1

--
Ashish

On Fri, Jul 3, 2009 at 3:07 PM, Scott Gray <[hidden email]>wrote:

> Hi Cimballi
>
> A decent size snippet from the logs almost always helps people to give more
> meaningful answers.
>
> Regards
> Scott
>
> HotWax Media
> http://www.hotwaxmedia.com
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Question about services transactions and GenericModelException

Cimballi-2
Hi,

Here is the beginning of the stack trace :
2009-07-03 08:23:39,836 (RMI TCP Connection(5)-192.168.1.33) [
GenericDelegator.java:398:ERROR]
---- exception report ----------------------------------------------------------
Error getting entity definition from model
Exception: org.ofbiz.entity.GenericModelException
Message: Could not find definition for entity name ShipGroup
---- stack trace ---------------------------------------------------------------
org.ofbiz.entity.GenericModelException: Could not find definition for
entity name ShipGroup
org.ofbiz.entity.model.ModelReader.getModelEntity(ModelReader.java:451)
org.ofbiz.entity.GenericDelegator.getModelEntity(GenericDelegator.java:396)
org.ofbiz.entity.GenericDelegator.getNextSeqIdLong(GenericDelegator.java:3166)
org.ofbiz.entity.GenericDelegator.getNextSeqId(GenericDelegator.java:3119)
org.ofbiz.entity.GenericDelegator.getNextSeqId(GenericDelegator.java:3109)

As you can see my error is because in my service I wrote "ShipGroup",
which is not an existing entity.

And I found that the problem for the transaction not being rolled back
comes from here :
ofbiz/framework/entity/src/org/ofbiz/entity/GenericDelegator.java
public ModelEntity getModelEntity(String entityName) {
        try {
            return getModelReader().getModelEntity(entityName);
        } catch (GenericEntityException e) {
            Debug.logError(e, "Error getting entity definition from
model", module);
            return null;
        }
    }

In fact, I suppose you don't care about the exception because you
should not have typo error in the name of the entities.

Cimballi
Reply | Threaded
Open this post in threaded view
|

Re: Question about services transactions and GenericModelException

Andrew Zeneski-4
Even with a typo, OFBiz should not leave you with stale data. I think
this should be corrected. Can you file a JIRA issue for this ?

Andrew

On Fri, Jul 3, 2009 at 9:31 AM, Cimballi<[hidden email]> wrote:

> Hi,
>
> Here is the beginning of the stack trace :
> 2009-07-03 08:23:39,836 (RMI TCP Connection(5)-192.168.1.33) [
> GenericDelegator.java:398:ERROR]
> ---- exception report ----------------------------------------------------------
> Error getting entity definition from model
> Exception: org.ofbiz.entity.GenericModelException
> Message: Could not find definition for entity name ShipGroup
> ---- stack trace ---------------------------------------------------------------
> org.ofbiz.entity.GenericModelException: Could not find definition for
> entity name ShipGroup
> org.ofbiz.entity.model.ModelReader.getModelEntity(ModelReader.java:451)
> org.ofbiz.entity.GenericDelegator.getModelEntity(GenericDelegator.java:396)
> org.ofbiz.entity.GenericDelegator.getNextSeqIdLong(GenericDelegator.java:3166)
> org.ofbiz.entity.GenericDelegator.getNextSeqId(GenericDelegator.java:3119)
> org.ofbiz.entity.GenericDelegator.getNextSeqId(GenericDelegator.java:3109)
>
> As you can see my error is because in my service I wrote "ShipGroup",
> which is not an existing entity.
>
> And I found that the problem for the transaction not being rolled back
> comes from here :
> ofbiz/framework/entity/src/org/ofbiz/entity/GenericDelegator.java
> public ModelEntity getModelEntity(String entityName) {
>        try {
>            return getModelReader().getModelEntity(entityName);
>        } catch (GenericEntityException e) {
>            Debug.logError(e, "Error getting entity definition from
> model", module);
>            return null;
>        }
>    }
>
> In fact, I suppose you don't care about the exception because you
> should not have typo error in the name of the entities.
>
> Cimballi
>
Reply | Threaded
Open this post in threaded view
|

Re: Question about services transactions and GenericModelException

Cimballi
Created : https://issues.apache.org/jira/browse/OFBIZ-2697

Cimballi


On Fri, Jul 3, 2009 at 9:35 AM, Andrew Zeneski<[hidden email]> wrote:

> Even with a typo, OFBiz should not leave you with stale data. I think
> this should be corrected. Can you file a JIRA issue for this ?
>
> Andrew
>
> On Fri, Jul 3, 2009 at 9:31 AM, Cimballi<[hidden email]> wrote:
>> Hi,
>>
>> Here is the beginning of the stack trace :
>> 2009-07-03 08:23:39,836 (RMI TCP Connection(5)-192.168.1.33) [
>> GenericDelegator.java:398:ERROR]
>> ---- exception report ----------------------------------------------------------
>> Error getting entity definition from model
>> Exception: org.ofbiz.entity.GenericModelException
>> Message: Could not find definition for entity name ShipGroup
>> ---- stack trace ---------------------------------------------------------------
>> org.ofbiz.entity.GenericModelException: Could not find definition for
>> entity name ShipGroup
>> org.ofbiz.entity.model.ModelReader.getModelEntity(ModelReader.java:451)
>> org.ofbiz.entity.GenericDelegator.getModelEntity(GenericDelegator.java:396)
>> org.ofbiz.entity.GenericDelegator.getNextSeqIdLong(GenericDelegator.java:3166)
>> org.ofbiz.entity.GenericDelegator.getNextSeqId(GenericDelegator.java:3119)
>> org.ofbiz.entity.GenericDelegator.getNextSeqId(GenericDelegator.java:3109)
>>
>> As you can see my error is because in my service I wrote "ShipGroup",
>> which is not an existing entity.
>>
>> And I found that the problem for the transaction not being rolled back
>> comes from here :
>> ofbiz/framework/entity/src/org/ofbiz/entity/GenericDelegator.java
>> public ModelEntity getModelEntity(String entityName) {
>>        try {
>>            return getModelReader().getModelEntity(entityName);
>>        } catch (GenericEntityException e) {
>>            Debug.logError(e, "Error getting entity definition from
>> model", module);
>>            return null;
>>        }
>>    }
>>
>> In fact, I suppose you don't care about the exception because you
>> should not have typo error in the name of the entities.
>>
>> Cimballi
>>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Question about services transactions and GenericModelException

Tim Ruppert
Thanks for doing that.

Cheers,
Tim
--
Tim Ruppert
HotWax Media
http://www.hotwaxmedia.com

o:801.649.6594
f:801.649.6595

----- "Cimballi" <[hidden email]> wrote:

> Created : https://issues.apache.org/jira/browse/OFBIZ-2697
>
> Cimballi
>
>
> On Fri, Jul 3, 2009 at 9:35 AM, Andrew Zeneski<[hidden email]>
> wrote:
> > Even with a typo, OFBiz should not leave you with stale data. I
> think
> > this should be corrected. Can you file a JIRA issue for this ?
> >
> > Andrew
> >
> > On Fri, Jul 3, 2009 at 9:31 AM,
> Cimballi<[hidden email]> wrote:
> >> Hi,
> >>
> >> Here is the beginning of the stack trace :
> >> 2009-07-03 08:23:39,836 (RMI TCP Connection(5)-192.168.1.33) [
> >> GenericDelegator.java:398:ERROR]
> >> ---- exception report
> ----------------------------------------------------------
> >> Error getting entity definition from model
> >> Exception: org.ofbiz.entity.GenericModelException
> >> Message: Could not find definition for entity name ShipGroup
> >> ---- stack trace
> ---------------------------------------------------------------
> >> org.ofbiz.entity.GenericModelException: Could not find definition
> for
> >> entity name ShipGroup
> >>
> org.ofbiz.entity.model.ModelReader.getModelEntity(ModelReader.java:451)
> >>
> org.ofbiz.entity.GenericDelegator.getModelEntity(GenericDelegator.java:396)
> >>
> org.ofbiz.entity.GenericDelegator.getNextSeqIdLong(GenericDelegator.java:3166)
> >>
> org.ofbiz.entity.GenericDelegator.getNextSeqId(GenericDelegator.java:3119)
> >>
> org.ofbiz.entity.GenericDelegator.getNextSeqId(GenericDelegator.java:3109)
> >>
> >> As you can see my error is because in my service I wrote
> "ShipGroup",
> >> which is not an existing entity.
> >>
> >> And I found that the problem for the transaction not being rolled
> back
> >> comes from here :
> >> ofbiz/framework/entity/src/org/ofbiz/entity/GenericDelegator.java
> >> public ModelEntity getModelEntity(String entityName) {
> >>        try {
> >>            return getModelReader().getModelEntity(entityName);
> >>        } catch (GenericEntityException e) {
> >>            Debug.logError(e, "Error getting entity definition from
> >> model", module);
> >>            return null;
> >>        }
> >>    }
> >>
> >> In fact, I suppose you don't care about the exception because you
> >> should not have typo error in the name of the entities.
> >>
> >> Cimballi
> >>
> >
> >