]
Laird Nelson commented on HHH-5235:
-----------------------------------
The workaround is to specify the (ideally unneeded) {{hibernate.default_schema}} property
in {{META-INF/persistence.xml}}. This is of course redundant since the same information
is already specified in a standardized, vendor-independent manner in
{{META-INF/orm.xml}}.
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: