How to connect to multiple databases in Hibernate

后端 未结 6 813
长发绾君心
长发绾君心 2020-11-27 16:37

I am new bee to Hibernate and trying out things. One thing that seems to amuse all is how to connect to different databases? I have two questions here:

  1. If in t
6条回答
  •  日久生厌
    2020-11-27 17:26

    You can connect two databases test1 and test2, retrieve data with only one hibernate with some tricks:

    • hibernate SQLQuery: just add database name with the table "select * from test1.table1", "select * from test2.table2"

    • hibernate persistence: using the key schema in the hibernate mapping xml

提交回复
热议问题