You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Cimballi <ci...@cimballi.net> on 2009/07/02 21:07:25 UTC

Question about services transactions and GenericModelException

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

Re: Question about services transactions and GenericModelException

Posted by Tim Ruppert <ti...@hotwaxmedia.com>.
Thanks for doing that.

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

o:801.649.6594
f:801.649.6595

----- "Cimballi" <ci...@cimballi.net> wrote:

> Created : https://issues.apache.org/jira/browse/OFBIZ-2697
> 
> Cimballi
> 
> 
> On Fri, Jul 3, 2009 at 9:35 AM, Andrew Zeneski<aj...@gmail.com>
> 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<ci...@gmail.com> 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
> >>
> >
> >

Re: Question about services transactions and GenericModelException

Posted by Cimballi <ci...@cimballi.net>.
Created : https://issues.apache.org/jira/browse/OFBIZ-2697

Cimballi


On Fri, Jul 3, 2009 at 9:35 AM, Andrew Zeneski<aj...@gmail.com> 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<ci...@gmail.com> 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
>>
>
>

Re: Question about services transactions and GenericModelException

Posted by Andrew Zeneski <aj...@gmail.com>.
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<ci...@gmail.com> 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
>

Re: Question about services transactions and GenericModelException

Posted by Cimballi <ci...@gmail.com>.
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

Re: Question about services transactions and GenericModelException

Posted by Ashish Vijaywargiya <vi...@gmail.com>.
+1

--
Ashish

On Fri, Jul 3, 2009 at 3:07 PM, Scott Gray <sc...@hotwaxmedia.com>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
>
>
>

Re: Question about services transactions and GenericModelException

Posted by Scott Gray <sc...@hotwaxmedia.com>.
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