mercredi 19 juillet 2017

Spring data jpa test issue, Caused by: org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement

I have a spring data jpa test something like that. And I have a SQL
@RunWith(SpringRunner.class) @DataJpaTest

public class UserRepositoryTest {
@Autowired
private UserRepository repository;


@Before
public void setUp() throws Exception {

    repository.save(new User("Test User"));
}

......

I have a data.sql file in class path with some insert statements. While running the test, I get this error.

Caused by: org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "INSERT INTO USER(ID, NAME) VALUE[] (1, 'TEST') "; expected "DIRECT, SORTED, DEFAULT, VALUES, SET, (, SELECT, FROM"; SQL statement:INSERT INTO USER(ID, NAME) VALUE[] (1, 'TEST') [42001-192] at org.h2.message.DbException.getJdbcSQLException(DbException.java:345) ~[h2-1.4.192.jar:1.4.192] at org.h2.message.DbException.getSyntaxError(DbException.java:205) ~[h2-1.4.192.jar:1.4.192] at org.h2.command.Parser.getSyntaxError(Parser.java:537) ~[h2-1.4.192.jar:1.4.192]

Aucun commentaire:

Enregistrer un commentaire