0

According to this User Guide, when using advanced mapping mode, any access to properties and relationships will in general read through down to the database. Is that means the whole object will not be fetch and only necessary properties will be read? Correct me if Im wrong.

I am using advanced mapping mode, here is my maven setting (only necessary codes are shown):

<dependency>
    <groupId>org.springframework.data</groupId>
    <artifactId>spring-data-neo4j-aspects</artifactId>
    <version>3.3.0.RELEASE</version>
</dependency>

<dependency>
    <groupId>org.aspectj</groupId>
    <artifactId>aspectjweaver</artifactId>
    <version>1.8.6</version>
</dependency>
    .........
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
            <excludes>
                <exclude>**/*.*</exclude>
            </excludes>
            <source>1.7</source>
            <target>1.7</target>
        </configuration>
</plugin>
<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>aspectj-maven-plugin</artifactId>
    <version>1.7</version>
    <dependencies>
        <dependency>
                <groupId>org.aspectj</groupId>
                    <artifactId>aspectjrt</artifactId>
                    <version>1.8.6</version>
                </dependency>
                <dependency>
                    <groupId>org.aspectj</groupId>
                    <artifactId>aspectjtools</artifactId>
                    <version>1.8.6</version>
                </dependency>
            </dependencies>
            <executions>
                <execution>
                    <goals>
                        <goal>compile</goal>
                        <goal>test-compile</goal>
                    </goals>
                </execution>
            </executions>
        <configuration>
        <outxml>true</outxml>
        <aspectLibraries>
            <aspectLibrary>
                <groupId>org.springframework</groupId>
                <artifactId>spring-aspects</artifactId>
            </aspectLibrary>
            <aspectLibrary>
                <groupId>org.springframework.data</groupId>
                <artifactId>spring-data-neo4j-aspects</artifactId>
            </aspectLibrary>
        </aspectLibraries>
        <source>1.7</source>
        <target>1.7</target>
    </configuration>
</plugin>

My Spring Configuration goes well, so I just skip it and save some places.

Here is something strange, when I access User object's lover property's name property, it always return null:

@RelatedTo(type = "loves", direction = Direction.OUTGOING)
private User lover;

and the system println result is :

{id=0, theme=null, name=Pamela, password=2663, lover={id=1, name=null}}

when the @Fetch is added:

@RelatedTo(type = "loves", direction = Direction.OUTGOING)
@Fetch
private User lover;

it turns out to be right:

{id=0, theme=null, name=Pamela, password=2663, lover={id=1, name=Bond}}

Anyone knows what is going wrong? Thx

Junbang Huang
  • 1,927
  • 19
  • 26
  • Try adding these lines in the _plugins_ section, to be sure to exclude plain compiler and enable just the aspectj one: ` org.apache.maven.plugins maven-compiler-plugin ... **/*.* ` – remigio Jul 29 '15 at 09:08
  • @remigio I do as you told me to, and I updated my post, adding excludes tag in it. But it still not works. – Junbang Huang Jul 30 '15 at 02:20
  • You added the *excludes* section to the *aspectj-maven-plugin* configuration, whereas you should add it to the *maven-compiler-plugin* section, just following the example included in my comment. The purpose is to prevent the ordinary compiler plugn to process source files and have them processed by the aspectj plugin. – remigio Jul 30 '15 at 08:35
  • @remigio I updated it again, it still not works. – Junbang Huang Jul 30 '15 at 14:36
  • Sorry no more ideas, everything seems ok, let's wait for some neo4j guru. – remigio Jul 30 '15 at 16:04
  • you successfully did this before? I mean do you have some demo project to show? I wanna see how it is done, – Junbang Huang Jul 31 '15 at 01:57
  • [Here](https://gist.github.com/anonymous/889d3f1892985a62275a) I shared a working *pom.xml*, you can try it. I didn't share any Java source code, there is nothing special with it, just classes annotated with *@NodeEntity*. – remigio Jul 31 '15 at 06:56

0 Answers0