openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marc Siegel" <>
Subject @OneToMany -> null collection?
Date Thu, 01 Nov 2007 13:53:52 GMT
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 {
    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,

Thanks again,

View raw message