Closed otaviojava closed 1 year ago
Currently, on the constructor process, there is no convert process.
So, data from the database must be precisely the one from the constructor parameter.
Given an entity:
@Entity public record Book(@Id String id, @Column("name") String name, @Column("author") String author, @Column("year") Year year) { }
When we execute a retrieve:
Template template = container.select(Template.class).get(); Book book = new Book(id, "cool", "Otavio", Year.now()); template.insert(book); Optional<Book> optional = template.find(Book.class, id);
It will return an exception because the field Year is converted to String.
Year
So the class ParameterConverter needs to be smater and converts it before adding on the parameter.
ParameterConverter
Currently, on the constructor process, there is no convert process.
So, data from the database must be precisely the one from the constructor parameter.
Given an entity:
When we execute a retrieve:
It will return an exception because the field
Year
is converted to String.So the class
ParameterConverter
needs to be smater and converts it before adding on the parameter.