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

Laird Nelson (JIRA) noreply at atlassian.com
Sun Aug 28 14:36:07 EDT 2011


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5235?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Laird Nelson updated HHH-5235:
------------------------------

    Attachment: hhh-5235.zip

Attaching test case demonstrating the problem.  Observe that the default schema is specified in META-INF/orm.xml, but is not read by Hibernate.  Add the hibernate.default_schema property in META-INF/persistence.xml to work around this bug.  EclipseLink handles this problem correctly.

> 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
>         Attachments: hhh-5235.zip
>
>
> 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.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list