-1

I am receiving jpa object from db using springboot and mapping it to model but the column name in model is different than the one coming from database.

I tried to setter to set the value of model field from the incoming database attribute but the attribute is in parent class and hence it is always set as null.

1 Answers1

1

Suppose your field has the name foo you can use the @Column annotation to declare a db column with a different name so

class Model {
    // other fields
    @Column(name = "bar")
    private int foo;
}
Valerij Dobler
  • 1,848
  • 15
  • 25