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 :
Comments
Post a Comment