Hi,
the code:
class Bid:
Code:
@Column(name = "something")
private String something;
@ManyToOne(cascade = CascadeType.REFRESH, fetch = FetchType.EAGER)
@JoinColumn(name = "bid_item_id")
private Item item;
class Item:
Code:
@OneToMany(cascade = CascadeType.REFRESH, fetch = FetchType.EAGER, mappedBy = "item")
private final Set<Bid> bids = new HashSet<Bid>();
The Criteria Query:
Code:
session.createCriteria(Item.class).createAlias("bids","b").add(Restrictions.eq("b.something", "value")).setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY).list();
Both classes are entities.
The problem is, that several queries are excuted/logged. One query for searching the items.
I think the other queries initialize the bid collections i think.
The result contains the right entities, but it runs slow.
Best regards
Dennis