Hibernate criteria with projection not performing query for @OneToMany mapping

Posted by Josh on Stack Overflow See other posts from Stack Overflow or by Josh
Published on 2011-01-11T19:50:32Z Indexed on 2011/01/11 19:54 UTC
Read the original article Hit count: 250

I have a domain object, Expense, that has a field called initialFields.

It's annotated as so:

@OneToMany(fetch = FetchType.EAGER, cascade = { CascadeType.ALL }, orphanRemoval = true)
@JoinTable(blah blah)
private final List<Field> initialFields;

Now I'm trying to use Projections in order to only pull certain fields for performance reasons, but when doing so the initialFields field is always null. It's the only OneToMany field and the only field I am trying to retrieve with the projection that is behaving this way. If I use a regular HQL query initialFields is populated appropriately, but of course I can't limit the fields.

Anyone ever seen anything like this?

© Stack Overflow or respective owner

Related posts about java

Related posts about hibernate