Is the code calling 
     Collection<GaCampaign> gaCampaigns = gaAccount.getGaCampaigns();
within an active transaction?



Marc Siegel wrote:
> 
> Hi Patrick,
> 
> The following code:
> Collection<GaCampaign> gaCampaigns = gaAccount.getGaCampaigns();
> 
> Is returning null, not even an empty Collection, even though the data
> in the database is set up correctly. In the database, there are 63
> rows in GaCampaign with a gaAccountId of 10, which should match the
> implied foreign key query from the code above.
> 
> Here is a simplified view of the two annotated classes:
> 
> public class GaAccount {
>     @OneToMany(mappedBy="gaAccount", fetch=FetchType.LAZY)
>     protected Collection<GaCampaign> gaCampaigns;
> 
>     public Collection<GaCampaign> getGaCampaigns() {
>       return gaCampaigns;
>     }
> 
>     public void setGaCampaigns(Collection<GaCampaign> gaCampaigns) {
>       this.gaCampaigns = gaCampaigns;
>     }
> }
> 
> public class GaCampaign {
>     @ManyToOne
>     @JoinColumn(name="gaAccountId")
>     protected GaAccount gaAccount;
> 
>     public GaAccount getGaAccount() {
>       return gaAccount;
>     }
> 
>     public void setGaAccount(GaAccount gaAccount) {
>       this.gaAccount = gaAccount;
>     }
> }
> 
> Can you shed any light on this problem? I don't think
> gaAccount.getGaCampaign() should be returning (null) in any case,
> right?
> 
> Thanks again,
> -Marc
> 
> 

-- 
View this message in context: 
http://www.nabble.com/%40OneToMany--%3E-null-collection--tp13529255p15091353.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Reply via email to