0

假设我有一个名为“action”的数据库模式,其中包含“actions”和“actionnotifications”表。然后我有另一个名为“通知”的数据库模式,其中包含“通知”表。

我正在使用 ActiveJDBC 来查询复杂的操作对象。

Action 类(扩展 Model)具有以下注解:@Many2Many(other = Notification.class, join = "actionnotifications", sourceFKName = "actionId", targetFKName = "notificationId")

当我运行以下代码时: List actions= Action.where("id = ?", actionId).include(Notification.class)

我收到一个 MySQLSyntaxError 异常,说“表 'action.notifications' 不存在”。我在 ActiveJDBC 文档中没有看到任何关于通过不同数据库模式查询类关系的内容,有没有人有完成这项任务的经验?

4

1 回答 1

0

This is more of an issue of MySQL and not ActiveJDBC. Are you sure you can access tables from one schema while connected to another? The schema is really part of the MySQL JDBC URL, correct? If you can write a Java program that can access all your tables from different MySQL databases, that ActiveJDBC will be able to do that too.

于 2014-11-13T03:47:39.110 回答