• Post Reply Bookmark Topic Watch Topic
  • New Topic

class cast exception during ctx.getPrimaryKey()  RSS feed

 
krishna prasad gunasekaran
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ClassCastException is thrown inside ejbLoad().

Occupation occupation= (Occupation)ctx.getPrimaryKey();

Occupation is primary key class(occupationId is an int field).

when i replaced Occupation with Integer, as below, no exception was thrown.

Integer id = (Integer)ctx.getPrimaryKey();

1.why getPrimaryKey() is not returning primary key class?
2.what getPrimaryKey() actually does?
 
Jetendra Ivaturi
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's the primary key class you have mentioned in the descriptors.

I believe that is the thing which we get.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!