I have an Account entity and I'm trying to persist it using save function. My code: 
@Override
public Account createAccount(String pin) {
    Account account = new Account();
    account.setBalance(0L);
    account.setPin(pin);
    return accountRepository.save(account);
}
Now my entity class has an autogenerated field called accountNumber. My entity class: 
@Entity
@Table(name = "accounts")
@Data
public class Account {
    @Column(name = "account_number", length = 32, insertable = false)
    private String accountNumber;
    private Long balance;
}
Now after calling save, the entity returned has accountNumber as null but i can see in the intellij database view that it is actually not null. All the other auto-generated fields like id etc are there in the returned entity just the accountNumber is null. Default value for accountNumber is set in the sql file :
ALTER TABLE accounts
  ALTER COLUMN account_number SET DEFAULT DefaultValueSerializer(TRUE, TRUE, 12);
Here, DefaultValueSerializer is the function which is generating the account number. 
I've tried other solutions available here like using saveAndFlush() etc, nothing worked in my case. What can be an issue? 
 
     
     
    