• 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

Primary key and reflection

 
Ranch Hand
Posts: 210
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My understandings about the primary key class:

1. Its instance variables must me public
2. The instance variables must have the exact same name as the cmp fields
3. The class must be public, not abstract, and must have a public constructor (no args)
4. The class must implement java.io.Serializable
5. It must have public accessor methods for the public fields

I have a question (the spec is not clear about this):

It seems that the container uses reflection on the public instance fields to set and get values of the primary key and NOT the accessor methods (set/get methods) . Is this correct ?

Is it then also correct to say that the name of the accessor methods is not important ?

for example:

If I declare an entity bean in the ejb-jar file with the cmp field 'name'. The bean class will have 2 abstract methods 'setName' and 'getName'. The primary key class will have a public instance variable 'name'. The accessor methods of the primary key class can for instance be; getNamePK and setNamePK...
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic