|
|
|
1 hibernate.cfg.xml: add listener config
2 hbm.xml: add sql-type="clob" seem as Eric Sun 3 listener java code I have zero experience on hibernate, and does not test the approach carefully. I want to explain the Oracle and Hibernate behavior.
1. Oracle take empty strings as NULL. 2. Column types 3. Hibernate. 4. Clob and BLOB processing. 5. There are few points in code with NullPointerExeption because parent is null. I found few holes, but it is a much more. 6. ID's and sequences. I think, I can prepare complete solution and patch next week. Hi Mikhail,
You seem to be well versed into all this so that's really cool. What you say makes sense to me. Joachim, WDYT? Awaiting your patch Feel free to discuss it on the mailing list if you want. Thanks I absolutely agree Mikhail, the best choice is modify model, if possible.
Waiting for Mikhail's patch. I haven't estimate the change of schema definition side effect, so I choice a dirty but quick approach I think. Thanks Thanks so much for the Mikhail's input, I've been hoping someone to point out the Hibernate issues for a while.
For [4. Clob and BLOB processing. I am looking forward to a universal hibernate.cfg.xml which works well with both Oracle and MySQL This model and Hibernate fix is really going to pave the road to let XWiki enter the corporate deployment. Way to go! I recently tried to wire xwiki and Oracle up with the hibernate 3.2.2 release. It seems to be enough to change the type of string cols > 2000 to text and use the latest 10g oracle jdbc drivers + standard OracleDialect in the hibernate properties to get the clob part working with xwiki. Am bit short on time atm. but can probably prepare some unit tests and memory (PGA) leakage testing since open LOB pointers can be bit of a hog with Oracle.
As for the empty column definitions, I did not manage to solve this part without destabilizing the xwiki (after changing the xwiki hbm model to nullable got some errors importing the base xar and editing pages). This would prob need a review of the model rather then a code fix. Let me know if I can be of help on the clob bit. Sorry, two may posts above is my mistake.
The patch file in attachment to this issue. You can choose from two solutions. 1. Use old mapping file xwiki.hbm.xml 2. Use mapping file with oracle-specific features with xwiki.oracle.hbm.xml Difference is in large binary objects processing. In first case, Hibernate will create columns type "long row" for binary data. In second case, Hibernate will create columns type "blob". Only two fields exists now with type "binary". The "long raw" datatype has limit with 2G, bad manageability and problems with data processing. Also exists limit with one column per table. ------ Enviroment 2. Create user xwiki in database. 3. Oracle JDBC drivers from http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/htdocs/jdbc_10201.html 4. Copy ojdbc14.jar, orai18n.jar into lib directory. 5. In file WEB-INF/hibernate.cfg.xml uncomment reference to oracle mapping file and comment/delete reference to xwiki.hbm.xml 6. In file WEB-INF/hibernate.cfg.xml uncomment section for Oracle database. Specify correct connection URL. 7. Start xwiki. Run Java with system properties I test XWiki on Oracle Application Server (Standalone OC4J). And I use container-managed connections with pooling. Works well. Putting in RC1 so that we don't forget to review this important patch. If it's too risky to apply it, move it for just after 1.0 and apply it on trunk only.
I have applied the Java patch in svn 2826 and created 2 fields xwiki.oracle.hbm.xml and feeds.oracle.hbm.xml since we are not sure of the effect these different files could have on non Oracle databases. I've also included Oracle connect strings in comments
Some intallation notes are now needed to be written to configure XWiki for Oracle Mikhail, I wanted to thank you again for this very useful patch. You're now on http://www.xwiki.org/xwiki/bin/view/Community/HallOfFame#HContributors
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There are 2 approaches to resolve this problem
1 modify hbm(or schema) accept null, remove not-null constraints.
2 hack Hibernate, use listeners, such as PreInsertEventListener, PreUpdateEventListener, replace empty String with some special character, for example '\r'. and then use some Post- listener restore empty string if needed. But I known little about Hibernate event model.
I tried the 2nd on xwiki 1.0B5, work with Oracle 10G XE, seemed most functions is ok, except some static HQL, for example, find Orphaned Pages script
#set ($query = "where doc.parent is null or doc.parent='' order by doc.name asc")
should replaced as:
#set ($query = "where doc.parent is null or doc.parent=chr(13) order by doc.name asc")
Attachments is my test config and sample code.