-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Query with criteria on embeddable much slower?
PostPosted: Tue Mar 30, 2010 9:34 pm 
Newbie

Joined: Sat Jul 25, 2009 12:44 pm
Posts: 3
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!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.