Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

dynamic JPA for the multiple tables having same table structure

 
Raviteja Ka
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have few tables with same table structure like table1, table2..., so can I have one common entity to insert into one of these tables(by providing the table name like table1, table2..) or do I need have individual entities for each table(table1 entity, table2 entity...)?

Can someone provide info on this..
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2535
113
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to Coderanch!

It really depends: is all data related to one Entity? If so, you can always map data to a secondary table by using the @SecondaryTable annotation. You can check the example of JPA Wikibooks here.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic