Seems that the method is deprecated and may be removed in the future, and it will introduce overhead to the operation(since it do an extra api query to add the property).
在 2015年7月29日星期三 UTC+8上午6:52:21,Michael Hunger写道: > > there is also > template.postEntityCreation(node, Entity.class) to do that for you > > Michael > > Am 28.07.2015 um 13:21 schrieb Zesen Qian <[email protected] <javascript:> > >: > > I found the reason of this exception. Because I use > template.getorcreaterelationship to create the relation(instead of > repository.save), so the property "__type__" is not persisted. > I add __type__=Follow to the properties when creating relationships, and > the problem is solved. > Thanks for your help. > > 在 2015年7月28日星期二 UTC+8下午7:03:07,Zesen Qian写道: >> >> Hello Michael, >> Thanks for your reply. I tried this and got the following exception: >> >> Caused by: org.neo4j.graphdb.NotFoundException: '__type__' on >>> http://dorm.riaqn.com:7474/db/data/relationship/856 >>> at >>> org.neo4j.rest.graphdb.entity.RestEntity.getProperty(RestEntity.java:101) >>> at >>> org.springframework.data.neo4j.support.typerepresentation.AbstractIndexBasedTypeRepresentationStrategy.readAliasFrom(AbstractIndexBasedTypeRepresentationStrategy.java:126) >>> at >>> org.springframework.data.neo4j.support.mapping.TRSTypeAliasAccessor.readAliasFrom(TRSTypeAliasAccessor.java:36) >>> at >>> org.springframework.data.neo4j.support.mapping.TRSTypeAliasAccessor.readAliasFrom(TRSTypeAliasAccessor.java:26) >>> at >>> org.springframework.data.convert.DefaultTypeMapper.readType(DefaultTypeMapper.java:102) >>> at >>> org.springframework.data.convert.DefaultTypeMapper.getDefaultedTypeToBeUsed(DefaultTypeMapper.java:165) >>> at >>> org.springframework.data.convert.DefaultTypeMapper.readType(DefaultTypeMapper.java:142) >>> at >>> org.springframework.data.neo4j.support.mapping.Neo4jEntityConverterImpl.read(Neo4jEntityConverterImpl.java:78) >>> at >>> org.springframework.data.neo4j.support.mapping.Neo4jEntityPersister$CachedConverter.read(Neo4jEntityPersister.java:170) >>> at >>> org.springframework.data.neo4j.support.mapping.Neo4jEntityPersister.createEntityFromState(Neo4jEntityPersister.java:192) >>> at >>> org.springframework.data.neo4j.support.mapping.Neo4jEntityPersister.projectTo(Neo4jEntityPersister.java:216) >>> at >>> org.springframework.data.neo4j.support.mapping.Neo4jEntityPersister.projectTo(Neo4jEntityPersister.java:206) >>> at >>> org.springframework.data.neo4j.support.Neo4jTemplate.projectTo(Neo4jTemplate.java:236) >>> >> >> A simple curl give me the following: >> >>> ➜ ~ curl http://dorm.riaqn.com:7474/db/data/relationship/856 >>> { >>> "extensions" : { }, >>> "metadata" : { >>> "id" : 856, >>> "type" : "FOLLOW" >>> }, >>> "property" : " >>> http://dorm.riaqn.com:7474/db/data/relationship/856/properties/{key}", >>> "start" : "http://dorm.riaqn.com:7474/db/data/node/333", >>> "self" : "http://dorm.riaqn.com:7474/db/data/relationship/856", >>> "end" : "http://dorm.riaqn.com:7474/db/data/node/81", >>> "type" : "FOLLOW", >>> "properties" : " >>> http://dorm.riaqn.com:7474/db/data/relationship/856/properties", >>> "data" : { } >>> } >>> >>> >>> >> >> 在 2015年7月28日星期二 UTC+8下午4:31:42,Michael Hunger写道: >>> >>> template.projectTo(node, Entity.class) >>> >>> >>> Am 28.07.2015 um 09:47 schrieb Zesen Qian <[email protected]>: >>> >>> Hello, I 'am using Spring data neo4j to manage the database, but >>> sometimes I get some Node and Relationship from Neo4jTemplate, and I would >>> like to convert these to @NodeEntity and @RelationshipEntity objects. How >>> can I do this? >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Neo4j" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> For more options, visit https://groups.google.com/d/optout. >>> >>> >>> > -- You received this message because you are subscribed to the Google Groups "Neo4j" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
