I've inherited a legacy app with a massive MSSQL database instance where data model is spread across multiple databases on the same SQL Server instance.
In T/SQL you can normally run queries (even joins) across databases on the same instance (SELECT ... FROM DB_X.dbo.table1 JOIN DB_Y.dbo.table2 ON ...
) and the transactions also work as expected (i.e. I can modify data in DB_X and DB_Y in one transaction).
I'd like to write a new Java program that accesses the data model using Spring Data JDBC but I can't find a way how to map entities to tables in different databases.
I've found articles how to connect to multiple databases but they involve defining multiple connections and separate transactions (i.e. they are really meant for multiple databases as in different instances or even different database types).
However, I'd just like to use one connection and single transaction (i.e. the same way the legacy code is accessing the DB using plain JDBC).
Is it achievable?