Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • 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()).
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!