[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-5235) MultipleHiLoPerTableGenerator infers catalogs and schemas where none should be inferred

Laird Nelson (JIRA) noreply at atlassian.com
Sun Nov 28 09:18:13 EST 2010


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5235?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=39220#action_39220 ] 

Laird Nelson commented on HHH-5235:
-----------------------------------

Still present in Hibernate 3.6.0.Final.  This bug means that--in a JPA-compliant project--one must mention schemas in one's JPA annotations when doing table-based identity generation; XML overriding will not work.

> MultipleHiLoPerTableGenerator infers catalogs and schemas where none should be inferred
> ---------------------------------------------------------------------------------------
>
>                 Key: HHH-5235
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5235
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.5.2
>         Environment: Hibernate 3.5.2-Final, H2 database version 1.2.134
>            Reporter: Laird Nelson
>
> I have a @TableGenerator annotation and an associated @GeneratedValue like this:
> @Entity(name = "PostalAddress")
> @TableGenerator(
>   name = "PostalAddressEntityIDGenerator",
>   table = "JPAGenerators",
>   pkColumnName = "generatorName",
>   pkColumnValue = "PostalAddressEntityIDGenerator",
>   valueColumnName = "generatorValue",
>   allocationSize = 1
> )
> public class PostalAddressEntity {
>   @GeneratedValue(strategy = GenerationType.TABLE, generator = "PostalAddressEntityIDGenerator")
>   @Id
>   private long id;
>   /* etc. */
> }
> At runtime, the following SQL shows up:
> select generatorValue from JPAGenerators.JPAGenerators.JPAGenerators where generatorName = 'PostalAddressEntityIDGenerator' for update
> Note the table name repeated three times as though it is both the catalog, the schema and the table name.
> It seems that the MultipleHiLoPerTableGenerator, when asked to build its SQL strings for various operations, is told that the schema, the catalog and the table name are all the same.
> I was expecting that the catalog would default to "", per the TableGenerator documentation, and that the schema would default to whatever was present in orm.xml's persistence-unit-defaults element.
> I can work around this by explicitly spelling out the schema name in my @TableGenerator annotation, but I don't want to put it there (can't, actually).  I can also work around this in a JPA-compliant manner by defining my table generator in my orm.xml file, but I don't want to do that either.

-- 
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