geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lasantha Ranaweera <>
Subject Re: Help with finder method
Date Thu, 22 Feb 2007 10:47:38 GMT

I can't exactly figure out your problem.

There is a sample application in Geronimo User Guide which has the same 
kind of scenario (Customer - Account) . It has a one-many relationship 
for CMP with XDoclet too.

Hope this help you.

Lasantha Ranaweera

Radu Dumitrescu wrote:
> Hello,
> I have a problem with a findAll method. I will describe the context of 
> the application:
> I have a Customer CMP and an Account CMP that have one to many 
> relationship (a customer can have multiple accounts). The Account 
> table has a foreign key field that links it to the Customer table. The 
> Account CMP has a field customer linked with the Customer CMP. I have 
> a finder findAll method in Account bean.
> When I try to call the findAll I get an SQL exception: An attempt was 
> made to get a data value of type '' from a data 
> value of type 'INTEGER'. I think it tries to load the whole Customer 
> data from the foreign key field ...
> The findByPrimaryKey from the Account CMP works perfect and loads the 
> customer field with correct data, so I belive the relationship between 
> Account and Customer works. I use XDoclet to generate my beans and 
> this is how findAll method is defined:
> * @ejb.finder
>  *    query="SELECT OBJECT(account) FROM EstimateSCHEMA as account" 
>  *    signature="java.util.Collection findAll()"
> Thanks,
> Radu Dumitrescu
> ------------------------------------------------------------------------

View raw message