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

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 { 
    ... 
} 
主站蜘蛛池模板: 城口县| 石泉县| 上杭县| 德清县| 迭部县| 辛集市| 文化| 定兴县| 南木林县| 毕节市| 治县。| 江西省| 家居| 皮山县| 保康县| 乌拉特前旗| 逊克县| 华坪县| 丹阳市| 秭归县| 门头沟区| 苍溪县| 静海县| 双鸭山市| 兴义市| 化隆| 龙南县| 澄城县| 平陆县| 广州市| 天水市| 北安市| 盐山县| 秀山| 岗巴县| 富蕴县| 正镶白旗| 明光市| 长岛县| 景德镇市| 沙坪坝区|