Win a copy of Murach's MySQL this week in the JDBC and Relational Databases forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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()).
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic