From the official documentation of sleep mode :
@ org.hibernate.annotations.Type overrides the default hibernation type used: this is usually not required since the type is correctly inferred by Hibernate
The documentation has an example:
@Type(type="org.hibernate.test.annotations.entity.MonetaryAmountUserType") @Columns(columns = { @Column(name="r_amount"), @Column(name="r_currency") }) public MonetaryAmount getAmount() { return amount; }
I do not understand this. We declare @Type(type="org.hibernate.test.annotations.entity.MonetaryAmountUserType") , but the return value of the method is of type MonetaryAmount .
I expected that the type declared in the type annotation and the return type should be of the same type.
Could someone @Type explain the actual type targets declared in the @Type annotation. Why is it different from the return type?
source share