Beginner |
|
Joined: Sat Dec 01, 2007 4:34 pm Posts: 20
|
It seems like all my database calls are taking several seconds... I can't find out why... Below I've pasted the log for a simple select call. From what I can see in the log it seems like Hibernate is doing much more than it should. Could it be because I'm using fetch type eager for my select statements? The select statementCode: List<Category> categoryList = session.createQuery("select c from Category c where c.categoryLevel=1").list(); The bean class Quote: @Table(name = "CATEGORY") public class Category implements Serializable {
@Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "CATEGORYID") private Long categoryId;
@Column(name = "CATEGORY") private String category;
@Column(name = "CATEGORYLEVEL") private Long categoryLevel;
@ManyToOne(fetch=FetchType.EAGER, cascade = CascadeType.ALL) @JoinTable(name = "SUBCATEGORY", joinColumns = { @JoinColumn(name = "CHILDID")}, inverseJoinColumns = { @JoinColumn(name="PARENTID") }) private Category parent;
@ManyToMany(fetch=FetchType.EAGER, cascade = CascadeType.ALL) @JoinTable(name = "SUBCATEGORY", joinColumns = { @JoinColumn(name = "PARENTID")}, inverseJoinColumns = { @JoinColumn(name="CHILDID") }) private Set<Category> subCategoryList;
Log for the select statementINFO: Hibernate: select category0_.CATEGORYID as CATEGORYID3_, category0_.CATEGORY as CATEGORY3_, category0_.CATEGORYLEVEL as CATEGORY3_3_, category0_1_.PARENTID as PARENTID4_ from CATEGORY category0_ left outer join SUBCATEGORY category0_1_ on category0_.CATEGORYID=category0_1_.CHILDID where category0_.CATEGORYLEVEL=1 INFO: Hibernate: select subcategor0_.PARENTID as PARENTID2_, subcategor0_.CHILDID as CHILDID2_, category1_.CATEGORYID as CATEGORYID3_0_, category1_.CATEGORY as CATEGORY3_0_, category1_.CATEGORYLEVEL as CATEGORY3_3_0_, category1_1_.PARENTID as PARENTID4_0_, category2_.CATEGORYID as CATEGORYID3_1_, category2_.CATEGORY as CATEGORY3_1_, category2_.CATEGORYLEVEL as CATEGORY3_3_1_, category2_1_.PARENTID as PARENTID4_1_ from SUBCATEGORY subcategor0_ left outer join CATEGORY category1_ on subcategor0_.CHILDID=category1_.CATEGORYID left outer join SUBCATEGORY category1_1_ on category1_.CATEGORYID=category1_1_.CHILDID left outer join CATEGORY category2_ on category1_1_.PARENTID=category2_.CATEGORYID left outer join SUBCATEGORY category2_1_ on category2_.CATEGORYID=category2_1_.CHILDID where subcategor0_.PARENTID=? INFO: Hibernate: select subcategor0_.PARENTID as PARENTID2_, subcategor0_.CHILDID as CHILDID2_, category1_.CATEGORYID as CATEGORYID3_0_, category1_.CATEGORY as CATEGORY3_0_, category1_.CATEGORYLEVEL as CATEGORY3_3_0_, category1_1_.PARENTID as PARENTID4_0_, category2_.CATEGORYID as CATEGORYID3_1_, category2_.CATEGORY as CATEGORY3_1_, category2_.CATEGORYLEVEL as CATEGORY3_3_1_, category2_1_.PARENTID as PARENTID4_1_ from SUBCATEGORY subcategor0_ left outer join CATEGORY category1_ on subcategor0_.CHILDID=category1_.CATEGORYID left outer join SUBCATEGORY category1_1_ on category1_.CATEGORYID=category1_1_.CHILDID left outer join CATEGORY category2_ on category1_1_.PARENTID=category2_.CATEGORYID left outer join SUBCATEGORY category2_1_ on category2_.CATEGORYID=category2_1_.CHILDID where subcategor0_.PARENTID=? INFO: Hibernate: select subcategor0_.PARENTID as PARENTID2_, subcategor0_.CHILDID as CHILDID2_, category1_.CATEGORYID as CATEGORYID3_0_, category1_.CATEGORY as CATEGORY3_0_, category1_.CATEGORYLEVEL as CATEGORY3_3_0_, category1_1_.PARENTID as PARENTID4_0_, category2_.CATEGORYID as CATEGORYID3_1_, category2_.CATEGORY as CATEGORY3_1_, category2_.CATEGORYLEVEL as CATEGORY3_3_1_, category2_1_.PARENTID as PARENTID4_1_ from SUBCATEGORY subcategor0_ left outer join CATEGORY category1_ on subcategor0_.CHILDID=category1_.CATEGORYID left outer join SUBCATEGORY category1_1_ on category1_.CATEGORYID=category1_1_.CHILDID left outer join CATEGORY category2_ on category1_1_.PARENTID=category2_.CATEGORYID left outer join SUBCATEGORY category2_1_ on category2_.CATEGORYID=category2_1_.CHILDID where subcategor0_.PARENTID=? INFO: Hibernate: select subcategor0_.PARENTID as PARENTID2_, subcategor0_.CHILDID as CHILDID2_, category1_.CATEGORYID as CATEGORYID3_0_, category1_.CATEGORY as CATEGORY3_0_, category1_.CATEGORYLEVEL as CATEGORY3_3_0_, category1_1_.PARENTID as PARENTID4_0_, category2_.CATEGORYID as CATEGORYID3_1_, category2_.CATEGORY as CATEGORY3_1_, category2_.CATEGORYLEVEL as CATEGORY3_3_1_, category2_1_.PARENTID as PARENTID4_1_ from SUBCATEGORY subcategor0_ left outer join CATEGORY category1_ on subcategor0_.CHILDID=category1_.CATEGORYID left outer join SUBCATEGORY category1_1_ on category1_.CATEGORYID=category1_1_.CHILDID left outer join CATEGORY category2_ on category1_1_.PARENTID=category2_.CATEGORYID left outer join SUBCATEGORY category2_1_ on category2_.CATEGORYID=category2_1_.CHILDID where subcategor0_.PARENTID=? INFO: Hibernate: select subcategor0_.PARENTID as PARENTID2_, subcategor0_.CHILDID as CHILDID2_, category1_.CATEGORYID as CATEGORYID3_0_, category1_.CATEGORY as CATEGORY3_0_, category1_.CATEGORYLEVEL as CATEGORY3_3_0_, category1_1_.PARENTID as PARENTID4_0_, category2_.CATEGORYID as CATEGORYID3_1_, category2_.CATEGORY as CATEGORY3_1_, category2_.CATEGORYLEVEL as CATEGORY3_3_1_, category2_1_.PARENTID as PARENTID4_1_ from SUBCATEGORY subcategor0_ left outer join CATEGORY category1_ on subcategor0_.CHILDID=category1_.CATEGORYID left outer join SUBCATEGORY category1_1_ on category1_.CATEGORYID=category1_1_.CHILDID left outer join CATEGORY category2_ on category1_1_.PARENTID=category2_.CATEGORYID left outer join SUBCATEGORY category2_1_ on category2_.CATEGORYID=category2_1_.CHILDID where subcategor0_.PARENTID=? INFO: Hibernate: select subcategor0_.PARENTID as PARENTID2_, subcategor0_.CHILDID as CHILDID2_, category1_.CATEGORYID as CATEGORYID3_0_, category1_.CATEGORY as CATEGORY3_0_, category1_.CATEGORYLEVEL as CATEGORY3_3_0_, category1_1_.PARENTID as PARENTID4_0_, category2_.CATEGORYID as CATEGORYID3_1_, category2_.CATEGORY as CATEGORY3_1_, category2_.CATEGORYLEVEL as CATEGORY3_3_1_, category2_1_.PARENTID as PARENTID4_1_ from SUBCATEGORY subcategor0_ left outer join CATEGORY category1_ on subcategor0_.CHILDID=category1_.CATEGORYID left outer join SUBCATEGORY category1_1_ on category1_.CATEGORYID=category1_1_.CHILDID left outer join CATEGORY category2_ on category1_1_.PARENTID=category2_.CATEGORYID left outer join SUBCATEGORY category2_1_ on category2_.CATEGORYID=category2_1_.CHILDID where subcategor0_.PARENTID=? INFO: Hibernate: select subcategor0_.PARENTID as PARENTID2_, subcategor0_.CHILDID as CHILDID2_, category1_.CATEGORYID as CATEGORYID3_0_, category1_.CATEGORY as CATEGORY3_0_, category1_.CATEGORYLEVEL as CATEGORY3_3_0_, category1_1_.PARENTID as PARENTID4_0_, category2_.CATEGORYID as CATEGORYID3_1_, category2_.CATEGORY as CATEGORY3_1_, category2_.CATEGORYLEVEL as CATEGORY3_3_1_, category2_1_.PARENTID as PARENTID4_1_ from SUBCATEGORY subcategor0_ left outer join CATEGORY category1_ on subcategor0_.CHILDID=category1_.CATEGORYID left outer join SUBCATEGORY category1_1_ on category1_.CATEGORYID=category1_1_.CHILDID left outer join CATEGORY category2_ on category1_1_.PARENTID=category2_.CATEGORYID left outer join SUBCATEGORY category2_1_ on category2_.CATEGORYID=category2_1_.CHILDID where subcategor0_.PARENTID=? INFO: Hibernate: select subcategor0_.PARENTID as PARENTID2_, subcategor0_.CHILDID as CHILDID2_, category1_.CATEGORYID as CATEGORYID3_0_, category1_.CATEGORY as CATEGORY3_0_, category1_.CATEGORYLEVEL as CATEGORY3_3_0_, category1_1_.PARENTID as PARENTID4_0_, category2_.CATEGORYID as CATEGORYID3_1_, category2_.CATEGORY as CATEGORY3_1_, category2_.CATEGORYLEVEL as CATEGORY3_3_1_, category2_1_.PARENTID as PARENTID4_1_ from SUBCATEGORY subcategor0_ left outer join CATEGORY category1_ on subcategor0_.CHILDID=category1_.CATEGORYID left outer join SUBCATEGORY category1_1_ on category1_.CATEGORYID=category1_1_.CHILDID left outer join CATEGORY category2_ on category1_1_.PARENTID=category2_.CATEGORYID left outer join SUBCATEGORY category2_1_ on category2_.CATEGORYID=category2_1_.CHILDID where subcategor0_.PARENTID=? INFO: Hibernate: select subcategor0_.PARENTID as PARENTID2_, subcategor0_.CHILDID as CHILDID2_, category1_.CATEGORYID as CATEGORYID3_0_, category1_.CATEGORY as CATEGORY3_0_, category1_.CATEGORYLEVEL as CATEGORY3_3_0_, category1_1_.PARENTID as PARENTID4_0_, category2_.CATEGORYID as CATEGORYID3_1_, category2_.CATEGORY as CATEGORY3_1_, category2_.CATEGORYLEVEL as CATEGORY3_3_1_, category2_1_.PARENTID as PARENTID4_1_ from SUBCATEGORY subcategor0_ left outer join CATEGORY category1_ on subcategor0_.CHILDID=category1_.CATEGORYID left outer join SUBCATEGORY category1_1_ on category1_.CATEGORYID=category1_1_.CHILDID left outer join CATEGORY category2_ on category1_1_.PARENTID=category2_.CATEGORYID left outer join SUBCATEGORY category2_1_ on category2_.CATEGORYID=category2_1_.CHILDID where subcategor0_.PARENTID=? INFO: Hibernate: select subcategor0_.PARENTID as PARENTID2_, subcategor0_.CHILDID as CHILDID2_, category1_.CATEGORYID as CATEGORYID3_0_, category1_.CATEGORY as CATEGORY3_0_, category1_.CATEGORYLEVEL as CATEGORY3_3_0_, category1_1_.PARENTID as PARENTID4_0_, category2_.CATEGORYID as CATEGORYID3_1_, category2_.CATEGORY as CATEGORY3_1_, category2_.CATEGORYLEVEL as CATEGORY3_3_1_, category2_1_.PARENTID as PARENTID4_1_ from SUBCATEGORY subcategor0_ left outer join CATEGORY category1_ on subcategor0_.CHILDID=category1_.CATEGORYID left outer join SUBCATEGORY category1_1_ on category1_.CATEGORYID=category1_1_.CHILDID left outer join CATEGORY category2_ on category1_1_.PARENTID=category2_.CATEGORYID left outer join SUBCATEGORY category2_1_ on category2_.CATEGORYID=category2_1_.CHILDID where subcategor0_.PARENTID=? INFO: Hibernate: select subcategor0_.PARENTID as PARENTID2_, subcategor0_.CHILDID as CHILDID2_, category1_.CATEGORYID as CATEGORYID3_0_, category1_.CATEGORY as CATEGORY3_0_, category1_.CATEGORYLEVEL as CATEGORY3_3_0_, category1_1_.PARENTID as PARENTID4_0_, category2_.CATEGORYID as CATEGORYID3_1_, category2_.CATEGORY as CATEGORY3_1_, category2_.CATEGORYLEVEL as CATEGORY3_3_1_, category2_1_.PARENTID as PARENTID4_1_ from SUBCATEGORY subcategor0_ left outer join CATEGORY category1_ on subcategor0_.CHILDID=category1_.CATEGORYID left outer join SUBCATEGORY category1_1_ on category1_.CATEGORYID=category1_1_.CHILDID left outer join CATEGORY category2_ on category1_1_.PARENTID=category2_.CATEGORYID left outer join SUBCATEGORY category2_1_ on category2_.CATEGORYID=category2_1_.CHILDID where subcategor0_.PARENTID=? INFO: Hibernate: select subcategor0_.PARENTID as PARENTID2_, subcategor0_.CHILDID as CHILDID2_, category1_.CATEGORYID as CATEGORYID3_0_, category1_.CATEGORY as CATEGORY3_0_, category1_.CATEGORYLEVEL as CATEGORY3_3_0_, category1_1_.PARENTID as PARENTID4_0_, category2_.CATEGORYID as CATEGORYID3_1_, category2_.CATEGORY as CATEGORY3_1_, category2_.CATEGORYLEVEL as CATEGORY3_3_1_, category2_1_.PARENTID as PARENTID4_1_ from SUBCATEGORY subcategor0_ left outer join CATEGORY category1_ on subcategor0_.CHILDID=category1_.CATEGORYID left outer join SUBCATEGORY category1_1_ on category1_.CATEGORYID=category1_1_.CHILDID left outer join CATEGORY category2_ on category1_1_.PARENTID=category2_.CATEGORYID left outer join SUBCATEGORY category2_1_ on category2_.CATEGORYID=category2_1_.CHILDID where subcategor0_.PARENTID=? INFO: Hibernate: select subcategor0_.PARENTID as PARENTID2_, subcategor0_.CHILDID as CHILDID2_, category1_.CATEGORYID as CATEGORYID3_0_, category1_.CATEGORY as CATEGORY3_0_, category1_.CATEGORYLEVEL as CATEGORY3_3_0_, category1_1_.PARENTID as PARENTID4_0_, category2_.CATEGORYID as CATEGORYID3_1_, category2_.CATEGORY as CATEGORY3_1_, category2_.CATEGORYLEVEL as CATEGORY3_3_1_, category2_1_.PARENTID as PARENTID4_1_ from SUBCATEGORY subcategor0_ left outer join CATEGORY category1_ on subcategor0_.CHILDID=category1_.CATEGORYID left outer join SUBCATEGORY category1_1_ on category1_.CATEGORYID=category1_1_.CHILDID left outer join CATEGORY category2_ on category1_1_.PARENTID=category2_.CATEGORYID left outer join SUBCATEGORY category2_1_ on category2_.CATEGORYID=category2_1_.CHILDID where subcategor0_.PARENTID=?INFO: Diff tid i ADDRECIPECONTROLLER: 16127
|
|