You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by Oliver Hoff <ho...@lh2.de> on 2003/06/02 10:31:21 UTC

[OJB] Issue #OJB175 - java.lang.Long-ClassCast-Exception in OJB-Sequence-Manager H...

You can view the issue detail at the following URL:
<http://scarab.werken.com/scarab/issues/id/OJB175>

Type :        Defect
Issue Id :    OJB175
Reported by: Oliver Hoff
             olimolli - (hoff@lh2.de)

Details:

Platform: DEC
Operating system: windows 2000
Summary: java.lang.Long-ClassCast-Exception in OJB-Sequence-Manager High-Low-Implementation
Description: Hi,

I'm using OJB for some time. Now I made an update to Version 1.0RC3.

It does not work directly, so I debugged a little bit threw the code and I think I found some bugs  in it:
1) I needed to change in repository_internal the JDBC-Type for the field MAX_KEY in the table OJB_HL_SEQ. Otherwise I got a java.lang.Long-ClassCast-Exception.
I used the following SequenceManager:
                <sequence-manager className="org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl">
                    <attribute attribute-name="grabSize" attribute-value="2"/>
                    <attribute attribute-name="autoNaming" attribute-value="true"/>
                    <attribute attribute-name="globalSequenceId" attribute-value="true"/>
                    <attribute attribute-name="globalSequenceStart" attribute-value="15000"/>
                </sequence-manager>

2) Because of this I run into a bug in the class StatementManager in the method bindUpdate:
In the third part, where you set the parameters for WHERE-clause locking, you get the SQLType with the class SqlHelper with the method getSqlTypeRwNonPk. I think it must be the method getSqlTypeLocking. So I changed the code in the following way:
		// parameters for WHERE-clause locking
		values = currentLockingValues;
		for (int i = 0; i < values.length; i++)
		{
			Object val = values[i];
			if (val != null)
			{
				stmt.setObject(index, values[i], SqlHelper.getSqlTypeLocking(cld, i));
			}
			else
			{
				stmt.setNull(index, SqlHelper.getSqlTypeLocking(cld, i));
			}

			index++;
		}

It works, so I think this might be correct. Do you agree?

Yours
Oliver


Status: New
Priority: High
Severity: Critical