Search code examples
mavenexceptionintellij-ideaspring-batchjdbctemplate

user lacks privilege or object not found: Object


I was following the following basic spring batch tutorial https://spring.io/guides/gs/batch-processing/ .

  • I am using IntelliJ 14 and created a Spring-Batch project

  • I am using Mavin. And I have pom.xml file.

  • I haven't created any file except under src/main/resources/sample-data.csv.
  • I didn't create any DB or JDBCTemplate since I assume it is not needed since the tutorial uses in Memory DB.
  • Mvn clean install works fine even though the Application.java shows me "Couldn't autowire. No beans of jdbcTempalte type can be found" @Autowired JdbcTemplate jdbcTemplate;

  • Spring-config has the following

    <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans.xsd">

  • I am getting an error when I try to do mvn spring-boot:run

    The cause by shows Caused by: org.hsqldb.HsqlException: user lacks privilege or object not found: PEOPLE

    What am I missing? I appreciate your help.


Solution

  • You should put schema initialisation in your src/main/resources. Spring batch automatically runs schema-@@platform@@.sql during startup and -all tells it to be for all platforms as noted in readme.adoc on github:

    Next, you write a SQL script to create a table to store the data.

    src/main/resources/schema-all.sql

    link:initial/src/main/resources/schema-all.sql

    Note: Spring Boot runs schema-@@platform@@.sql automatically during startup. -all is the default for all platforms.