Hi guys,
Using JDK 1.5 | Hibernate 3.3 | Oracle 9i.
Using these entities:
Code:
@Entity
public class Sku {
@Id
private Long id;
@Embeddable
private Summary summary = new Summary();
}
@Embeddable
public class Summary {
@Column(name = "CREATED_BY")
private String createdBy;
}
This query:
Code:
em.createQuery("select s from Sku s where s.summary.createdBy = ?1").setParameter(1, param).getResultList();
is 20x slower than this:
Code:
List<Number> ids = em.createNativeQuery("select id from sku where created_by = ?1").setParameter(1, param).getResultList();
for (Number id : ids) {
skus.add(em.find(Sku.class, id.longValue()));
}
Why?
Thanks!