简体   繁体   中英

How to rename the column names - JPA Hibernate

Is it possible to rename the column names inside a database just by changing the entity in Spring Frameworks JPA Hibernate?

Assume that I have created the table MyDatabase and its columns. But I want to change these without erase the rows inside the table. How can I do that?

@Getter
@Setter
@Entity
public class MyDatabase{

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long id;

    private String Ordernummer;
    private String VentilNamn;
    private String SerieNummer;

}

Yes, with @Column .

For example:

@Entity
public class Foo {

    // id etc

    @Column(name = "my_column_name")
    private String column;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM