This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Mastering Corda: Blockchain for Java Developers and have Jamiel Sheikh on-line!
See this thread for details.
Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

HF Pg 333 Regarding the Primary Key Class

 
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the properties list of the primary class it says that "the fields in the bean class must have public accessor methods". The EJB spec 10.8 wherein describes the properties of the primary key class does not list this property. Is it valid?
 
stable boy
Posts: 425
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not too sure what the book has written down.
But think about it, it is the container who will use your primary key class. If the properties that make up your primary key are not public available to the container how can the container access these properties?
Maybe there is a slight confusion what we mean with properties here! Example: You can uniquely identify a row in your database by 2 columns, let's say: firstname and lastname. This means that your primary key class will have 2 persistent fields firstname and lastname, we refer to them as properties.
It is not only the properties of the primary key class that has to be public accessible to the container but the whole class has to be defined as public and has to be serializable.
Hope this helps.
 
Sudhir V
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But the book says "public accessor methods". I know that that fields have to be declared public but it is not mandatory that they have public accessor methods. i.e. if there is a field called lastname then it is not mandatory to have public string getlastname() method to access that field.
 
reply
    Bookmark Topic Watch Topic
  • New Topic