How to Use Customized Type in Object Relational Mapping
When defining class model for your persistent layer, a class is defined as part of the static data model instead of controller or user interface items. And the class is directly mapped to table(s) in your database. As the class is mapped to tables, its attributes is also mapped to columns in table. In order to make the mapping work, you have to model attributes with primitive types like integer, boolean, String, etc. You cannot model the attribute as any other types which are not compatible with database.
To overcome this, you can make use of ORM User Type to define customized datatype for attributes, and persistent its value into database. This article will teach you how to use ORM User Type. Read more