Wolfgang-Schuetzelhofer / jcypher

Java access to Neo4J graph databases at multiple levels of abstraction
Apache License 2.0
86 stars 15 forks source link

Deferred2DO.performUpdate Error:Can not set Set field to ArrayList #11

Closed geosmart closed 8 years ago

geosmart commented 8 years ago

Hello,Wolfgang! I have a POJO with Set Property

POJO

public class AddressNode implements Cloneable { 
    private String GUID; 
    private Set<AddressNode> preAddressNodes;
    private Set<String> preAddressNodeGUIDs;
}

JCypher Can store it,but when I retrieve it with method 'identify'

    public AddressNode identify(String id) {
        IDomainAccess domainAccess = neo4jConfig.createDomainAccess();
        // Node result = MATCH.node().property("GUID").value(id);
        DomainQuery q = domainAccess.createQuery();
        // create DomainObjectMatches
        DomainObjectMatch<AddressNode> match = q.createMatch(AddressNode.class);
        q.WHERE(match.atttribute("GUID")).EQUALS(id);
        DomainQueryResult queryResult = q.execute();
        List<AddressNode> results = queryResult.resultOf(match);
        if (results.size() > 0) {
            return results.get(0);
        } else {
            return null;
        }
    }

RuntimeException throws

java.lang.RuntimeException: java.lang.IllegalArgumentException: Can not set java.util.Set field com.lt.uadb.tr.entity.adtree.AddressNode.sucAddressNodes to java.util.ArrayList
    at iot.jcypher.domain.mapping.FieldMapping.setFieldValue(FieldMapping.java:165)
    at iot.jcypher.domain.mapping.surrogate.Deferred2DO.performUpdate(Deferred2DO.java:38)
    at iot.jcypher.domain.internal.DomainAccess$DomainAccessHandler.resolveDeferreds(DomainAccess.java:1273)
    at iot.jcypher.domain.internal.DomainAccess$DomainAccessHandler.loadByIdsWithMatches(DomainAccess.java:1254)
    at iot.jcypher.domain.internal.DomainAccess$DomainAccessHandler.loadByIds(DomainAccess.java:563)
    at iot.jcypher.domain.internal.DomainAccess$InternalDomainAccess.loadByIds(DomainAccess.java:4077)
    at iot.jcypher.domainquery.internal.QueryExecutor.loadResult(QueryExecutor.java:369)
    at iot.jcypher.domainquery.DomainQueryResult.intResultOf(DomainQueryResult.java:82)
    at iot.jcypher.domainquery.DomainQueryResult.resultOf(DomainQueryResult.java:58)
    at iot.jcypher.domainquery.DomainQueryResult.resultOf(DomainQueryResult.java:40)

Jcypher Domain Model doesn't support Set Type? Just ArrayList?

Wolfgang-Schuetzelhofer commented 8 years ago

That's unfortunately true for the moment. (It supports List, Map and arrays) I am currently working on a fixes release, and I will put Set support into this release. The release is expected to be out within the next two weeks.

Best regards, Wolfgang

geosmart commented 8 years ago

I have to use Neo4j Native API instead now .Hope JCyper support all Collection subTypes in the next version. waiting......

Wolfgang-Schuetzelhofer commented 8 years ago

Hello, release 3.3.1, containing support for now hopefully all collection subclasses will be out on monday, Aprli 4th.

Best regards, Wolfgang

Wolfgang-Schuetzelhofer commented 8 years ago

Hello,

JCypher 3.3.1 has been released, now with the domain model supporting all collection sub classes.

Best regards, Wolfgang

geosmart commented 8 years ago

@Wolfgang-Schuetzelhofer Thanks,I will try the latest JCypher. By the way ,How often does JCypher update a new version ?

Wolfgang-Schuetzelhofer commented 8 years ago

release cycles are usually between one and two months.