Multiple Databases with Play Framework 2.1.x
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.default.url="jdbc:postgresql://localhost/db1"
db.default.user=postgres
db.default.password="password"
db.secondary.driver=org.postgresql.Driver
db.secondary.url="jdbc:postgresql://localhost/db2"
db.secondary.user=postgres
db.secondary.password="password"
ebean.default="models.db1.*"
ebean.secondary="models.db2.*"
I have my model classes in those packages, and it DDL generates the tables
properly.
The problem lies in actually working with these entities. Anything not in
the "default" package throws this error (using the Users table in the
secondary database as an example)
[PersistenceException: models.db2.Users is NOT an Entity Bean registered
with this server?]
Even though I am 100% sure that the Users table is there in the backend,
it is a registered table, and the DDL works and makes this table properly.
Is there a certain way I need to query model classes that aren't in the
default package?
No comments:
Post a Comment