java - ConstraintViolationException JPA -



java - ConstraintViolationException JPA -

i'm trying add together info database using jpa entity @sequencegenerator. appears genereator doesnt expected , have no clue why.

hibernate: phone call next value seq1 hibernate: insert client (firstname, surname, code, customertype, id) values (?, ?, ?, ?, ?) 13:20:36,078 error sqlexceptionhelper:147 - integrity constraint violation: not null check constraint; sys_ct_10093 table: client column: first_name

heres model class :

@entity public class client { @id @sequencegenerator(name = "my_seq", sequencename = "seq1", allocationsize = 1) @generatedvalue(strategy = generationtype.sequence, generator = "my_seq") private long id; public string firstname; public string surname; public string code; public enum customertype{private, corporate}; @enumerated(enumtype.string) public customertype customertype;

servlet phone call save method

protected void doget(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { new sqlexecutor().execute("/schema.sql"); client customer = new customer(); customer.setfirstname("peeter"); new customerdao().save(customer);

that has nil generator. error message extremely clear:

not null check constraint; sys_ct_10093 table: client column: first_name

so, you're trying insert row in client table, has not null column named first_name, , no value provided. constraint violation exception.

the sql statement is

insert client (firstname, surname, code, customertype, id)

so, see, there no value inserted first_name.

that shows table has column named firstname, , 1 named first_name. that's not idea.

java servlets jpa

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -