Hi,

could somebody point me to the right direction on this:

I have two Entities:

@Entity
@Table(name = "naviglobal")
public class *Naviglobal* implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
*    *@Column(name="global_id")
    private Long global_id;*
    @OneToMany(fetch = FetchType.EAGER)
    @JoinColumn(name="global_id")
    private List<Navimain> mainnavi;*
}

@Entity
@Table(name = "navimain")
public class *Navimain* implements Serializable {
    @Column(name="deleted")
    private String deleted;
}


What I would like now is to perform a query that gives me all globalnavi
but filter on the mainnavi auto-fetched Entities "Navimain", something like
that:
SELECT c from Naviglobal c
LEFT JOIN c.mainnavi m
WHERE AND m.deleted = false

*Resulting* I will of course get something *completely wrong* as it will
result in having the product of naviglobal multiplicated with navimain
entries....
As Naviglobal AUTO-Fetches the Navimain table I actually do get a lot of
duplicates.
My query simply cannot influence the way openJPA will generate the "Fetch"
for the Navimain table.

I would expect to have sth like a @Where(deleted=false) Annotation ... but
there is none.

There must be some other way or workaround to solve this common issue?

Thanks
Sebastian


-- 
Sebastian Wagner
http://www.openmeetings.de
http://www.webbase-design.de
http://www.wagner-sebastian.com
seba.wag...@gmail.com

Reply via email to