Tag: Hibernate

  • Hibernate & UserType: How to persist JSON objects

    A Hibernate UserType defines a (custom) way how to save Java objects into the database. Basically, it defines how the object is serialized to be persisted in the database and how the object is (re)created from the serialized data stored in the database. Here is a UserType that I’ve written to persist objects of type […]

  • Hibernate interceptors: Update entity’s properties “on update” and “on save”

    An Hibernate interceptors provides a highly flexible way to hook into the session’s life-cycle to invoke your custom methods at particular session states, like before an entity is persisted and/or updated. Specially in multi-tier applications interceptors can be useful to plug in (entity) functionalities on a very clear way instead of scattering them through the […]