persistence@glassfish.java.net

Fix to TableDefinition

From: Flavio Stutz <flaviostutz_at_gmail.com>
Date: Mon, 12 May 2008 12:02:16 -0300

 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