用spring继续坚持hsqldb

时间:2013-05-04 10:10:54

标签: spring persistence hsqldb

我正在努力坚持使用spring和hsqldb。我检查了几个问题但无法找到解决方案:

签出的帖子: No schema in file database after running program persisted to hsqldb:file via hibernate HSQLDB and Hibernate/JPA - not persisting to disk? Hibernate doesn't save any records in database

但到目前为止这没有任何帮助。每次我重新启动我的网络服务器时,所有更改都会消失,并且没有任何内容写入我的硬盘。

Hibernate配置如下

@Bean
public AnnotationSessionFactoryBean sessionFactoryBean() {
    Properties props = new Properties();
    props.put("hibernate.dialect", HSQLDialect.class.getName());
    props.put("hibernate.format_sql", "true");
    props.put("hibernate.show_sql", "true");
    props.put("hibernate.hbm2ddl.auto", "update");
    props.put("hibernate.connection.url", "jdbc:hsqldb:file:c:\\temp\\rvec");
    props.put("hibernate.connection.username", "sa");
    props.put("hibernate.connection.password", "");
    props.put("hibernate.connection.pool_size","1");
    props.put("hibernate.connection.autocommit", "true");


    AnnotationSessionFactoryBean bean = new AnnotationSessionFactoryBean();
    bean.setAnnotatedClasses(new Class[]{Course.class, User.class, Event.class});       
    bean.setHibernateProperties(props);

    bean.setDataSource(this.dataSource);
    bean.setSchemaUpdate(true);
    return bean;
}

数据源和事务管理器在servlet-context.xml中配置     

<tx:annotation-driven transaction-manager="transactionManager" />

控制台中没有抛出错误,只有有效的sql语句。 有什么想法吗?

亲切的问候, Lomu

0 个答案:

没有答案