Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
Setup I have a database table with field of JSONB type. I access said database using Hibernate. In hibernate I have entity mapped on said table. Entity contains field marked with @JdbcTypeCode(...
#1: Initial revision
LocalDate format in fields stored as json via Hibernate
### Setup I have a database table with field of `JSONB` type. I access said database using `Hibernate`. In hibernate I have entity mapped on said table. Entity contains field marked with `@JdbcTypeCode(SqlTypes.JSON)` annotation. It have type of some DTO. In that DTO I have a field of type `LocalDate`. ### Problem When I store my entity `LocalDate` serialized to json as array `[2000, 1, 1]`. I want to have it as string `2000-01-01`. How can I configure json serialization Hibernate uses? ### Code ``` @Entity public class E { @Id int id; @JdbcTypeCode(SqlTypes.JSON) Dto jsonValue; } public class Dto { LocalDate myDate; }