Ok, sorry, my fault. I thought I correctly serialized maps in the jdbc driver.

So for now you'll have to go with individual fields. Sorry for that.

I fix it soon.

Michael

Am 10.02.2014 um 13:02 schrieb Licio Mazzeo <[email protected]>:

> Yes, i tried to do so .. but i got an exception..
> 
>  org.neo4j.jdbc.Neo4jConnection - Executing query: CREATE ({1})
>  with params {1={filter_level=medium ... } //the json 
> at org.neo4j.jdbc.Neo4jConnection.executeQuery(Neo4jConnection.java:255)
>       at 
> org.neo4j.jdbc.Neo4jPreparedStatement.executeQuery(Neo4jPreparedStatement.java:48)
>       at 
> org.pipe.java.web.netnografica.persistenza.graphdb.DAONodo.doInsertNodo(DAONodo.java:98)
>       at 
> org.pipe.java.web.netnografica.controllo.MyTwitterListener.onStatus(MyTwitterListener.java:52)
>       at twitter4j.StatusStreamImpl.onStatus(StatusStreamImpl.java:75)
>       at twitter4j.StatusStreamBase$1.run(StatusStreamBase.java:114)
>       at twitter4j.internal.async.ExecuteThread.run(DispatcherImpl.java:116)
> Caused by: java.lang.RuntimeException: Error executing cypher statement(s) 
> [{code=Neo.ClientError.Statement.ParameterMissing, message=Expected a 
> parameter named 1}]
>       at 
> org.neo4j.jdbc.rest.StreamingParser.handleErrors(StreamingParser.java:229)
>       at org.neo4j.jdbc.rest.StreamingParser.skipTo(StreamingParser.java:206)
>       at 
> org.neo4j.jdbc.rest.StreamingParser.nextResult(StreamingParser.java:95)
>       at 
> org.neo4j.jdbc.rest.StreamingParser$2.hasNext(StreamingParser.java:170)
>       at 
> org.neo4j.jdbc.rest.TransactionalQueryExecutor.executeQuery(TransactionalQueryExecutor.java:163)
>       at org.neo4j.jdbc.Neo4jConnection.executeQuery(Neo4jConnection.java:250)
>       ... 6 more
> 
> 
> This is my method
> 
> public void doInsertNode(Map<String, Object> map) {
>         Connection connection = null;
>         IDataSource dataSource = 
> DataSourceFactory.getInstance().getDataSource();
>         try {
>             connection = dataSource.getConnection();
>             PreparedStatement preparedStatement = 
> connection.prepareStatement("CREATE ({1})");
>             preparedStatement.setObject(1, map);
>             preparedStatement.executeQuery();
>         } catch (DAOException ex) {
>             Logger.getLogger(DAONodo.class.getName()).log(Level.SEVERE, null, 
> ex);
>         } catch (SQLException ex) {
>             Logger.getLogger(DAONodo.class.getName()).log(Level.SEVERE, null, 
> ex);
>         }
>     }
> 
> Thanks :)
> 
> Il giorno domenica 9 febbraio 2014 19:27:00 UTC+1, Michael Hunger ha scritto:
> Jdbc only allows for numeric parameters (starting at 1).
> 
>> Map<String, Object> params = new HashMap<String, Object>();
>> params.put( "name", "a Name" );
>> Now i'm thinking to do this 
>> connection = dataSource.getConnection();
>> PreparedStatement preparedStatement = connection.prepareStatement("CREATE 
>> ({1})");
>> preparedStatement.setObject(1, params);
>> preparedStatement.executeQuery();
> 
> Michael
> 
> Am 09.02.2014 um 17:24 schrieb Licio Mazzeo <[email protected]>:
> 
>> Hi all, i have a question. How can i create a node passing the json or a map 
>> into prepared statement just like the rest api docs?
>> 
>> Map<String, Object> params = new HashMap<String, Object>();
>> params.put( "props", props );
>> String query = "CREATE ({props})";
>> engine.execute( query, params );
>> 
>> Now i'm thinking to do this 
>> connection = dataSource.getConnection();
>> PreparedStatement preparedStatement = connection.prepareStatement("CREATE 
>> (n{?}");
>> preparedStatement.setObject(0, map);
>> preparedStatement.executeQuery();
>> 
>> but its sure wrong..
>> 
>> Thank you!!
>> 
>> -- 
>> 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/groups/opt_out.
> 
> 
> -- 
> 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/groups/opt_out.

-- 
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/groups/opt_out.

Reply via email to