java - Mapping Multiple tables to Single Entity -


i have database contains multiple tables generated on per month basis. e.g

transaction_01_2014 transaction_02_2014 transaction_03_2014 . . . transaction_12_2014 

all tables have same structure. difference month , year appended @ end.

is possible map these tables single @entity class "transaction" in hibernate? if yes, need change configurations? if not possible way, how should operate on these tables in subtle , simple manner, java application?

cheers!

yes. can map multiple tables single @entity class using @mappedsuperclass annotation. creating super annotation & inheriting it's feature sub-classes different tables in @table annotation. but, in case problem of normalization arises.

or

you can use @secondarytable annotation allows specify 1 or more secondary tables indicating data entity class stored across multiple tables.

for more information :

  1. @mappedsuperclass - java doc example
  2. @secondarytable - java doc example
  3. tutorial - map 1 pojo multiple tables

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -