I doubt. I think they are just warning you that a public method might be
accidentally called and the PK value changed by a client code. If they allow PK
change, you might get a corrupted data. Did you try to ask on the Hibernate site?
thanks,
-marina
Kem Elbrader wrote:
> Is there a reason to set them as protected? Netbeans 6M10 warns that
> it should be protected. I suspect that the warning is specific to
> Hibernate. Is this true.
>
> On 7/5/07, Marina Vatkina <Marina.Vatkina_at_sun.com> wrote:
>
>> Another option would be to use a constructor that takes the id value, to
>> populate the id field (in addition to the default constructor), and do
>> not have
>> a setter at all if you are using field-based access.
>>
>> Regards,
>> -marina
>>
>> Gordon Yorke wrote:
>> > That really depends on your application. If you are using
>> sequencing only then setting the visibility to protected would be
>> fine. Some applications however have natural Ids or Ids provided by
>> the application in this case the setter method should be public.
>> > --Gordon
>> >
>> > -----Original Message-----
>> > From: Kem Elbrader [mailto:kem.elbrader_at_gmail.com]
>> > Sent: Tuesday, July 03, 2007 10:12 PM
>> > To: persistence_at_glassfish.dev.java.net
>> > Subject: Visibility of setter method for id field
>> >
>> >
>> > Should the setter method for the id field be protected?
>>