开发者

Set schema name for specific table mappings using JPA

开发者 https://www.devze.com 2023-03-21 18:48 出处:网络
We are using JPA (hibernate) and have certain tables in a specific schema. I know schema names can be set in the ORM mapping file 开发者_运维问答for a given persistence unit but we have a need to set

We are using JPA (hibernate) and have certain tables in a specific schema. I know schema names can be set in the ORM mapping file 开发者_运维问答for a given persistence unit but we have a need to set the schema name for only certain object mappings. So the question is: is there a way in JPA to set the schema name for specific object mappings and not for all object mappings, using a single persistence unit?


To map an entity with the table & some specific schema, you can use attributes name & schema of the table annotaion.

@Entity
    @Table(name="PERSON", schema="RECORDS")
    public class Person { ... }
0

精彩评论

暂无评论...
验证码 换一张
取 消