• 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
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

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.
 
I don't get it. A whale wearing overalls? How does that even work? It's like a tiny ad wearing overalls.
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic