在Neo4j中存储图像(二进制数组)的最佳方法是什么? 我将它们存储为二进制数组,但是如何使用Cypher查询检索它们呢? 我有这个查询,其中图片已存储为二进制数组,但似乎有一个例外。
Match (n:`employees`) where employeeid='1' return n.picture
这是完整的堆栈跟踪:(图像大小为12Kb)
org.neo4j.rest.graphdb.RestResultException: Unhandled array type: class [B at
UnsupportedOperationException
org.neo4j.server.helpers.PropertyTypeDispatcher.dispatchArray(PropertyTypeDispatcher.java:720)
org.neo4j.server.helpers.PropertyTypeDispatcher.dispatchNumberArray(PropertyTypeDispatcher.java:715)
org.neo4j.server.helpers.PropertyTypeDispatcher.dispatchByteArrayProperty(PropertyTypeDispatcher.java:675)
org.neo4j.server.helpers.PropertyTypeDispatcher.dispatchByteArrayProperty(PropertyTypeDispatcher.java:280)
org.neo4j.server.helpers.PropertyTypeDispatcher.dispatchPrimitiveArray(PropertyTypeDispatcher.java:135)
org.neo4j.server.helpers.PropertyTypeDispatcher.dispatch(PropertyTypeDispatcher.java:122)
org.neo4j.server.rest.repr.CypherResultRepresentation.getRepresentation(CypherResultRepresentation.java:185)
org.neo4j.server.rest.repr.CypherResultRepresentation.access$000(CypherResultRepresentation.java:38)
org.neo4j.server.rest.repr.CypherResultRepresentation$2$1.underlyingObjectToObject(CypherResultRepresentation.java:103)
org.neo4j.server.rest.repr.CypherResultRepresentation$2$1.underlyingObjectToObject(CypherResultRepresentation.java:99)
org.neo4j.helpers.collection.IterableWrapper$MyIteratorWrapper.underlyingObjectToObject(IterableWrapper.java:57)
org.neo4j.helpers.collection.IteratorWrapper.next(IteratorWrapper.java:47)
org.neo4j.server.rest.repr.ListRepresentation.serialize(ListRepresentation.java:64)
org.neo4j.server.rest.repr.Serializer.serialize(Serializer.java:75)
org.neo4j.server.rest.repr.ListSerializer.addList(ListSerializer.java:56)
org.neo4j.server.rest.repr.ListRepresentation.addTo(ListRepresentation.java:79)
org.neo4j.server.rest.repr.ListRepresentation.serialize(ListRepresentation.java:65)
org.neo4j.server.rest.repr.Serializer.serialize(Serializer.java:75)
org.neo4j.server.rest.repr.MappingSerializer.putList(MappingSerializer.java:61)
org.neo4j.server.rest.repr.CypherResultRepresentation.serialize(CypherResultRepresentation.java:83)
org.neo4j.server.rest.repr.MappingRepresentation.serialize(MappingRepresentation.java:41)
org.neo4j.server.rest.repr.OutputFormat$1.write(OutputFormat.java:160)
org.neo4j.server.rest.security.SecurityFilter.doFilter(SecurityFilter.java:112)
java.lang.Thread.run(Unknown Source)
答案 0 :(得分:2)
是您正在使用的实际密码声明吗?如果是这样你就错过了打字 在哪里n.empoyeeid =" 1"
是字节可以(作为[]字节) Neo4j api docs
但它不是GridFS或类似的存储,所以如果blob很大,我建议使用S3或存储在磁盘上,只是neo节点中的指针。但它又应该有效。