Hi devs,
I’ve been wanting to add XWiki side drivers/dialects since a long while. The first idea is to remove all that generic if
/else
based code related to database operations. This would also make it a lot easier to extract all the code related to unsupported databases (H2, MSSQL, Derby, DB2, etc.) in dedicated contrib extensions where it would be easier to improve and test for contributors. And of course it would also make possible for someone to provide an extension to support another database.
So in the context of Loading... I’m trying to start a new API for it.
I would like to start a first version that looks like the following:
- The new concept would be called “HibernateAdpater” (trying to find a name different from “Driver”, taken by JDBC and “Dialect”, taken by Hibernate and which is actually a bit different in practice since main dialect’s job is to generate SQL queries pieces) but if you have better ideas don’t hesitate
- We call all
HibernateAdapterProvider
components one by one (with the metadata about the engine found by JDBC,DatabaseMetaData
) until we get aHibernateAdapter
instance. In practice we’ll have for now a MariaDB provider for MariaDB engine with a higher priority that the default provider which simply lookup the right adapter based on theDatabaseProduct
. The reason I need something different for MariaDB for once is that there are slight differences in the way to access the innodb row format between MySQL and MariaDB unfortunately - in the first version, I would like to add to this new adapter API everything I need to implement table compression init :
updateDatabase
: execute what’s currently inupdateDatabase
and add its own stuff (in my case a fewalter table
since I could not find a clean way to pass to the Hibernate init tool the compression of for MySQL, MariaDB and Oracle tables)- move
HibernateStore#getConfiguredTableName
renamed asgetTableName
- maybe a few more that I notice during the implementation
- eventually we move to this new API all the generic code for which we currently have a bunch of
if
/else
incom.xpn.xwiki.internal.store.hibernate.HibernateStore
and incom.xpn.xwiki.store.XWikiHibernate*
(and maybe other places)
WDYT ?