db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Fischer <tfisc...@apache.org>
Subject Re: TRQS321: Criteria Serialization
Date Thu, 10 Nov 2005 08:19:06 GMT


On Thu, 10 Nov 2005, Scott Eade wrote:

> Thomas Fischer wrote:
>
>> I took a quick glance at the issue, and when I uncommented the test case
>> you checked in and resolved an issue of visibility (use
>> "Criteria.getNewCriterion()" instead of "new Criteria.Criterion"), the test
>> case did not produce an error.
>>
>>
> This is interesting.  What JVM are you using?  I am using J2SE 1.4.2_06
> from Sun for Win32.

I could reproduce the error at a second machine. It uses 1.4.2-05 for 
linux.
>
>> Then I looked what the test case does, and it uses Criteria.equals(Object)
>> to test whether the two criteria are equal. This is not enough, since
>> Criteria.equals does not compare aliases and asColumns. There are two
>> possibilities to remedy this:
>> - The first is to change criteria.equals, which I did not want to do
>> between release candidates, but if somebody else is of another opinion
>> here,  we need to discuss it.
>>
>>
> If equals() is performing its function correctly then this is IMO a bug
> and most bugs warrant fixing - even between release candidates (though
> preferably not between the last rc and the final release).

ok, now that I can reproduce the error, I see that Criteria.equals() is 
not the problem (it is not strict enough in my opinion, but this has 
nothing to do with the serialisation problem.)

> ...
> As I said earlier, this has been broken (at least for me) for a while, I
> wouldn't hold off 3.2 for this issue as nobody spoke up earlier or felt
> that it was worth investing their own time to fix (me included).

If we want to solve this problem, we can as easily fix it before the 
release as after. So let's do it now, if we can.

> According to Bloch (Effective Java Item 54) the default serialized form
> of an inner class is ill-defined.  This could lead to varying behaviour
> between different JVMs.  The answer may be to add custom serialization
> code to Criterion.

I could not get hold of Bloch's book in short time, but according to what 
I have found on the internet, the problem with inner classes only occurs 
for non-static inner classes. So I thought maybe one can fix this by 
making Criterion a static inner class (diff appended), but this does not 
solve the problem (same behaviour as before).

I am puzzled at the moment and need to dissect the problem further to 
understand it. Not sure whether it will happen before the week-end, though

    Thomas
Mime
View raw message