• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Primary key and reflection

 
Jim Janssens
Ranch Hand
Posts: 210
  • Mark post as helpful
  • send pies
  • 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...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic