Search code examples
spring-rooneo4jspring-dataspring-data-graph

Spring data Neo4j @NodeEntiry and Roo @RooEntity conflict


When i try to annotate a POJO with both @NodeEntity and @RooEntity i got following error on the *_Roo_Entity IDT:

can't override T org.springframework.data.neo4j.core.NodeBacked.persist() with void        com m.foo.lib.model.MyPOJOClass.persist() 
return types don't match    
MyPOJOClass_Roo_Entity.aj   
/foo/src/main/java/com/foo/lib/model    line 34

Is there any workaround I can use right now?

Versions:

<properties>
<roo.version>1.1.5.RELEASE</roo.version>
<spring.version>3.0.5.RELEASE</spring.version>
<aspectj.version>1.6.12.M1</aspectj.version>
<slf4j.version>1.6.1</slf4j.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring-security.version>3.0.5.RELEASE</spring-security.version>
<jackson.version>1.6.1</jackson.version>
<spring.data.mongodb.version>1.0.0.M3</spring.data.mongodb.version>
<spring.data.graph.version>1.1.0.M2</spring.data.graph.version>
<spring.data.commons.version>1.1.0.RELEASE</spring.data.commons.version>
<spring.webflow.version>2.3.0.RELEASE</spring.webflow.version>
</properties>

Solution

  • You should be able to tell Roo how the persist method is named. As it is all generated code it should honor your decision.

    @RooEntity( persistMethod = "save")
    @NodeEntity(partial=true)
    public class Actor {
       String name;
    } 
    

    Spring Data Graph entities have a fixed persist method built in.

    There might be other issues popping up, if you want to go for cross-store persistence you should perhaps have a look at the spring data graph docs.

    If you don't want to use JPA you can just remove @RooEntity.