db2federated-table

How to connect Db2 Federated Views with Hibernate 4?


Can anyone please suggest or help how can we have Hibernate mapping with Federated Views in Db2 Database?

Database_1 : TABLENAME001

Database_2 : FV_XXX_TABLENAME [FV is federated view with Database_1 table TABLENAME001]

Now when I run through normal JDBC like select * from FV_XXX_TABLENAME I get the output. But when I map through Hibernate like @Table(name ="FV_XXX_TABLENAME"), Hibernate throws error as:

"Table Not found: FV_XXX_TABLENAME"


Solution

  • We can connect DB2 Federated Views with Hibernate mapping. I solved the above issue by just removing the "hibernate.hbm2ddl.auto" from the configuration file and Hibernate automatically detected the Federated View tables.