spring中 HSQLDB使用

1、在pom中配置

  <!-- HSQLDB -->

        <dependency>

            <groupId>hsqldb</groupId>

            <artifactId>hsqldb</artifactId>

            <version>${hsqldb.version}</version>

        </dependency>

2、spring配置文件中配置

<!-- HSQLDB Embedded Database -->

<jdbc:embedded-database id="dataSource">

<jdbc:script location="classpath:schema.sql"/>

<jdbc:script location="classpath:data.sql"/>

</jdbc:embedded-database>

一个是建表语句,另外一个是数据语句。

3、在Dao层中继承JdbcDaoSupport

并且在自动装配中装配

 @Autowired

    public EmployeeDaoImpl(DataSource dataSource) {

        setDataSource(dataSource);

    }

你可能感兴趣的:(spring中 HSQLDB使用)