I've recently come across a legacy code base that uses a slightly dated version of Hibernate. The codebase uses the good old [HibernateUtil][1]
pattern. One thing I find really odd is that every entity class has a create()
,read()
, save()
, and update()
method. All of these method are static and make calls to the static methods on the home-grown HibernateUtil class.
I don't like this pattern from a maintainability perspective and a few other obvious reasons, but I do recall this type of pattern to be a Hibernate, or EntityManager anti-pattern. But for the life of me, I can't find any specific details on why it's bad. I vaguely recall some issues with transaction semantics, etc., but cannot recall. Does anyone recall why this is/was considered a bad design pattern?