2 Replies Latest reply on Aug 14, 2003 5:08 AM by ahaikio

    getPrimaryKey() ClassCastException

    viz

      Hi All,

      I am using JBoss 3.2.1, mySQL with a table that has AUTO_INCREMENT. All works fine except when I initially call create() and then call getPrimaryKey() and try to cast this to an Integer, I get a ClassCastException. Here is the code:

      CustomerLocal customerRec = customerHome.create();
      Integer pk = (Integer)customerRec.getPrimaryKey();

      If I do the following, all is okay:

      CustomerLocal customerRec = customerHome.create();
      Object ref = customerRec.getPrimaryKey();
      Integer pk = new Integer( ref.toString() );

      Any thoughts on why it will not cast?

      BTW The Entity Bean only has local interfaces.

      Many thanks
      --
      Marc