Hi Christian,

Christian Lipp wrote:
Hi Armin,

thank you for  quick answer and sorry for my long delay.

We are using an older OJB version (1.0.1.x), so I thought I cannot use your
recommendation and wanted to perform a backport now.
I got the actual OJB now and examined it, but also couldn't find an
attribute in the jdbc-connection-descriptor (I checked the repository.dtd).

So I asume I have to implement the JDBC transaction level as attribute for
jdbc-connection-descriptor into OJB or do I miss something?

Some databases support transaction-isolation settings by append a
property in the database URL - e.g. maxDB:
dbalias="//localhost/ojb?isolation=TRANSACTION_READ_COMMITTED

Additionally you can specify connection/database properties as custom attributes with prefix "jdbc.".

<jdbc-connection-descriptor
    ....
 >
    <attribute attribute-name="jdbc.xyz" attribute-value="zxy" />
</jdbc-connection-descriptor>

OJB will set these properties (with jdbc.* prefix) when create the connection:
Connection con = DriverManager.getConnection(url, properties);



Could someone point me in the right direction for this implementation? I
assume I have to read the attribute and apply it in the function
PlatformDefaultImpl.initializeJdbcConnection.


If your database doesn't support isolation setting shown above, you can indeed extend a existing Platform class and override #initializeJdbcConnection. Within this method you can easily get custom attributes using:

<jdbc-connection-descriptor
  platform="org.apache.ojb.broker.platforms.PlatformMyOwnImpl"
  ....
 >
   <attribute attribute-name="isolation" attribute-value="READ_COMMITED" />
</jdbc-connection-descriptor>

class PlatformMyOwnImpl extends PlatformMySQLImpl{
...
public void initializeJdbcConnection(Connection conn)
{
  String isolation = jcd.getAttribute("isolation", null);
...
}
}

All shown solutions will work with latest OJB source
http://www.mail-archive.com/ojb-user%40db.apache.org/msg16078.html
I don't check the older versions.

regards,
Armin

Thanks in advance, CL

-----Original Message-----
From: Armin Waibel [mailto:[EMAIL PROTECTED] Sent: Freitag, 25. Jänner 2008 03:03
To: OJB Users List
Subject: Re: Isolation level

Hi Christian,

Christian Lipp wrote:
I am still looking for an solution for my lock level settings and therefore I am digging through the OJB source.

What I am not sure at the moment is if the setting of the isolation-level is generally ignored in OJB?
<descriptor-repository version="1.0" isolation-level="read-comitted">

I couldn't find the place in the OJB code where the isolation level is set to the DescriptorRepository and later to the connection.
In my optionion the isolation-level in the XML file is ignored.

Could someone point me in the right direction?

Out of the box the isolation-level setting is only used by the ODMG-api
which use pessimistic locking by default.
http://db.apache.org/ojb/docu/guides/lockmanager.html#Pessimistic-Locking
The PB-api doesn't use pessimistic locking, thus it will ignore these
settings.

The database transaction levels are completely independent from the
isolation-level setting in OJB. So you can use different database
transaction levels (e.g. as property in the dbalias attribute in the
jdbc-connection-descriptor)

regards,
Armin

Thanks in advance,
CL




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to