Add Jackson as dependency to your project
Include the Jackson UserType implementation
Here is the code in charge of handling the marshall/unmarshall of JSON to Java and vice versa. It implements ParameterizedType to allow parameterization of the mapping file. This implementation supports LONGVARCHAR, CLOB and BLOB.
Define the hbm file to instruct Hibernate how to map the defined class to the database table
Below is an example of mapping file for the Person java class. As you can see it contains the status property of type EnumType (provided by Hibernate) and our JSONUserType config property. Parameter classType is the mapped POJO and type is the CLOB column type constant (see class java.sql.Types for more details on constant field values).comments powered by Disqus