Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
425
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. Adding worker: Worker [name=1, passwrod=12, account=Account [username=admin, email=admin@kokade.com, auths=[ROLE_RESTRICTED_USER, ROLE_ADMIN, ROLE_USER]]]
  2.  
  3. Reqested to save Worker [name=1, passwrod=12, account=Account [username=admin, email=admin@kokade.com, auths=[ROLE_RESTRICTED_USER, ROLE_ADMIN, ROLE_USER]]]
  4.  
  5. But,
  6.  
  7. Hibernate: insert into Worker (password, name, account_username) values (?, ?, ?)
  8. WARN - JDBCExceptionReporter - SQL Error: 0, SQLState: 23502
  9. ERROR - JDBCExceptionReporter - Batch entry 0 insert into Worker (password, name, account_username) values ('12', NULL, NULL) was aborted. Call getNextException to see the cause.
  10. WARN - JDBCExceptionReporter - SQL Error: 0, SQLState: 23502
  11. ERROR - JDBCExceptionReporter - ERROR: null value in column "name" violates not-null constraint
  12.  
  13.  
  14. Any reason why it's trying to insert values= NULL instead of the ones from the object?
  15.  
  16. Worker ent. def:
  17.  
  18.  
  19. /*
  20. * To change this template, choose Tools | Templates
  21. * and open the template in the editor.
  22. */
  23.  
  24. package com.kokade.data.dataobjects;
  25.  
  26. import java.io.Serializable;
  27. import javax.persistence.Entity;
  28. import javax.persistence.Id;
  29. import javax.persistence.ManyToOne;
  30.  
  31. /**
  32. *
  33. * @author Andrew
  34. */
  35.  
  36. @Entity
  37. public class Worker extends DomainObject implements Serializable {
  38. @Id
  39. @ManyToOne(optional=true)
  40. private Account account;
  41.  
  42. @Id
  43. private String name;
  44.  
  45.  
  46. private String password;
  47.  
  48.  
  49.  
  50. public Account getAccount() {
  51. return account;
  52. }
  53.  
  54. public void setAccount(Account account) {
  55. this.account = account;
  56. }
  57.  
  58. public String getName() {
  59. return name;
  60. }
  61.  
  62. public void setName(String name) {
  63. this.name = name;
  64. }
  65.  
  66.  
  67.  
  68. public String getPassword() {
  69. return password;
  70. }
  71.  
  72. public void setPassword(String password) {
  73. this.password = password;
  74. }
  75.  
  76.  
  77. @Override
  78. public String toString() {
  79. return String.format("Worker [name=%s, passwrod=%s, account=%s]", name, password, account);
  80. }
  81.  
  82.  
  83.  
  84.  
  85.  
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement