官术网_书友最值得收藏!

Table mapping

By default, an entity class is mapped to a table with the same name as the class. However, there are cases when you need to modify this default name for one of the following reasons:

  • You need to use a custom name for a neater database design.
  • You have to map it to an existing table in a legacy database.
  • Your entity name is a SQL reserved keyword, for example, User. You are forced to modify the table name, otherwise you will end up with a runtime error.

The @Table annotation is used to customize the table name as in the following example:

@Entity 
@Table(name = "movies") 
public class Movie { 
    ... 
} 
主站蜘蛛池模板: 桓台县| 健康| 汪清县| 兴山县| 龙江县| 屏山县| 丰顺县| 华阴市| 岢岚县| 获嘉县| 越西县| 汾阳市| 西充县| 菏泽市| 通渭县| 天祝| 新平| 香河县| 岳池县| 五华县| 随州市| 义马市| 清丰县| 清徐县| 冀州市| 犍为县| 宣城市| 双江| 白朗县| 福贡县| 平邑县| 平潭县| 扶绥县| 新绛县| 乌兰察布市| 广德县| 扶绥县| 日照市| 乌拉特中旗| 辽阳县| 孟州市|