Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Adding worker: Worker [name=1, passwrod=12, account=Account [username=admin, email=admin@kokade.com, auths=[ROLE_RESTRICTED_USER, ROLE_ADMIN, ROLE_USER]]]
- Reqested to save Worker [name=1, passwrod=12, account=Account [username=admin, email=admin@kokade.com, auths=[ROLE_RESTRICTED_USER, ROLE_ADMIN, ROLE_USER]]]
- But,
- Hibernate: insert into Worker (password, name, account_username) values (?, ?, ?)
- WARN - JDBCExceptionReporter - SQL Error: 0, SQLState: 23502
- ERROR - JDBCExceptionReporter - Batch entry 0 insert into Worker (password, name, account_username) values ('12', NULL, NULL) was aborted. Call getNextException to see the cause.
- WARN - JDBCExceptionReporter - SQL Error: 0, SQLState: 23502
- ERROR - JDBCExceptionReporter - ERROR: null value in column "name" violates not-null constraint
- Any reason why it's trying to insert values= NULL instead of the ones from the object?
- Worker ent. def:
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package com.kokade.data.dataobjects;
- import java.io.Serializable;
- import javax.persistence.Entity;
- import javax.persistence.Id;
- import javax.persistence.ManyToOne;
- /**
- *
- * @author Andrew
- */
- @Entity
- public class Worker extends DomainObject implements Serializable {
- @Id
- @ManyToOne(optional=true)
- private Account account;
- @Id
- private String name;
- private String password;
- public Account getAccount() {
- return account;
- }
- public void setAccount(Account account) {
- this.account = account;
- }
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public String getPassword() {
- return password;
- }
- public void setPassword(String password) {
- this.password = password;
- }
- @Override
- public String toString() {
- return String.format("Worker [name=%s, passwrod=%s, account=%s]", name, password, account);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement