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

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 { 
    ... 
} 
主站蜘蛛池模板: 博爱县| 惠水县| 定结县| 阿瓦提县| 成武县| 三明市| 宁强县| 揭西县| 桂阳县| 武胜县| 苗栗市| 淮阳县| 广宗县| 仙游县| 洛川县| 阿拉善左旗| 房产| 东台市| 霍山县| 岑溪市| 镇江市| 桐柏县| 安福县| 巴青县| 牡丹江市| 台江县| 三门峡市| 游戏| 梨树县| 呼和浩特市| 临沧市| 琼结县| 梨树县| 库尔勒市| 金平| 息烽县| 尼玛县| 镇巴县| 卓尼县| 韶山市| 三明市|