Reputation: 12311
Lets say I have an JPA entity. As far I know it is related to exactly 1 DB-table.
@Entity
@Table(name = "ARTICLES")
public class Article
//...
Is it possible to have 1 entity but the table-name would be a parameter I can specify at runtime?
So multiple tables would exist - all with the same layout.
Upvotes: 0
Views: 325
Reputation: 18899
JPA is based on ORM (Object Relational Mapping). It is used to map a java object to a database table.
Your requirement if understood well is 1 java object but multiple tables. I think that this goes out of JPA scope. Even if you provided the name of the table during runtime, what would be the java object that would be mapped ?
That would be achievable with raw JDBC though.
Upvotes: 1