I have added a unique constraint to a field in ROO generated entity as shown below -
Code:@RooJavaBean @RooToString @RooEntity(finders = { "findEmployeesByEmployee_id" }) public class Employee { @Column(unique=true) private Integer employee_id;
Now, when I try to insert same employee_id twice , the following stack message with full stack trace is thrown on user screen -
On the same time, in apache log, it says -Code:org.hibernate.exception.ConstraintViolationException: could not insert: [com.kreativ.kerp.domain.Employee]; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: could not insert: [com.kreativ.kerp.domain.Employee]
How can I print some useful message to user that this id must be unique instead of showing full stack trace.Code:2012-03-12 15:57:18,395 [http-8080-1] ERROR org.hibernate.util.JDBCExceptionReporter - Duplicate entry '1' for key 'employee_id'


Reply With Quote
, i would like to know it

