#394 Relationship table names too long

v3.0 Rabbit Hole
closed-fixed
JBossCMP (436)
5
2002-04-12
2002-03-20
No

When creating a many to many, bidirectional
relationship, the relationship table name generated is
longer than what my database (postgres) supports. The
name is truncated and deployment proceeds without
incidents.

Postgres seems to be truncating table names at 31
characters. The table name went from
'Company_marketSegments_MarketSegment_Companies' to
'company_marketsegments_marketse'

Upon redeployment, however, the code doesn't find the
relationship table with its long name, so it attempts
to create it again. This will cause a SQL error since
the table actually already exists. This causes
(re)deployment to fail with *lots* of stack traces.

I've had to resort to shortening the names of the
relationship methods to get this to work.

This is somewhat related to bug #516835 but is more
serious. (At least for me!)

It seems to me the table names and column names need to
be pushed though a general name mangler so that these
sort of things don't happen.

Discussion

  • Dain Sundstrom
    Dain Sundstrom
    2002-04-03

    • assigned_to: nobody --> dsundstrom
     
  • Dain Sundstrom
    Dain Sundstrom
    2002-04-12

    • status: open --> closed
     
  • Dain Sundstrom
    Dain Sundstrom
    2002-04-12

    • status: closed --> closed-fixed
     
  • Dain Sundstrom
    Dain Sundstrom
    2002-04-12

    Logged In: YES
    user_id=251431

    Now names are limited by
    DatabaseMetaData.getMaxTableNameLength().