Hi Guillaume,
first off, thanks for your pull requests for Modelgen. I applied both :-)
I did not realize that the issue you are describing here is still in issue. Are you
reproduce
this problem with the current master? I don't have any test failures against master.
What is your environment? JDK and maven version. Here is mine:
Apache Maven 3.0.4 (r1232337; 2012-01-17 09:44:56+0100)
Maven home: /opt/java/maven
Java version: 1.6.0_29, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x", version: "10.7.3", arch: "x86_64",
family: "mac"
--Hardy
On Mar 14, 2012, at 12:41 AM, Guillaume Smet wrote:
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