#Spring, JPA, Hibernate converter support
1 messages · Page 1 of 1 (latest)
<@&1004656351647117403> please have a look, thanks.
Here is an AI assisted attempt to answer your question 🤖. Maybe it helps! In any case, a human is on the way 👍. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.
a custom converter or if it is already supported out of the box.
In Spring Data JPA, you can check the list of supported converter types in the official documentation. By default, Spring Data JPA provides converters for commonly used Java types like LocalDate, LocalDateTime, and Enum types.
For Hibernate, you can refer to the Hibernate documentation to see which types are supported for conversion out of the box. Hibernate also provides built-in converters for common Java types like Date, Calendar, and BigDecimal.
If the type you want to store (e.g., YearMonth) is not supported by default in either Spring Data JPA or Hibernate, you can create a custom converter to handle the conversion. To create a custom converter in Spring Data JPA, you can implement the AttributeConverter interface and annotate it with @Converter. In Hibernate, you can use UserType or AttributeConverter interface to create your custom converter.
Overall, checking the official documentation for both Spring Data JPA and Hibernate is key to understanding which types are supported for conversion and whether you need to create a custom converter for your specific use case.
You mean the automatic parsing of columns into specific types?
You can look it up in the appropriate JDBC driver
ResultSet has getObject methods, which accepts a Class you want to deserialize into
then, look up the subclass from your JDBC driver and what it does
for, example, for Postgres:
this is consistent with what javadoc on getObject says