Set schema name for specific table mappings using JPA
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 { ... }
精彩评论