[hibernate-issues] [Hibernate-JIRA] Commented: (ANN-466) Discriminator values longer than 31 break in PostgreSQL

Mark Hobson (JIRA) noreply at atlassian.com
Mon Oct 30 06:31:05 EST 2006


    [ http://opensource.atlassian.com/projects/hibernate/browse/ANN-466?page=comments#action_25016 ] 

Mark Hobson commented on ANN-466:
---------------------------------

Interesting way to fix a problem by removing the test :)

Seriously though, this is a bit of a problem for entities whose unqualified classnames are longer than 31 characters.  What was the reasoning behind ANN-321 and ANN-223 which substantially increased the probability of violating the discriminator column length?  I assume this was the outcome of an EJB spec-related discussion, in which case does the spec describe what should happen in such circumstances?

Obvious solutions that I can see to this problem are:

1) Increase the default discriminator column length to >31, e.g. 255.  This is really no hardship to most databases.

2) Truncate the entity name to the default discriminator column length to avoid SQL errors at insert time.  Entities that would share the same truncated names could be checked for at configuration time and a suitable exception thrown.

> Discriminator values longer than 31 break in PostgreSQL
> -------------------------------------------------------
>
>          Key: ANN-466
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-466
>      Project: Hibernate Annotations
>         Type: Bug

>   Components: binder
>     Versions: 3.2.0.ga
>     Reporter: Mark Hobson
>      Fix For: 3.2.1
>  Attachments: patch.txt
>
>
> Since ANN-321, discriminator values longer than 31 characters are commonplace.  For some reason, under HSQLDB inserting values longer than 31 into VARCHAR(31) columns succeeds without truncation, but this fails under PostgreSQL and possibly other databases.
> This can be seen by running SingleTableTest.testDefaultDiscriminatorColumn under PostgreSQL.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list