So i have a mysql database with a customer table. The customer table has columns
name, phone, customerId(this is the primary key) and balance.
I have created entity classes and their corresponding session beans. When i try to create a new customer object and set the name and phone and try to persist it, i get an error javax.validation.ConstraintViolationException: Bean validation Constraint(s) violated while executing Automatic Bean Validation on callback event: 'prePersist'. Please refer to embedded ConstraintViolations for details
Well you did not post any of your code so it's hard to give you specifics, but if I had to guess you are probably using validation annotations like @NotNull on your Entity and one of them if failing to validate. For the simple object your described the likely culprit is the id field. Remember the id is a persistent id so it will be null until the object has been persisted (unless you are assigning your own which is uncommon). I would remove any type of validation annotations from the id as these are typically managed by the persistence provider anyway. If that does not work you will need to figure out which validation is failing.