• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

about inner join and inner join fetch again

 
Ranch Hand
Posts: 308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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?
reply
    Bookmark Topic Watch Topic
  • New Topic