3.4.3.3. Type
@org.hibernate.annotations.Type overrides the default hibernate type used: this is generally not necessary since the type is correctly inferred by Hibernate. Please refer to the Hibernate reference guide for more informations on the Hibernate types.
@org.hibernate.annotations.TypeDef and @org.hibernate.annotations.TypeDefs allows you to declare type definitions. These annotations can be placed at the class or package level. Note that these definitions are be global for the session factory (even when defined at the class level). Type definitions have to be defined before any usage. If the type is used on a single entity, you can plance the definition on the entity itself. Otherwise, it is recommended to place the definition a the package level since the entity processing order is not guaranteed.
Note
Package level annotations are placed in a file named
package-info.java in the appropriate package. Place your annotations before the package declaration.
When using composite user type, you will have to express column definitions. The
@Columns has been introduced for that purpose.