dev@glassfish.java.net

Re: Issues with entity-persistence-tests on MaxDB

From: Markus KARG <markus.karg_at_gmx.net>
Date: Sat, 18 Nov 2006 19:06:24 +0100

Tom,
>>>> (2) Char value too long
>>>> Testcase: testReadTransactionIsolation_UpdateAll took 0,052 sec
>>>> Caused
>>> This looks like it is related to the issue above. We should take a
>>> look at all the SQL for the Delete query that is executed (including
>>> the creation of the temporary table). To do that, you may have to run
>>> the EntityManagerJunitTestSuite by itself with logging on and add some
>>> indicators of where the test begins and ends.
I have debugged that test case with FINEST logging enabled and found out
that the reason is quite simple. Actually I propose the following to be
a bug of TopLink and I hope that you will be so kind to fix that (it is
outside of MaxDB and far beyond my knowledge about TopLink internals):

When the test runs, the log posts that the following two code lines get
executed (among others):

CREATE TABLE TEMP.$CMP3_EMPLOYEE (EMP_ID INTEGER NOT NULL, VERSION
INTEGER, L_NAME VARCHAR, PRIMARY KEY (EMP_ID))
INSERT INTO TEMP.$CMP3_EMPLOYEE (EMP_ID, VERSION, L_NAME) SELECT
t0.EMP_ID, (t0.VERSION + 1), 'New' FROM CMP3_EMPLOYEE t0, CMP3_SALARY t1
WHERE ((t0.F_NAME LIKE 'testReadTransactionIsolation') AND (t1.EMP_ID =
t0.EMP_ID))

As you can read from that code lines, there is a column created with
VARCHAR type but no size specified. MaxDB in that case assumes an
implied size of 1 character.
Then the following INSERT tries to put the word 'New' (= size of 3) into
that column.
Unfortunately MaxDB is not behaving like other databases: It does not
truncate the string value, but instead throws an SQLException that the
value is too long (I tried it out with a simple test program).

So the solution is to tell TopLink to provide the correct size but no to
rely on a specific default or specificat behaviour like automatic
truncation. Since MaxDB is right (the value REALLY is longer than the
target column's width), I am rating this as a bug of TopLink.

Since I am not a TopLink guru, I would really appreciate if you could
fix that. A lot of test cases crash due to that reasons when running on
MaxDB.

Thanks a lot!
Markus