neo4j / neo4j-jdbc

Official Neo4j JDBC Driver
http://neo4j.github.io/neo4j-jdbc/
Apache License 2.0
135 stars 53 forks source link

mybatis neo4j insert #174

Closed diannao720 closed 7 months ago

diannao720 commented 6 years ago
Create (p:Knowledge {name: #{name},id: #{id}})

Insertion has no effect.please why

inserpio commented 6 years ago

Try removing brackets. If I remember correctly, Mybatis uses #name and #id as params format.

diannao720 commented 6 years ago

`

Create (p:Knowledge {name: “aaa”,id: 1})

`

Insertion has no effect.please why

omarlarus commented 6 years ago

Hi @diannao720 , answer to these questions, please:

  1. do you have a log of the operation?
  2. Are you sure the transaction is committed?
  3. Do you have any errors?
  4. Which neo4j-jdbc and neo4j version are you using?
  5. Are you using BOLT or HTTP protocol?

Thanks

diannao720 commented 6 years ago

@omarlarus 1.no 2.yes 3.no error 4.neo4j-jdbc-driver 3.1.0 neo4j neo4j-enterprise-3.4.0-alpha06 5.Bolt

omarlarus commented 6 years ago

@diannao720 try to enable the neo4j log using the dbms.logs.query.enabled=true and dbms.logs.query.threshold=0 in the neo4j.conf of your database. Test it executing some query via browser and if it's all right and you can see the log, run your code. If you can see the query the issue is on the transaction management otherwise in the something before the call. I suggest you enable some log for the MyBatis too.

diannao720 commented 6 years ago
2018-10-23 03:36:16.157+0000 INFO  1995 ms: embedded-session         - MATCH (a:` Arbitrary label name that really doesn't matter `) RETURN a LIMIT 0 - {} - {}
2018-10-23 03:36:16.501+0000 INFO  407 ms: bolt-session bolt    neo4j   neo4j-javascript/1.4.1      client/127.0.0.1:51982  server/127.0.0.1:7687>  neo4j - 
CALL db.labels() YIELD label
WITH COLLECT(label)[..1000] AS labels
RETURN 'labels' as a, labels as result
UNION
CALL db.relationshipTypes() YIELD relationshipType
WITH COLLECT(relationshipType)[..1000] AS relationshipTypes
RETURN 'relationshipTypes' as a, relationshipTypes as result
UNION
CALL db.propertyKeys() YIELD propertyKey
WITH COLLECT(propertyKey)[..1000] AS propertyKeys
RETURN 'propertyKeys' as a, propertyKeys as result
UNION
CALL dbms.functions() YIELD name, signature, description
WITH collect({name: name, signature: signature, description: description}) as functions
RETURN 'functions' as a, functions AS result
UNION
CALL dbms.procedures() YIELD name, signature, description
WITH collect({name: name, signature: signature, description: description}) as procedures
RETURN 'procedures' as a, procedures as result
 - {} - {}
2018-10-23 03:36:16.619+0000 INFO  84 ms: bolt-session  bolt    neo4j   neo4j-javascript/1.4.1      client/127.0.0.1:51982  server/127.0.0.1:7687>  neo4j - CALL dbms.queryJmx("org.neo4j:*") - {} - {}
2018-10-23 03:36:16.770+0000 INFO  47 ms: bolt-session  bolt    neo4j   neo4j-javascript/1.4.1      client/127.0.0.1:51982  server/127.0.0.1:7687>  neo4j - CALL dbms.queryJmx("org.neo4j:*") - {} - {}
2018-10-23 03:36:16.886+0000 INFO  47 ms: bolt-session  bolt    neo4j   neo4j-javascript/1.4.1      client/127.0.0.1:51982  server/127.0.0.1:7687>  neo4j - CALL dbms.queryJmx("org.neo4j:*") - {} - {}
2018-10-23 03:36:35.743+0000 INFO  45 ms: bolt-session  bolt    neo4j   neo4j-javascript/1.4.1      client/127.0.0.1:51982  server/127.0.0.1:7687>  neo4j - 
CALL db.labels() YIELD label
WITH COLLECT(label)[..1000] AS labels
RETURN 'labels' as a, labels as result
UNION
CALL db.relationshipTypes() YIELD relationshipType
WITH COLLECT(relationshipType)[..1000] AS relationshipTypes
RETURN 'relationshipTypes' as a, relationshipTypes as result
UNION
CALL db.propertyKeys() YIELD propertyKey
WITH COLLECT(propertyKey)[..1000] AS propertyKeys
RETURN 'propertyKeys' as a, propertyKeys as result
UNION
CALL dbms.functions() YIELD name, signature, description
WITH collect({name: name, signature: signature, description: description}) as functions
RETURN 'functions' as a, functions AS result
UNION
CALL dbms.procedures() YIELD name, signature, description
WITH collect({name: name, signature: signature, description: description}) as procedures
RETURN 'procedures' as a, procedures as result
 - {} - {}
2018-10-23 03:36:35.787+0000 INFO  22 ms: bolt-session  bolt    neo4j   neo4j-javascript/1.4.1      client/127.0.0.1:51982  server/127.0.0.1:7687>  neo4j - CALL dbms.queryJmx("org.neo4j:*") - {} - {}
2018-10-23 03:36:35.860+0000 INFO  20 ms: bolt-session  bolt    neo4j   neo4j-javascript/1.4.1      client/127.0.0.1:51982  server/127.0.0.1:7687>  neo4j - CALL dbms.queryJmx("org.neo4j:*") - {} - {}
2018-10-23 03:36:35.928+0000 INFO  20 ms: bolt-session  bolt    neo4j   neo4j-javascript/1.4.1      client/127.0.0.1:51982  server/127.0.0.1:7687>  neo4j - CALL dbms.queryJmx("org.neo4j:*") - {} - {}
2018-10-23 03:36:56.718+0000 INFO  21 ms: bolt-session  bolt    neo4j   neo4j-javascript/1.4.1      client/127.0.0.1:51982  server/127.0.0.1:7687>  neo4j - 
CALL db.labels() YIELD label
WITH COLLECT(label)[..1000] AS labels
RETURN 'labels' as a, labels as result
UNION
CALL db.relationshipTypes() YIELD relationshipType
WITH COLLECT(relationshipType)[..1000] AS relationshipTypes
RETURN 'relationshipTypes' as a, relationshipTypes as result
UNION
CALL db.propertyKeys() YIELD propertyKey
WITH COLLECT(propertyKey)[..1000] AS propertyKeys
RETURN 'propertyKeys' as a, propertyKeys as result
UNION
CALL dbms.functions() YIELD name, signature, description
WITH collect({name: name, signature: signature, description: description}) as functions
RETURN 'functions' as a, functions AS result
UNION
CALL dbms.procedures() YIELD name, signature, description
WITH collect({name: name, signature: signature, description: description}) as procedures
RETURN 'procedures' as a, procedures as result
 - {} - {}
2018-10-23 03:36:56.808+0000 INFO  54 ms: bolt-session  bolt    neo4j   neo4j-javascript/1.4.1      client/127.0.0.1:51982  server/127.0.0.1:7687>  neo4j - CALL dbms.queryJmx("org.neo4j:*") - {} - {}
2018-10-23 03:36:56.868+0000 INFO  21 ms: bolt-session  bolt    neo4j   neo4j-javascript/1.4.1      client/127.0.0.1:51982  server/127.0.0.1:7687>  neo4j - CALL dbms.queryJmx("org.neo4j:*") - {} - {}
2018-10-23 03:36:56.931+0000 INFO  23 ms: bolt-session  bolt    neo4j   neo4j-javascript/1.4.1      client/127.0.0.1:51982  server/127.0.0.1:7687>  neo4j - CALL dbms.queryJmx("org.neo4j:*") - {} - {}
2018-10-23 03:37:16.923+0000 INFO  73 ms: bolt-session  bolt    neo4j   neo4j-java/dev      client/127.0.0.1:51998  server/127.0.0.1:7687>  neo4j - Create (p:Knowledge {name: {1},id: {2}}) - {2: '500', 1: 'aaaaaa'} - {}
2018-10-23 03:37:17.702+0000 INFO  9 ms: bolt-session   bolt    neo4j   neo4j-javascript/1.4.1      client/127.0.0.1:51982  server/127.0.0.1:7687>  neo4j - 
CALL db.labels() YIELD label
WITH COLLECT(label)[..1000] AS labels
RETURN 'labels' as a, labels as result
UNION
CALL db.relationshipTypes() YIELD relationshipType
WITH COLLECT(relationshipType)[..1000] AS relationshipTypes
RETURN 'relationshipTypes' as a, relationshipTypes as result
UNION
CALL db.propertyKeys() YIELD propertyKey
WITH COLLECT(propertyKey)[..1000] AS propertyKeys
RETURN 'propertyKeys' as a, propertyKeys as result
UNION
CALL dbms.functions() YIELD name, signature, description
WITH collect({name: name, signature: signature, description: description}) as functions
RETURN 'functions' as a, functions AS result
UNION
CALL dbms.procedures() YIELD name, signature, description
WITH collect({name: name, signature: signature, description: description}) as procedures
RETURN 'procedures' as a, procedures as result
 - {} - {}
2018-10-23 03:37:17.755+0000 INFO  29 ms: bolt-session  bolt    neo4j   neo4j-javascript/1.4.1      client/127.0.0.1:51982  server/127.0.0.1:7687>  neo4j - CALL dbms.queryJmx("org.neo4j:*") - {} - {}
2018-10-23 03:37:17.879+0000 INFO  32 ms: bolt-session  bolt    neo4j   neo4j-javascript/1.4.1      client/127.0.0.1:51982  server/127.0.0.1:7687>  neo4j - CALL dbms.queryJmx("org.neo4j:*") - {} - {}
2018-10-23 03:37:18.008+0000 INFO  29 ms: bolt-session  bolt    neo4j   neo4j-javascript/1.4.1      client/127.0.0.1:51982  server/127.0.0.1:7687>  neo4j - CALL dbms.queryJmx("org.neo4j:*") - {} - {}
diannao720 commented 6 years ago

The above log <insert id="insertNode" parameterType="java.util.HashMap"> Create (p:Knowledge {name: "aaaaaa",id: 500}) </insert>

conker84 commented 5 years ago

hi @diannao720 do you still have the problem?

diannao720 commented 5 years ago

Yes, I've given up

michael-simons commented 7 months ago

MyBatis is under test in version 6, and works as expected. I'm closing this issue.

If there are new problems, please open a new one or reopen this.

Here's a link to the tests

https://github.com/neo4j/neo4j-jdbc/blob/19476b21625d628cedd5137057f02e9fdd923907/neo4j-jdbc-it/mybatis-smoke-tests/src/test/java/org/neo4j/jdbc/it/mybatis/MoviesTests.java#L43-L78