Mapping a FunctionalJava Option with Hibernate

后端 未结 3 1768
萌比男神i
萌比男神i 2020-12-19 08:46

I have a hibernate-mapped Java object, JKL, which is full of a bunch of normal hibernate-mappable fields (like strings and integers).

I\'m added a new e

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-19 08:58

    You can use Hibernate's custom mapping types. Documentation is here. Here is an analogous example of mapping Scala's Option to a Hibernate mapping.

    Simply put, you would need to extend the org.hibernate.UserType interface. You could also create a generic-typed base class with a JKL-typed sub-type, similar to what you see in the Scala example.

提交回复
热议问题