java - Which field or property is causing the exception to occur in JPA/Hibernate? -


i use jpa/hibernate persisting data, , example, have class named 'book' 'isbn' field uniqe , 'page' int.

when user set fields mistake data (duplicate number isbn or string page), , when use session.save(book1) persist entity, exception thrown.

i want show user source of problem. example, change background of jtextfieldisbn red.

now, field causing exception occur? in other words, how understand field mistake , cause exception?

you should getting nonuniqueexception case of duplicate fields, other fields recommend validation before persisting in database.

hope helps solve current problem in hand.

cheers !!


Comments