Issue Details (XML | Word | Printable)

Key: XWIKI-1960
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Thomas Mortagne
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
XWiki Core

Add full xwiki virtual mode support for postgresql

Created: 18/Dec/07 15:58   Updated: Saturday 12:52
Component/s: Storage
Affects Version/s: 1.2 RC1
Fix Version/s: None

File Attachments: 1. Text File xwikivirtualmode-pgsql.patch (4 kB)

Issue Links:
Duplicate
 

Date of First Response: 18/Dec/07 16:14


 All   Comments   Change History   FishEye      Sort Order: Ascending order - Click to sort in descending order
Thomas Mortagne added a comment - 18/Dec/07 16:00
  • In XWikiHibernateStore.createWiki(String wikiName, XWikiContext context), find a way to make a "create database" query not in a "transaction". Postgre return a error : "CREATE DATABASE: may not be called in a transaction block".

Sergiu Dumitriu added a comment - 18/Dec/07 16:14
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.

Thomas Mortagne added a comment - 18/Dec/07 16:31
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

Jesús Torres added a comment - 23/Dec/07 20:23
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


Vincent Massol added a comment - 08/Jan/08 12:48
we've now upgraded to hibernate 3.1.3 so this patch could be applied. I'll let you work on it Thomas.

Thomas Mortagne added a comment - 08/Jan/08 14:31
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.

Thomas Mortagne added a comment - 08/Jan/08 18:23
There is another problem with the modification in XWikiHibernateBaseStore.getSchemaUpdateScript with this patch : it make updateSchema to generate lot of exceptions.

Thomas Mortagne added a comment - 04/Sep/08 14:36
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). We should ttry it.

CalebJamesDeLisle added a comment - 29/Jan/10 11:27
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:
http://biotext.org.uk/execute-sql-outside-of-a-transaction-in-hibernate/
He seems to have settled on the same method which I found.

Here it gives an example of running code outside of a transaction (for jdbc environments) but I was unable to reproduce the results.
https://www.hibernate.org/452.html


CalebJamesDeLisle added a comment - 13/Mar/10 12:52
After testing and looking at the jdbc source code, I can say the setCatalog function is still not supported.