Hi Hardy,
Any feedback about this issue?
Thanks.
On Sun, Mar 11, 2012 at 3:20 AM, Guillaume Smet
<guillaume.smet(a)gmail.com> wrote:
Hi,
While working on Hibernate JPA Modelgen, I noticed that there are test
failures in MixedConfigurationTest . I thought it was because of my
own changes but I also have this problem with a fresh git clone from
the official repo:
Running org.hibernate.jpamodelgen.test.mixedmode.MixedConfigurationTest
Tests run: 4, Failures: 4, Errors: 0, Skipped: 0, Time elapsed: 2.494
sec <<< FAILURE!
Results :
Failed tests:
testAccessTypeForXmlConfiguredEmbeddables(org.hibernate.jpamodelgen.test.mixedmode.MixedConfigurationTest):
org.hibernate.jpamodelgen.test.mixedmode.Coordinates_ was not
generated.
testDefaultAccessTypeApplied(org.hibernate.jpamodelgen.test.mixedmode.MixedConfigurationTest):
org.hibernate.jpamodelgen.test.mixedmode.Vehicle_ was not generated.
testExplicitXmlConfiguredAccessTypeApplied(org.hibernate.jpamodelgen.test.mixedmode.MixedConfigurationTest):
org.hibernate.jpamodelgen.test.mixedmode.Vehicle_ was not generated.
testMixedConfiguration(org.hibernate.jpamodelgen.test.mixedmode.MixedConfigurationTest):
org.hibernate.jpamodelgen.test.mixedmode.RentalCar_ was not generated.
Tests run: 4, Failures: 4, Errors: 0, Skipped: 0
From what I can see, there is at least a problem with
AnnotationMetaEntity.mergeInMembers: the merged in members aren't
really affected to the new entity as the hostingEntity of the
attribute is still the original entity.
In the case of the ZeroCoordinates entity, it leads to a compilation
error as the SingularAttribute import isn't added to the right context
(it's added to the original XmlMetaEmbeddable context instead of the
AnnotationEmbeddable context this attribute is attached to at the end
of the annotation processing). The content of the generated class is
as follows:
package org.hibernate.jpamodelgen.test.mixedmode;
import javax.annotation.Generated;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value = "org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor")
@StaticMetamodel(ZeroCoordinates.class)
public abstract class ZeroCoordinates_ {
public static volatile SingularAttribute<ZeroCoordinates,
Float> longitude;
public static volatile SingularAttribute<ZeroCoordinates,
Float> latitude;
}
I was wondering if providing the way to overwrite the hostingEntity
(via removing the final and adding a setter) would be acceptable or
not?
Even if I do so (draft patch attached), I still have a test failing
claiming that ZeroCoordinates shouldn't have any attributes generated.
I'm not really sure the test is accurate as the fields are defined
explicitely in the coordinates.xml mapping file so I would have
expected them to be generated.
I would like to have some feedback before I open a bug.
Thanks.
--
Guillaume