I have started preparing jpa cert and going through pro jpa 2 book.
While going through field access, it says about entity class "all filed must be declared as either protected, package or private.Public fields are disallowed"
But then I ran a sample application making the fields as public and I am able to persist the record. so confused, please can someone clarify.
I suspect this is a case of the JPA provider not implementing that part of the specification. It's not good practice to make the fields public though, so I recommend you don't (even though your provider isn't forbidding it.) If you make it public, other code could make changes without the entity being aware.
Thanks a lot for your reply, I am using hibernate, but is it possible hibernate is not implementing that portion of spec, I am not sure. please could you clarify..
and that's correct that I should not use public, I was just playing around because it was written that public is not allowed but it is still working....