Ralph,
The Eclipse warning is a valid point, but the reality is that in the
face of a call to Hibernate and probably out to the database, the extra
overhead of the synthetic accessor method is going to be completely
inconsequential...
Regards,
Colin
Ralph Schaer wrote:
>Hello
>
>I often have this sort of code in my dao's:
>
> HibernateCallback callback = new HibernateCallback() {
>
> public Object doInHibernate(Session session) throws HibernateException {
> Criteria criteria = getHibernateTemplate().createCriteria(session, User.class);
> criteria.add(Expression.eq("userName", userName));
> if (id != null) {
> criteria.add(Expression.not(Expression.eq("id", id)));
> }
> return criteria.list();
> }
> };
>
>Now Eclipse complains with this warning message:
>Access to enclosing method getHibernateTemplate() from the type
>HibernateDaoSupport is emulated by a synthetic accessor method.
>Increasing its visibility will improve your performance
>
>That's because getHibernateTemplate() is protected.
>
>Regards
>Ralph
>
>
|