开发者

Hibernate JPA 2 Metamodel Generator ignore fields when uses with Spring Roo

开发者_JAVA技巧

I want to create a JPA 2 Metamodel by Hibernate JPA 2 Metamodel Generator for Spring Roo Entities.

<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>1.1.1.Final</version>

I get the process working in the way described at http://docs.jboss.org/hibernate/jpamodelgen/1.1/reference/en-US/html_single/. I also have added the @Entity Annotation to the Roo managed Entities and the generator create the Metamodell classes, but instead of the fields, it uses the Getter for the Metamodel.

For example my Entity:

@RooJavaBean
@RooToString
@Entity
public class Banner {

    @PersistenceContext
    private transient EntityManager em;

    private String name;
    private int code;
    private Champaign champaign;

    public String getChampaignName() {
      return this.champaign.getName();
    }
}

For this entity it creates the Metamodel:

@StaticMetamodel(Banner.class)
public abstract class Banner_ {
    public static volatile SingularAttribute<Banner, String> champaignName;
}

In a not Roo Project the same settings works fine.

Is there any configuration that where I can specify that the generator is based on the fields and not on the Getter so that the Meta Model describe the fields: {{name}} {{code}} {{champaign}}.


One workaround is to annotate the/all Entities with @Access(AccessType.FIELD)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜