I am developing a Java desktop app and I'm using Hibernate on it. In the documentation of Session#save() it only returns Serializable and I have to get a response object when it throws an exception during save call. Heres what I did.
I enclose it with a try catch, and when it receives an exception just get the ConstraintViolationException#getMessage(1) object of it. You can directly return the Object or encapsulate it with your custom object.
No comments:
Post a Comment