Never mind. Shortly after posting this I discovered the cause of my problem. Some of the records in the database really did have spaces after the value, but MS SQL Server is a little too *helpful* in handling whitespace, so queries like 'select len(catalognumber) ...' or 'select ... where ltrim(rtrim(catalognumber) <> catalognumber' didn't count the whitespace. I was finally able to verify the whitespace by soing a 'select cast(catalognumber as binary) ...' and was then able to scrub the data to resolve the problem.

--- Tom Herrick <[EMAIL PROTECTED]> wrote:
I intermittently receive the following exception
from
net.sf.hibernate.impl.SessionImpl.flushEntities when
trying to save changes
to my object under Hibernate.

HibernateException: identifier of an instance of
com.test.catalog.om.Product
altered from 46-606   to 46-606

Note the extra spaces after the identifier (it looks
like it is 46-606 with
two spaces after it).  I'm not sure where these are
coming from since I've
confirmed they aren't in the database (
ltrim(rtrim(catalognumber)) =
catalognumber), and they're not on the field I'm
saving (I print it
immediately before saving it and it has no spaces).

It is intermittent--it happens only on a small
subset of my Product
instances, but consistently for certain products and
with no rhyme or reason
that I can figure out.

I suspect this stems from using a string as my
primary key and as my foreign
key between two objects that I'm linking together.
Unfortunately, I'm kind
of stuck with the schema and just need to figure out
how to make it work.

Can anybody offer ideas about how to fix or at least
troubleshoot this?


_________________________________________________________________
Instant message in style with MSN Messenger 6.0. Download it now FREE! http://msnmessenger-download.com




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to