Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2009
    Posts
    16
    Rep Power
    0

    Default Entity - Field-Based Access Vs Property Based Access

    P-230 of EJB3 In Action Book states "If you want to use field-based access, you can declare all your POJO persisted
    data fields public or protected"
    P-231
    "Even if you used field-based access, we recommend that you make the fields private and expose the fields to be modified
    by getter/setter method."

    The above 2 statements are contradictory... Can we mark our fields private and use them for field-based access ?

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    Why do you think they are contradictory? you can declare does not mean you must declare ...

  3. #3
    Join Date
    Oct 2009
    Posts
    16
    Rep Power
    0

    Default

    I take my words back.. The statements are not contradictory. Rather the first statement is misleading. It doesn;t mention that even field based can be private..

  4. #4
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    Quote Originally Posted by CatchSandeepVaid View Post
    I take my words back.. The statements are not contradictory. Rather the first statement is misleading. It doesn;t mention that even field based can be private..
    Because the next page mentions that explicitly and recommends it as the best practice.

Similar Threads

  1. i need an example of JSR179 ((Location based Ser)implementation for CDC based device
    By talk_to_vivekmishra in forum CDC and Personal Profile
    Replies: 3
    Last Post: 12-30-2010, 10:07 AM
  2. Method access or field access
    By carderne in forum New To Java
    Replies: 2
    Last Post: 12-06-2008, 06:20 PM
  3. Replies: 1
    Last Post: 08-07-2007, 07:51 AM
  4. Replies: 1
    Last Post: 07-23-2007, 11:59 PM
  5. Create entity field SEQUENCE oracle
    By Marcus in forum JDBC
    Replies: 1
    Last Post: 06-27-2007, 03:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •