5

Is there a way to put Spring Roo and JPA 2.0 metamodel generator to work together?

I have a Spring Roo project and use Eclipse as IDE. I was able to configure the Eclipse project and maven pom.xml to use JPA 2.0 metamodel generator in the build/compile process. The problem is, the generator doesn't generate metamodel classes for Roo entities (that is, domain classes that are annotatted with @Roo* annotations).

I created an entity "by hand" and confirmed that the generator is properly configured. I suspect that the generator fail for Roo entities because it doesn't understand AspectJ IDT classes. Is there a way to make the generator work for Roo entities?

Oh, before I forget, these are my configurations:

  • STS 2.5.1
  • Spring Roo 1.1.0
  • Project configuration:
    • Annotation processing enabled
    • Factory path contains hibernate-jpa-2.0-api-1.0.0.Final.jar and hibernate-jpamodelgen-1.1.0.Final.jar
  • pom.xml
    • Included http://maven-annotation-plugin.googlecode.com/svn/trunk/mavenrepo as a plugin repository
    • Added org.hibernate:hibernate-jpamodelgen:1.1.0.Final as dependency
    • Added and configured org.codehaus.mojo:build-helper-maven-plugin:1.5 to include src/generated/java as a maven source folder
    • Added and configured org.bsc.maven:maven-processor-plugin to run org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor and place the generated code at src/generated/java

I can give further details if necessary. Thanks in advance.

Matheus Moreira
  • 2,338
  • 4
  • 24
  • 31
  • were you able to get this working? I have a very similar setup to you and want to use JPA metamodel but have not had any success generating the entities. – Wally Atkins Dec 30 '10 at 16:37
  • 1
    @Wally, just declare the @Entity annotation on your model classes. When you do it the declaration is removed from the corresponding *_Roo_Entity.aj files and the annotation processor is able to find your entity classes. I didn't try this setup with jpamodelgen because I found Querydsl before solving the problem. Querydsl has a similar processor to generated meta models based on classes annotated with @Entity and it worked well (the only difference is that the processor is hooked into a Maven build). – Matheus Moreira Jan 07 '11 at 16:39
  • @matheus.emm I'm trying to get my pom.xml properly configured for Roo and Querydsl. Do you have a sample you can provide for that config that works in Eclipse? – Eric B. Nov 15 '12 at 20:21

1 Answers1

-1

You should probably take a look at model2roo project.

http://code.google.com/p/model2roo/

bhagyas
  • 3,050
  • 1
  • 23
  • 21