concept UserType in category hibernate

appears as: UserType
Java Persistence with Hibernate, Second Edition

This is an excerpt from Manning's book Java Persistence with Hibernate, Second Edition.

  • UserType—You can transform values by interacting with the plain JDBC PreparedStatement (when storing data) and ResultSet (when loading data). By implementing this interface, you can also control how Hibernate caches and dirty-checks values. The adapter for MonetaryAmount has to implement this interface.
  • CompositeUserType—This extends UserType, providing Hibernate with more details about your adapted class. You can tell Hibernate that the Monetary-Amount component has two properties: amount and currency. You can then reference these properties in queries with dot notation: for example, select avg(i.buyNowPrice.amount) from Item i.