There's a column in our database which needs to be of type YEAR
. What is the corresponding Hibernate mapping for the entity? Tried searching all over, but unable to find the details. I am not sure if I need to use anything from @Temporal
or any other specific type. We are using Hibernate ORM v4.1.7.
You can write a Hibernate UserType that takes an Integer to a MySQL YEAR column.
Check for example Joda Hibernate UserTypes which are a good starting point for your custom Hiberante type.
我可以确认,截至 2022 年 6 月,您需要将 MySQL Year数据类型映射到 Hibernate 中的Integer数据类型。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.