Wednesday, May 8, 2013

Enable localhost phpmyadmin to login

Set the config.php under phpmyadmin folder to this


Catch ConstraintViolationException in Hibernate and get the Error message

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.