HSQL 在 Hibernate 中的配置 博客分类: Hibernate hsqlhibernate
程序员文章站
2024-03-22 15:52:34
...
将 HSQLDB 中lib下的hsqldb.jar文件导入到项目中
cmd 进入 HSQLDB 中 data 文件夹下,输入 java -classpath ../lib/hsqldb.jar org.hsqldb.Server 就可启动数据库。如果你希望在本例中运行一个全新的数据库,就在窗口中按下 CTRL + C来关闭 HSQL 数据库,并删除 data/ 目录下的所有文件,再重新启动 HSQL 数据库。
HSQL 在 properties 文件中的配置:
hibernate.connection.driver_class = org.postgresql.Driver hibernate.connection.url = jdbc:postgresql://localhost/mydatabase hibernate.connection.username = myuser hibernate.connection.password = secret hibernate.c3p0.min_size=5 hibernate.c3p0.max_size=20 hibernate.c3p0.timeout=1800 hibernate.c3p0.max_statements=50 hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
HSQL 在 *.cfg.xml 文件中的配置:
<?xml version='1.0' encoding='utf-8'?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <!-- Database connection settings --> <property name="connection.driver_class">org.hsqldb.jdbcDriver</property> <property name="connection.url">jdbc:hsqldb:hsql://localhost</property> <property name="connection.username">sa</property> <property name="connection.password"></property> <!-- JDBC connection pool (use the C3P0) --> <property name="c3p0.min_size">5</property> <property name="c3p0.max_size">20</property> <property name="c3p0.timeout">1800</property> <property name="c3p0.max_statements">50</property> <!-- SQL dialect --> <property name="dialect">org.hibernate.dialect.HSQLDialect</property> <!-- Enable Hibernate's automatic session context management --> <property name="current_session_context_class">thread</property> <!-- Disable the second-level cache --> <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property> <!-- Echo all executed SQL to stdout --> <property name="show_sql">true</property> <!-- Drop and re-create the database schema on startup --> <property name="hbm2ddl.auto">update</property> </session-factory> </hibernate-configuration>
推荐阅读
-
HSQL 在 Hibernate 中的配置 博客分类: Hibernate hsqlhibernate
-
hibernate中映射长文本类型的通用方式 博客分类: java HibernateMySQLOraclePostgreSQL
-
spring+hibernate中clob、blob字段的处理方法 博客分类: hibernate SpringHibernateBeanJDBCOracle
-
遗留系统hibernate升级到spring+hibernate的问题 博客分类: java apps HibernateSpring配置
-
的含义
博客分类: JavaHibernate java字符串日期hibernatehbm2ddl ">
Java 字符串转换为日期,hibernate配置文件
的含义 博客分类: JavaHibernate java字符串日期hibernatehbm2ddl -
hibernate的hql中的java常量会引起性能问题 博客分类: hibernate
-
Mybatis sqlMapConfig.xml中的常用配置 博客分类: Hibernate/MyBatis
-
Mybatis sqlMapConfig.xml中的常用配置 博客分类: Hibernate/MyBatis
-
面向接口编程在hibernate中的应用 博客分类: hibernate 编程HibernateJavaBeanDAO
-
面向接口编程在hibernate中的应用 博客分类: hibernate 编程HibernateJavaBeanDAO