String myQuery1 = "insert into mytable(mycol) values(myval) \ngo";
String myQuery2 = "insert into mytable(mycol) values(myval2) \ngo";
String myQuery = myQuery1 + myQuery2;
Query query = myEntityManager.createNativeQuery(myQuery);
List<?> insertResultList = queryInsertDefaults.getResultList();
using the eclpise debugger I can see the string used, it works fine when I copy and paste into sql server management studio - so I am guessing there is something to do with entity manger that doesn't like multiple line statements/go ... ?
Any advice gratefully recieved (yeah I know about stringbuilder etc etc), and the error I get is :
SQL Error: 102, SQLState: S0001
Incorrect syntax near 'go'.
EDIT turns out insert is not supported by entitymanager and query class. So I have to use either a prepared statement or persist the object.