OK, I didn't know that! In which case there's no reason why at least the getters can't be public. I'll get round to changing them at some point...
mark.schrei...@novartis.com wrote: > > Are you sure about that? Under the JPA spec (which Hibernate can comply > with) the primary key is often public and settable. I don't think > Hibernate gets confused if you change it but I suspect the programmer > might. > > There are cases where you would want to set it. For example you > retrieve record 1 change a few fields and then change the PK to 2 and > then persist it back. You now have two separate records. Effectively a > template copy. If you have auto PK generation you can simply make the PK > = null and let the DB find a new PK for you. > > Yes it can be a little bit dangerous if you don't think about it but it > probably doesn't need to be private. > > Even if it is can't there be a public getter? > > - Mark > > biojava-l-boun...@lists.open-bio.org wrote on 12/12/2008 12:28:11 AM: > >> The rationale was to prevent it being changed by the programmer, because >> if that happens then Hibernate gets seriously confused (it relies on the >> PKs remaining constant whilst an object is in memory). >> >> Hilmar Lapp wrote: >> > >> > On Dec 11, 2008, at 10:02 AM, Richard Holland wrote: >> > >> >> Yes, the bioentry_id is private. >> > >> > >> > What's the rationale for that? It's the primary key; why should it be >> > forbidden to view it, even for derived classes? >> > >> > (For a Bioperl-db persistent object, the primary key is public and >> > always accessible as $pobj->primary_key(). It can even be changed by the >> > programmer, though of course you should know what you're doing when you >> > decide to do that.) >> > >> > -hilmar >> >> -- >> Richard Holland, BSc MBCS >> Finance Director, Eagle Genomics Ltd >> M: +44 7500 438846 | E: holl...@eaglegenomics.com >> http://www.eaglegenomics.com/ >> _______________________________________________ >> Biojava-l mailing list - Biojava-l@lists.open-bio.org >> http://lists.open-bio.org/mailman/listinfo/biojava-l > > _________________________ > > CONFIDENTIALITY NOTICE > > The information contained in this e-mail message is intended only for > the exclusive use of the individual or entity named above and may > contain information that is privileged, confidential or exempt from > disclosure under applicable law. If the reader of this message is not > the intended recipient, or the employee or agent responsible for > delivery of the message to the intended recipient, you are hereby > notified that any dissemination, distribution or copying of this > communication is strictly prohibited. If you have received this > communication in error, please notify the sender immediately by e-mail > and delete the material from any computer. Thank you. -- Richard Holland, BSc MBCS Finance Director, Eagle Genomics Ltd M: +44 7500 438846 | E: holl...@eaglegenomics.com http://www.eaglegenomics.com/ _______________________________________________ Biojava-l mailing list - Biojava-l@lists.open-bio.org http://lists.open-bio.org/mailman/listinfo/biojava-l