Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ClassCastException

 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • 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 ]
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • 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
  • 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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic