If your toString method ends up calling some of the entity state (likely), the 
initialization won't be triggered since you will call your getters from inside 
the instance. So it's a good general rule to mandate non final methods on 
entities.

Emmanuel

On 8 juil. 2011, at 09:59, Robin Sander wrote:

> 
> Hi all,
> 
> excuse me if this list isn't indented for such a question, but I asked this 
> question about a year ago in the forums
> without any answers and I think it should be easy to answer for any Hibernate 
> core developer:
> 
> According to Hibernate's (3.6.5) reference documentaion (Section 21.1.3, 
> Single-ended association proxies),
> such a single-ended association proxy can't be constructed by Hibernate if it 
> contains "any final methods".
> 
> My question is, does this restriction apply to getters/setters of persistent 
> fields only or really to any method in an entity class?
> As far as I can see Javassist is able to modify final methods as well and 
> even if it were not, why should a method like
> public final String toString() {
>   return "...";
> }
> prevent Hibernate from using a proxy?
> 
> Thanks in advance,
> 
> Robin.
> 
> 
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev


_______________________________________________
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev

Reply via email to