|
[
Permlink
| « Hide
]
Thomas Mortagne added a comment - 18/Dec/07 16:00
I was looking a few days ago at the session/transaction relationship in XWiki. For the moment it is impossible to create a session without a transaction, although the method accepts a boolean withTransaction parameter (which is ignored). This should be fixed, but there is a lot of code that must be checked, as changing the current behavior could break something.
Plus I "fixed" the withTransaction parameter (adding an if around transaction init at end of method) use just for a test and even with that I had the same error
This patch add virtual mode support for PostgreSQL database in a similar way that the issue XWIKI-1740 add support for Derby an HSQLDB.
It only works with hibernate 3.1.3 or later because of the bug HHH-1325: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1325 we've now upgraded to hibernate 3.1.3 so this patch could be applied. I'll let you work on it Thomas.
This works almost totally. There is just some errors when creating new wiki then import xar or copy wiki template into it just after like Wiki Manager do. I think what you did is good but there is another problem with schemas like for derby and hsqldb in XWIKI-1740.
There is another problem with the modification in XWikiHibernateBaseStore.getSchemaUpdateScript with this patch : it make updateSchema to generate lot of exceptions.
As Michal Bielicki said in the mailing list, the JDBC driver for postgresql 8.3.3 support hibernate catalog (see http://markmail.org/message/hfw56keweoc2dckl
Hibernate doesn't provide direct access to the jdbc connection, but rather a proxy which makes sure everything is done inside of a transaction.
"No communication with the database can occur outside of a database transaction" http://docs.jboss.org/hibernate/core/3.3/reference/en/html/transactions.html#transactions-demarcation There is however a hole which makes closing the transaction possible. stmt.execute("ROLLBACK; CREATE DATABASE " + schema + " ENCODING = 'UNICODE' TABLESPACE = pg_default; START TRANSACTION;"); What is important is that hibernate doesn't loose track of the current transaction since it is being stopped and started manually. In my search for a supported way to run sql outside of a transaction, I found this: Here it gives an example of running code outside of a transaction (for jdbc environments) but I was unable to reproduce the results. After testing and looking at the jdbc source code, I can say the setCatalog function is still not supported.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||