geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gianny Damour <gianny.dam...@optusnet.com.au>
Subject Re: How can I get rid of javax.ejb.NoSuchObjectLocalException?
Date Fri, 08 Jul 2005 10:04:13 GMT
On 8/07/2005 4:08 AM, Jacek Laskowski wrote:

> Jacek Laskowski wrote:
>
>> javax.ejb.NoSuchObjectLocalException
>>          at
>> org.openejb.entity.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:128)

>>
>>          at
>> <sn>
>
>
> A further investigation has revealed that
>
>   AddressLocal address = addressHome.create();
>
> doesn't write the data to the database and executing
>
>   address.setStreetName1(streetName1);
>
> makes Geronimo (OpenEJB + TranQL) think that the record should already 
> be inserted into the database and tries to issue a SELECT query which 
> returns nothing, which in turn results in NoSuchEntityException.
>
> I'd bet there's something wrong with the logic of the 
> o.o.entity.cmp.CMPInstanceContext class (@see #associate()) or even 
> the o.o.entity.EntityInstanceInterceptor class (@see #invoke).
>
> There's a comment in EntityInstanceInterceptor:
>
> associates the context with the transaction, this may result an a load 
> that throws and NoSuchEntityException, which needs to be converted to 
> the a NoSuchObject[Local]Exception
>
> of which result I'm struggling with.
>
> Any help?

AddressEJB has an unknown primary key. You need to:
* define an additional CMP field;
e.g.
            <cmp-field-mapping>
                <cmp-field-name>id</cmp-field-name>
                <cmp-field-class>java.lang.Integer</cmp-field-class>
                <table-column>id</table-column>
            </cmp-field-mapping>

* mark this field as a primary key field (in the openejb-jar.xml DD); and
e.g.
           <primkey-field>id</primkey-field>

* declare an automatic pk generator to set its value.
There were some recent changes and I do not know how it works.

Thanks,
Gianny

>
> Jacek
>
>


Mime
View raw message