Regular |
|
Joined: Tue Sep 09, 2003 9:37 pm Posts: 56 Location: Ogden, Utah, USA
|
Using: Hibernate 4.3.5, MS SQL Server
What is the best way to use the JPA @Column length information to validate the data length at the time of persistence?
I've read countless messages that suggest 1) validate in the UI 2) validate in your setter
My goal is not validation. My goal is giving the developer better feedback. Currently, if you are persisting an object with 100+ data elements and you get an error, it says 'data will be truncated' (Using Microsoft SQL Server). It does not specify which column is too long, and is generally unhelpful.
I would like to use the hibernate framework annotation information to produce a more useful exception.
Can this be done via custom user type? Is the length stored at all, or must it be retrieved via annotation reflection?
Thanks for any advice, Jenica
|
|