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

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 { 
    ... 
} 
主站蜘蛛池模板: 柳林县| 康平县| 洞头县| 大理市| 来安县| 平阳县| 西畴县| 叶城县| 延寿县| 莲花县| 连江县| 米脂县| 乡宁县| 昌邑市| 武穴市| 石棉县| 鸡东县| 镶黄旗| 西畴县| 元氏县| 隆林| 金秀| 济源市| 汉沽区| 都江堰市| 三门峡市| 大名县| 钟山县| 宜兰市| 曲松县| 高州市| 漯河市| 奇台县| 屏山县| 改则县| 平定县| 黄陵县| 宁波市| 商丘市| 海淀区| 丹棱县|