- Developing Middleware in Java EE 8
- Abdalla Mahmoud
- 117字
- 2021-07-23 19:24:37
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 { ... }
推薦閱讀
- Raspberry Pi for Python Programmers Cookbook(Second Edition)
- C# 7 and .NET Core Cookbook
- 深入淺出Java虛擬機(jī):JVM原理與實(shí)戰(zhàn)
- Python自動(dòng)化運(yùn)維快速入門
- 前端架構(gòu):從入門到微前端
- Elastic Stack應(yīng)用寶典
- 正則表達(dá)式經(jīng)典實(shí)例(第2版)
- Java 11 Cookbook
- Java Web開發(fā)實(shí)例大全(基礎(chǔ)卷) (軟件工程師開發(fā)大系)
- 實(shí)戰(zhàn)Python網(wǎng)絡(luò)爬蟲
- Learning WordPress REST API
- Learning TypeScript
- Blender 3D Cookbook
- 分布式系統(tǒng)架構(gòu)與開發(fā):技術(shù)原理與面試題解析
- Python人工智能項(xiàng)目實(shí)戰(zhàn)