Jump to content

WebObjects/Database Compatibility and Comparisons/OpenBase

From Wikibooks, open books for an open world

Overview

[edit | edit source]

Performance

[edit | edit source]

http://www.codefab.com/wordpress/index.php/2006/02/11/webobjectseof-patch-better-way-to-limit-fetches-with-openbase/

Deadlocks

[edit | edit source]

When writing high volumes of data over multiple tables from a WebObjects system, it is possible to create a deadlock. OpenBase resolves the deadlock condition by aborting one of the transactions and returning an error to the WebObjects application.

A possible solution to this problem is to identify the tables to write to immediately after opening a transaction. The necessary SQL would look something like this.

START TRANSACTION 
WRITE TABLE foo, bar 
INSERT INTO foo... 
INSERT INTO bar... 
COMMIT 

Supplied with LEWOStuff (http://www.lindesay.co.nz/) is a framework called JavaOPENBASEJDBCAdaptor. This framework is able to place these locks after each EOF generated transaction is started in order to prevent deadlocks from occurring. You need to copy the framework build product into your local library folder. Under MacOS-X this would be...

/Library/Frameworks/JavaOPENBASEJDBCAdaptor.framework 

You then need to add this framework to the Frameworks grouping within your X-Code WO project. In your WebObjects "Application" subclass constructor, insert some code of the following form to get this adaptor to work with your model.

EOModel model = EOModelGroup.defaultGroup().modelNamed("MyModel"); 
if(null!=model) 
model.setAdaptorName("OPENBASEJDBC"); 

This code will locate the framework for the adaptor, load the adaptor as well as set the adaptor in the model. If you are using SQL logging from EOF, the WRITE TABLE... clauses will be written to the log as well.

There is no need to include the LEWOStuff framework in your project if you are going to use this one.