• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what value to provide for prim-key-class in DD

 
NareshAnkuskani Kumar
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a table which has a column 'ID', Data type is 'number',is the only 'primary key'.

I created a entity bean representing the above table.

now while coding the entity bean i came across with the problem please find it below

int primary_key_field;//A PRIMARY KEY

int ejbCreate(int primaryKey,String name)
{
primary_key_field = primarykey;
}

for the above scenario how could i mention the <prim-key-class> in the deployment
descriptor because 'int' is a primitive datatype and not a class.

can i make use of wrapper classes to solve this problem.
 
Sunil Vasudevan
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
EJB specs do not allow primitives to be used as Primary Key. You can either use a wrapper class or create your own Primary Key class. You need to ensure your implementation of Primary key class follows the RMI-IIOP rules (Example: Implements Serializable, overrides hashCode() and equals()).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic