Skip to content

Commit

Permalink
OGM-1407 Add test for positional parameters with native Cypher queries
Browse files Browse the repository at this point in the history
  • Loading branch information
vkuragin authored and DavideD committed Apr 20, 2018
1 parent fb068e0 commit d762dbf
Showing 1 changed file with 17 additions and 0 deletions.
Expand Up @@ -182,6 +182,23 @@ public void testNativeQueryExecuteUpdate() throws Exception {
em.getTransaction().commit();
}

@Test
public void testQueryWithPositionalParams() {
em.getTransaction().begin();

long id = 1L;
String author = "Oscar Wilde";

String nativeQuery = "MATCH ( n:" + TABLE_NAME + " { id: {0}, author: { 1 }} ) RETURN n";
Query query = em.createNativeQuery( nativeQuery, OscarWildePoem.class );
query.setParameter( 0, id );
query.setParameter( 1, author );
OscarWildePoem result = (OscarWildePoem) query.getSingleResult();
assertAreEquals( portia, result );

em.getTransaction().commit();
}

private void persist(Object... entities) {
EntityManager em = createEntityManager();
em.getTransaction().begin();
Expand Down

0 comments on commit d762dbf

Please sign in to comment.