I am using spring neo4j. I have a repository
class that extends GraphRepository<T>
. I want to delete a specific object based on the uid
in the arguments to the method below.
public interface TypeRepository extends GraphRepository<Type> {
@Query("START n=node:node_auto_index(uid=uidValueYAA)" +
"MATCH n-[r]-()" +
"DELETE n, r")
public void deleteByUid(String uidValueYAA);
}
Note: my persisted class has an index annotation like the following:
@GraphId
private Long id;
@Indexed(unique=true) private String uid;
I get the following exception when I use the method like so:
typeRepository.deleteByUid(uid);
//The Exception
string literal or parameter expected|"START n=node:node_auto_index(uid=uidValueYAA)MATCH n-[r]-()DELETE n, r"|
How can I use the method to delete a specific node based on the uid
that I pass to the method?
Or
@Query("START n=node:node_auto_index(uid={uidValueYAA})" +
"MATCH n-[r]-()" +
"DELETE n, r")
public void deleteByUid(@Param("uidValueYAA") String uidValueYAA);
You need to use {0} instead of the name as shown below
@Query("START n=node:node_auto_index(uid={0})" +
"MATCH n-[r]-()" +
"DELETE n, r")
public void deleteByUid(String uidValueYAA);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.