persistence@glassfish.java.net

Re: Fix to TableDefinition

From: Mitesh Meswani <Mitesh.Meswani_at_Sun.COM>
Date: Mon, 12 May 2008 17:05:23 -0700
Hi Flavio,

Can you please file a bug under "entity-persistence" category and attach the patch to it. This will help others running into similar issue.  That said, the checkins into toplink-essentials are limited to critical fixes only. All active development on persistence for GlassFish is now happening under EclipseLink project. GlassFish V3 ships with EclipseLink as the JPA provider. You can also start using EclipseLink with GlassFish V2.1 starting with build 32 of V2.1. All you need to do is to drop EclipseLink jars in lib dir of GlassFish. Can you please check whether the issue is present with EclipseLink.

Thanks,
Mitesh

Flavio Stutz wrote:
Guys,

I made a patch to Toplink in order to fix a problem I had.
Other guys are facing the same problem: http://forums.java.net/jive/thread.jspa?messageID=273811&#273811


The altered class is oracle.toplink.essentials.tools.schemaframework.TableDefinition

Instead of
"foreignKeyName = Helper.truncate(shortenedTableName, maximumNameLength - shortenedFieldName.length()) + shortenedFieldName;" (line 460)

Use
"foreignKeyName = Helper.truncate(shortenedTableName, Math.max(maximumNameLength - shortenedFieldName.length(),0)) + Helper.truncate(shortenedFieldName, maximumNameLength);" (line 460)

When shortedFieldName size is greater than maximumNameLength, it is passed a negative value to Helper.truncate(..)

I hope this could be commited to repository.

Flávio Stutz