Search code examples
javahibernatepojo

Overload Hibernate mapping POJO's


Is it possible to overload Hibernate POJO's in order to put the dirty code there? To make it clear I want to pass the data from a my form as strings and do all the parsing and converting stuff on these POJO's.Or is there any alternative approach to do it?

Thanks


Solution

  • You can use DTO objects to represent the data in your form, and use strings for all properties. Then on the server side you can use a static class that converts the DTO object into a POJO that is mapped to the database with Hibernate. That way, you can keep the POJO's clean.