I have a User model, the scheme for which looks like this:
# --- First database schema
# --- !Ups
create sequence s_user_id;
create table user (
id bigint DEFAULT nextval('s_user_id'),
firstName varchar(128),
lastName varchar(128),
email varchar(128) unique
);
# --- !Downs
drop table user;
drop sequence s_user_id;
How can I validate the new users instead of just crashing with a
RuntimeException: Exception while executing statement : Unique index or primary key violation:
?
Also, I'm not using any forms or views of any kind. I'm just creating an API...