2

Is it possible to have the table property of an ORM entity to be a table on another database, like this: component persistent="true" table="anotherdb..tableonanotherdb". I got a table undefined error when I tried it.

If not, what are my options if the app needs to be able to update anotherdb..tableonanotherdb, instead of just viewing it (which I can simply set up a view for)?

I'm on CF10.

Nick
  • 354
  • 5
  • 15
  • What DBMS (database platform) are you using? – Carl Von Stetten Jun 16 '15 at 15:37
  • Microsoft SQL Server. – Nick Jun 16 '15 at 20:03
  • CF10 supports multiple datasources for ORM, using the `this.datasource` setting in Application.cfc. CF will run separate Hibernate sessions for each datasource. So unless you need the entity in your second database to be directly related to an entity in your primary database, just use a separate datasource. For more info, see https://wikidocs.adobe.com/wiki/display/coldfusionen/Support+for+multiple+data+sources+for+ORM in the ColdFusion docs. – Carl Von Stetten Jun 16 '15 at 20:49
  • @CarlVonStetten yeah unfortunately the entities from the 2 databases do relate. I think we'll probably have to rethink the overall design here a bit. Thanks anyway. – Nick Jun 16 '15 at 22:00
  • 1
    I wonder if a Synonym would work. http://stackoverflow.com/questions/21722066/how-to-create-an-alias-of-database-in-sql-server – James A Mohler Jun 18 '15 at 16:48
  • @JamesAMohler Just tried that, unfortunately didn't work. – Nick Jun 21 '15 at 09:13

0 Answers0