Hibernate: how to deal with PropertyAccessException (invalid data)?

Suppose I have an entity with a field of type FOO, but an external process writes the invalid value BAR into the database. So next time I try to read this entity with Hibernate I get an exception like this:

org.hibernate.PropertyAccessException: Could not set field value [BAR] value by reflection

Unfortunately I also get this exception, when I call the method getAllFoo() and the database contains 999 valid entities plus the one invalid entity. I would like to be able to get the 999 valid entities plus a warning of some sort...

Read More »

By: StackOverFlow - Friday, 9 November

Related Posts