05 June 2011

How to debug the root cause for AssertionFailure: null id in entry (don't flush the Session after an exception occurs)

To figure out the real (root) cause of the error, please use the following snippet

     ClassValidator cv = new ClassValidator(YourEntity.class);
                    InvalidValue[] validationMessages = cv.getInvalidValues(yourInstanceOfEntity);
                    if (validationMessages.length > 0) {
                        for (InvalidValue iv : validationMessages) {
                            System.out.println("Invalid value::" +iv.getMessage()+"::"+iv.getPropertyName()+"::"+iv.getValue());
                        }
                    }