title: Why getting ____ cannot be null
body: <p>I'm on learning stage and just start making little app contains single entity. While test on postman I keep getting an error:
  Column 'account_number' cannot be null
  Although I enter accountNumber.
  I follow entity &amp; related classed hereunder:
  My excuse if I make something missing due to lack of knowledge. Grateful for an advise</p>
  <p>PrimaryAccount</p>
  <pre><code>@Entity
  @Table(name = &quot;primary_account&quot;)
  public class PrimaryAccount {
  @Id
  @GeneratedValue(strategy = GenerationType.AUTO)
  @Column(name = &quot;id&quot;)
  private Long id;
  @Column(name = &quot;account_number&quot;)
  private String accountNumber;
  @Column(name = &quot;account_balance&quot;)
  private BigDecimal accountBalance;
  @OneToMany(mappedBy = &quot;primaryAccount&quot;, cascade = CascadeType.ALL, fetch = FetchType.LAZY)
  @JsonIgnore
  private List&lt;PrimaryTransaction&gt; primaryTransactionList;
  Getter&amp;Setting&amp;Constructor
  </code></pre>
  <p>AccountService</p>
  <pre><code>public interface AccountService {
  ResponseEntity&lt;String&gt; createPrimaryAccount();
  }
  </code></pre>
  <p>AccountServiceImpl</p>
  <pre><code>@Service
  public class AccountServiceImpl implements AccountService {
  
  @Autowired
  private PrimaryAccountDao primaryAccountDao;
  
  public ResponseEntity&lt;String&gt; createPrimaryAccount() {
      PrimaryAccount primaryAccount = new PrimaryAccount();
      primaryAccount.setAccountNumber(primaryAccount.getAccountNumber());
      primaryAccount.setAccountBalance(primaryAccount.getAccountBalance());
      primaryAccountDao.save(primaryAccount);
      return ResponseEntity.ok(&quot;Record entered&quot;);
  }
  </code></pre>
  <p>@Controller
  public class AccountController {</p>
  <pre><code>@Autowired
  private AccountService accountService;
  
  @PostMapping(&quot;/primaryAccount&quot;)
  public ResponseEntity&lt;String&gt; primaryAccount(PrimaryAccount primaryAccount) {
      return accountService.createPrimaryAccount();
  }
  </code></pre>
  <p>PrimarAccountDao</p>
  <pre><code>public interface PrimaryAccountDao extends CrudRepository&lt;PrimaryAccount, Long&gt; {
     PrimaryAccount findByAccountNumber (long accountNumber);
  }
  </code></pre>
  <p>on postman side I just make as follow:</p>
  <pre><code> {
      &quot;AccountNumber&quot;: &quot;89000&quot;,
      &quot;AccountBalance&quot;: 2000.00
  }
  </code></pre>
  <p>Error:</p>
  <pre><code>java.sql.SQLIntegrityConstraintViolationException: Column 
  'account_number' cannot be null
  at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException
  (SQLError.java:117) ~[mysql-connector-java-8.0.26.jar:8.0.26]
  at 
  com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException
  (SQLExceptionsMapping.java:122) ~[mysql-connector-java-8.0.26.jar:
  8.0.26]at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal
  (ClientPreparedStatement.java:953) ~[mysql-connector-java- 
  8.0.26.jar:8.0.26]
  at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal
  (ClientPreparedStatement.java:1092) ~[mysql-connector-java- 
  8.0.26.jar:8.0.26]
  at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal
  (ClientPreparedStatement.java:1040) ~[mysql-connector-java- 
  8.0.26.jar:8.0.26]
  at com.mysql.cj.jdbc.ClientPreparedStatement.executeLargeUpdate
  (ClientPreparedStatement.java:1350) ~[mysql-connector-java- 
  8.0.26.jar:8.0.26]
  at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdate
  (ClientPreparedStatement.java:1025) ~[mysql-connector-java- 
  8.0.26.jar:8.0.26]
  at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeUpdate
  (ProxyPreparedStatement.java:61) ~[HikariCP-4.0.3.jar:na]
  at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeUpdate
  (HikariProxyPreparedStatement.java) ~[HikariCP-4.0.3.jar:na]
  at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.
  executeUpdate(ResultSetReturnImpl.java:197) ~[hibernate-core- 
  5.4.32.Final.jar:5.4.32.Final]
  at org.hibernate.persister.entity.AbstractEntityPersister.insert
   (AbstractEntityPersister.java:3298) ~[hibernate-core- 
   5.4.32.Final.jar:5.4.32.Final]
  at org.hibernate.persister.entity.AbstractEntityPersister.insert
  (AbstractEntityPersister.java:3825) ~[hibernate-core- 
  5.4.32.Final.jar:5.4.32.Final]
  at org.hibernate.action.internal.EntityInsertAction.execute
  (EntityInsertAction.java:107) ~[hibernate-core- 
  5.4.32.Final.jar:5.4.32.Final]
  at 
  org.hibernate.engine.spi.ActionQueue.executeActions
  (ActionQueue.java:604) 
  ~[hibernate-core-5.4.32.Final.jar:5.4.32.Final]
  at org.hibernate.engine.spi.ActionQueue.lambda$executeActions$1
  (ActionQueue.java:478) ~[hibernate-core- 
  5.4.32.Final.jar:5.4.32.Final]
  at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:684) 
  ~ na:na]
  at org.hibernate.engine.spi.ActionQueue.executeActions
  (ActionQueue.java:475) ~[hibernate-core- 
  5.4.32.Final.jar:5.4.32.Final]
  at org.hibernate.event.internal.AbstractFlushingEventListener.
  performExecutions(AbstractFlushingEventListener.java:344) ~ 
  [hibernate- 
  core-5.4.32.Final.jar:5.4.32.Final]
  at org.hibernate.event.internal.DefaultFlushEventListener.onFlush
  (DefaultFlushEventListener.java:40) ~[hibernate-core- 
  5.4.32.Final.jar:5.4.32.Final]
  at org.hibernate.event.service.internal.EventListenerGroupImpl.
  fireEventOnEachListener(EventListenerGroupImpl.java:99) ~[hibernate- 
  core-5.4.32.Final.jar:5.4.32.Final]
  at org.hibernate.internal.SessionImpl.doFlush
  (SessionImpl.java:1362) ~[hibernate-core- 
   5.4.32.Final.jar:5.4.32.Final]
  at 
  org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:453) 
  ~[hibernate-core-5.4.32.Final.jar:5.4.32.Final]
  at 
  org.hibernate.internal.SessionImpl.flushBeforeTransactionCompletion
  (SessionImpl.java:3212) ~[hibernate-core- 
  5.4.32.Final.jar:5.4.32.Final]
  at org.hibernate.internal.SessionImpl.beforeTransactionCompletion
  (SessionImpl.java:2380) ~[hibernate-core- 
   5.4.32.Final.jar:5.4.32.Final]
  at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.
  beforeTransactionCompletion(JdbcCoordinatorImpl.java:448) ~ 
  [hibernate- 
  core-5.4.32.Final.jar:5.4.32.Final]
  at org.hibernate.resource.transaction.backend.jdbc.internal.
  JdbcResourceLocalTransactionCoordinatorImpl.beforeCompletion
  Callback(JdbcResourceLocalTransactionCoordinatorImpl.java:183)
  ~[hibernate-core-5.4.32.Final.jar:5.4.32.Final]
  at org.hibernate.resource.transaction.backend.jdbc.internal.
  JdbcResourceLocalTransactionCoordinatorImpl.access$300
  (JdbcResourceLocalTransactionCoordinatorImpl.java:40) ~[hibernate- 
  core- 
  5.4.32.Final.jar:5.4.32.Final]
  at org.hibernate.resource.transaction.backend.jdbc.internal.
  JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriver
  ControlImpl.commit(JdbcResourceLocalTransactionCoordinatorImpl.
  java:281) 
   ~[hibernate-core-5.4.32.Final.jar:5.4.32.Final]
  at org.hibernate.engine.transaction.internal.TransactionImpl.commit
  (TransactionImpl.java:101) ~[hibernate-core- 
   5.4.32.Final.jar:5.4.32.Final]
  at org.springframework.orm.jpa.JpaTransactionManager.doCommit
  (JpaTransactionManager.java:562) ~[spring-orm-5.3.10.jar:5.3.10]
  at 
   org.springframework.transaction.support.AbstractPlatformTransaction
  Manager.processCommit(AbstractPlatformTransactionManager.java:743) ~ 
   [spring-tx-5.3.10.jar:5.3.10]
  </code></pre>