-
class cast exception in ejbLoad() (1 messages)
- Posted by: Krishna prasad
- Posted on: August 07 2008 03:54 EDT
ClassCastException is thrown inside ejbLoad() in my entity bean. code that threw the exception: 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 primaryKey = (Integer)ctx.getPrimaryKey(); 1.why getPrimaryKey() is not returning primary key class? 2.what getPrimaryKey() actually does? have a great day, krishna prasad gThreaded Messages (1)
- Re: class cast exception in ejbLoad() by Alucard Hellsing on August 12 2008 18:48 EDT
-
Re: class cast exception in ejbLoad()[ Go to top ]
- Posted by: Alucard Hellsing
- Posted on: August 12 2008 18:48 EDT
- in response to Krishna prasad
Try using EntityContext.getEjbObject().getPrimaryKey(). Result may depend on whether you have compound primary key, and on application server used.