Storing a List as JSON in a text field with Hibernate

前端 未结 2 2051
春和景丽
春和景丽 2020-12-17 01:49

I have something like the following model in Hibernate:

class Person {
    String name;
    List
addresses; } class Address { String stre
2条回答
  •  醉梦人生
    2020-12-17 02:16

    I haven't tried myself but here is a blog which is worth referring to... https://dzone.com/articles/annotating-custom-types

    Which basically suggests you to add a custom annotation. The annotated class for example call it "AddressJSONParser" should convert your Address object to JSON (using parser's) and returns as String. You should also a think about having a parser which does the reverse, from JSON string back to Address object...

提交回复
热议问题