this question concerns the JBoss Cache and Hibernate.
Hibernate have a "limitation" that I would like to overcome.
Hibernate cannot use the Same Schma for 2 different databases. Using C-JDBC is not the answer either.
I read in the JBoss faq http://docs.jboss.org/jbcache/FAQ.html and in the documentation that the JBoss cache can use a Cache Loader (since 1.1) to persist its cache objects (FileCacheLoader, BdcjeCacheLoader and JDBCCacheLoader).
JBossCache 1.2 released:
- JDBC CacheLoader: allows to load/store data from DB
- Common dta transfer format: this allows for replication between different
CacheLoaders, e.g. FileCacheLoader and JDBCCacheLoader. Also
enables replication e.g. between MySQL and Oracle
(still needs more testing though)
Would it be possible that 2 SessionFactory (each connect to a different physical DB, with a different schma: Schema 1 on DB1:Oracle, Schema 2 on DB2:Sybase) use the SAME cache loader? I means that if a Parent table is on Sybase, the Children data (on Oracle) could be retreived in memory because it could have been load in the same cache before?
But from this mail: http://forum.hibernate.org/viewtopic.php?t=938654&highlight=schema+multiple+database
it seems that it isn't the case.
First, no, Hibernate will not be implementing in-memory joins
But if the CacheLoader do the job, could it be possible? I think about 2 BdcjeCacheLoader for each SessionFactory loading in the same SleepyCat BD?
BdbjeCacheLoader: this implementation is based on the Sleepycat Java Edition database, a fast and efficient transactional database. It uses a single file for the entire store. http://www.sleepycat.com/jeforjbosscache for details.
Another options could be, using the JDBCCacheLoader, and cache the DB1:Oracle data inside the DB2:Sybase in a extended schema? So, the connection factory on DB2:Sybase might have all the data?
I know this sound tricky to say the less, but could it be feasible by writing a CustomClassLoader?
The goal of all this is to simulate a transparent SQL INNER JOIN between two physical databases and avoid tousand of "SQL SELECT" on a real DB.
Note that the DB1:Oracle maintain only read-only data (easily cachable) and only updated by a batch process each day at 12AM. The DB2:Sybase would be the transactinoal (r/w) database.
Thanks for replying