• 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

ClassCastException

 
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Aaaaagh! I don't know if it's just because it's 5:00 on a Friday, or if I really have a problem, but I just can't seem to figure this out. I keep getting the ClassCastException: sun.jdbc.odbc.JdbcOdbcPreparedStatement cannot be cast to MVProductList whenever the following line of code runs:



Here's the code for the method that gets called to return the ArrayList as well as the class I created that I'm trying to cast the object to:



What in the heck have I done wrong? Thanks for any help anyone can give me!
Let me know if any further information is needed.


[ February 22, 2008: Message edited by: Jennifer Sohl ]

[ February 22, 2008: Message edited by: Jennifer Sohl ]

[ February 22, 2008: Message edited by: Jennifer Sohl ]
[ February 22, 2008: Message edited by: Jennifer Sohl ]
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your ArrayList contains a bunch of PreparedStatement objects, this is why the cast to MVProductList fails. You should be doing this instead.

 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oooooo boy..... I'm so sorry! I see what I did wrong now! I'm using the excuse that it was 5:00 on a Friday and I wasn't in my right mind!
Thanks for straightening me out!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic