Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for OGM's CompositeAttributeConverter. [DATAGRAPH-1393] #1954

Closed
spring-projects-issues opened this issue Oct 1, 2020 · 3 comments
Closed

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Oct 1, 2020

Michael Simons opened DATAGRAPH-1393 and commented

A


Affects: 6.0 RC1 (2020.0.0)

Referenced from: pull request #542

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Oct 15, 2020

Michael Herb commented

Do you guys have any example code on how to use this?  I found some unit test code, but the implementation was static.

I took a stab at it like the below, but I get an exception:

    Caused by: java.lang.ClassNotFoundException: org.springframework.data.neo4j.core.convert.Neo4jPersistentPropertyToMapConverter    Caused by: java.lang.ClassNotFoundException: org.springframework.data.neo4j.core.convert.Neo4jPersistentPropertyToMapConverter at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)

 

public class RouteMetricConverter implements Neo4jPersistentPropertyToMapConverter<String, RouteMetric> {
    @Override
    public Map<String, Value> decompose(RouteMetric routeMetric, Neo4jConversionService neo4jConversionService) {
        Map<String, Value> map = new HashMap<>();
        if (routeMetric == null)
            return map;
        map.put("Metric_Fiberloss", Values.value(routeMetric.getFiberLoss()));
        //...more code
        return map;
    }

    @Override
    public RouteMetric compose(Map<String, Value> map, Neo4jConversionService neo4jConversionService) {
        RouteMetric rm = new RouteMetric();
        rm.setFiberLoss(map.get("Metric_Fiberloss").asDouble());
        //...more code
        return rm;
    }
}
@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Oct 16, 2020

Michael Simons commented

I guess you configured it correctly on the property. The exception feels like you’re coded it against RC2 but running against RC1. Gerrit Meier mind having a look here as well?

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Oct 16, 2020

Michael Herb commented

Thank you Michael, it is indeed a dependency issue on my side

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants