*
The moose likes Object Relational Mapping and the fly likes about inner join and inner join fetch again Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "about inner join and inner join fetch again" Watch "about inner join and inner join fetch again" New topic
Author

about inner join and inner join fetch again

peter tong
Ranch Hand

Joined: Mar 15, 2008
Posts: 240


the result in console is
...
[java] Hibernate: select supplier0_.id as id0_, products1_.id as id1_, supplier0_.name as name1_0_, products1_.name as name0_1_, products1_.description as descript3_0_1_, products1_.price as price0_1_, products1_.supplierId as supplierId0_1_, products1_.supplierId as supplierId__, products1_.id as id__ from Supplier supplier0_ inner join Product products1_ on supplier0_.id=products1_.supplierId
[java] Supplier Name 1 Product 1
[java] Supplier Name 1 Product 1
[java] Supplier Name 2 Product 3
[java] Hibernate: select supplier0_.id as id0_, products1_.id as id1_, supplier0_.name as name1_0_, products1_.name as name0_1_, products1_.description as descript3_0_1_, products1_.price as price0_1_, products1_.supplierId as supplierId0_1_ from Supplier supplier0_ inner join Product products1_ on supplier0_.id=products1_.supplierId
[java] Exception in thread "main" java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to Supplier [java] at Main.displaySupplierList(Main.java:38)
[java] at Main.main(Main.java:24)
[java] Java Result: 1

if not using fetch, iter.next() cannot be cast to Supplier, why?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: about inner join and inner join fetch again
 
Similar Threads
ProjectionList hibernate Criteria
Indexed Collections
join fetch
join problem in hibernate 3.x
Sorting arrays