I didn't really want to get into it on the original resolution item, but I
did try to change the hashcode method.

Admittedly I didn't think of an XOR of the hashcodes.  What I did do though
was to create the string using the simple date format so they would always
generate the same string whether or not it was a java.util.Date or a
java.sql.Date.  I was very surprised to find that this did not fix the
problem.  I thought that it might have also been the .equals implementation,
but that also was generating equality independently of the type, so I could
not quite fathom exactly what was going on there.  All I knew was that it
was still exhibiting the strange behaviour and by then I knew that using a
java.sql.Date for the member variable fixed it.

As an aside, when trying to use a java.util.Date with the standard JAWS
mapping for Sybase, it created a field of IMAGE type.  When trying to read
the field again, the Sybase driver through the exception "Implicit
conversion form datatype 'IMAGE' to 'BINARY' is not allowed".  It was this
that started the chase of types and standard JAWS mappings.

Tim

> Date: Mon, 30 Jul 2001 11:37:32 +0200
> From: Philipp Meier <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: Re: [JBoss-user] Resolution: Problem with CMP Bean cache with
> different finder met hods
> Reply-To: [EMAIL PROTECTED]
> 
> On Mon, Jul 30, 2001 at 09:54:50AM +0100, Penhey, Tim wrote:
> > All of the debugging was using the objects toString method.  Sometimes
> the
> > debugging for the java.util.Date would show the time (all as zeros)
> which=
>  is
> > the toString for the java.util.Date, and sometimes it would just show
> the
> > date, which is the implementation of the java.sql.Date. =20
> >=20
> > What appeared to be happening was the java.util.Date was actually a
> > java.sql.Date under the covers.  And this somehow was screwing up our
> > equality tests.  By changing the underlying field in the bean and the
> > primary key to a java.sql.Date instead of a java.util.Date everything
> then
> > worked.
> 
> Why didn't you consider to fix your hashcode method? A XOR of all of the
> fields' hashcodes should be sufficient:
> 
> int hashcode =3D field1.hashcode() ^ field2.hashcode() ^
> datafield.hashcode=
> ();
> 
> My $0.02,
>       -billy.
> 
> --=20
> Philipp Meier                              o-matic GmbH
> Gesch=E4ftsf=FChrer                  Pfarrer-Wei=DF-Weg 16-18
> Tel.: +49-(0)700-66284236                     89077 Ulm


------------------------------------------------------------------------------
This message is intended only for the personal and confidential use of the designated 
recipient(s) named above.  If you are not the intended recipient of this message you 
are hereby notified that any review, dissemination, distribution or copying of this 
message is strictly prohibited.  This communication is for information purposes only 
and should not be regarded as an offer to sell or as a solicitation of an offer to buy 
any financial product, an official confirmation of any transaction, or as an official 
statement of Lehman Brothers.  Email transmission cannot be guaranteed to be secure or 
error-free.  Therefore, we do not represent that this information is complete or 
accurate and it should not be relied upon as such.  All information is subject to 
change without notice.



_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to