Multiple Databases with Play Framework 2.1.x

后端 未结 3 460
面向向阳花
面向向阳花 2020-12-28 08:52

I have 2 databases that I need to connect to. I can easily connect to them in the application.conf file like so:

db.default.driver=org.postgresql.Driver
db.d         


        
3条回答
  •  粉色の甜心
    2020-12-28 09:23

    Ok, your application.conf seems to be correct.

    You may use the secondary server like this:

    EbeanServer secondary = Ebean.getServer("secondary");
    secondary.find(User.class).findList();
    

    Once you've got your secondary server, you may treat it just as you treat the Ebean singleton.

提交回复
热议问题