"unable to locate static metamodel field" caused by
MetadataContext.applyIdMetadata(PersistentClass, EntityTypeImpl)
--------------------------------------------------------------------------------------------------------------------
Key: HHH-6804
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-6804
Project: Hibernate Core
Issue Type: Bug
Components: metamodel
Affects Versions: 4.0.0.CR5, 3.6.3
Environment: Hibernate 3.6.3
Reporter: Karl Rhenius
Attachments: hibernate_issue.zip
Hello,
Hibernate throws the following error on startup:
MetadataContext.registerAttribute:421 - Unable to locate static metamodel field :
org.foo.test.inheritance.singlePk.MoviePoster_#posterId
The entity MoviePoster is a subclass of the entity Poster.
Poster uses the @IdClass annotation to define a primary key class and has a field posterId
tagged with @Id
After some debugging I found this piece of code in MetadataContext, that adds the property
of my id class to the metadata-list of MoviePoster,
because the id class has only one property:
Line 251:
else {
final KeyValue value = persistentClass.getIdentifier();
if (value instanceof Component ) {
final Component component = ( Component ) value;
if ( component.getPropertySpan() > 1 ) {
//FIXME we are an Hibernate embedded id (ie not type)
}
else {
//FIXME take care of declared vs non declared property
jpaEntityType.getBuilder().applyIdAttribute(
attributeFactory.buildIdAttribute(
jpaEntityType,
(Property) component.getPropertyIterator().next() )
);
}
}
}
I'm not quite sure, if this is a bug or improvement, because I couldn't find any
problems so far.
This bug seems to be related to HHH-5024, but the testcases are quite different.
The attached file contains a testcase with a single-column and multi-column id-class.
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira