HSQL一个简短的引论
仅一个hsqldb.jar文件就包含了数据库引擎。数据库驱动。还有其它用户界面操作等内容。在Java开源世界里。hsql是极为受欢迎的(就Java本身来说),JBoss应用程序server默认也提供了这个数据库引擎。因为其体积小的原因。又是纯Java设计。又支持SQL99。SQL2003大部分的标准。所以也是作为商业应用程序展示的一种选择。
结合Hibernate数据库无关的特性。很适合在项目开发的时候使用。
单元測试的时候,启动HSQLDB的file模式,数据不存盘,能够保证測试原子性。
package com.demandforce.dao; import java.util.Collection; import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.util.Assert; import com.demandforce.model.TextMessageTemplate; @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:context/hyperSqlContext.xml"})
public class TextMessageTemplateRetrievalTest { @Autowired
private TextMessageTemplateDao textMessageTemplateDao; @Test
public void testSelectByBusinessCategory() {
Collection<TextMessageTemplate> tmts = textMessageTemplateDao.selectByBusinessCategory( 203, 0);
Assert.notNull(tmts);
Assert.isTrue(tmts.size() == 2);
}
}
<?xml version="1.0" encoding="UTF-8"? >
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd">
<jdbc:embedded-database id="dataSource" type="HSQL">
<jdbc:script location="classpath:sql/setup.sql" />
<jdbc:script location="classpath:sql/schema-create.sql" />
<jdbc:script location="classpath:sql/data-insert.sql" />
</jdbc:embedded-database>
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<bean name="baseDao" abstract="true">
<property name="dataSource" ref="dataSource" />
</bean> <bean name="textMessageTemplateDao" class="com.demandforce.dao.TextMessageTemplateDaoImpl" parent="baseDao" />
</beans>
--
-- MySQL compatibility mode for Hyper SQL SET DATABASE SQL SYNTAX MYS TRUE;
DROP TABLE IF EXISTS TextMessageTemplate; CREATE TABLE TextMessageTemplate (
ID INT NOT NULL AUTO_INCREMENT,
BusinessID INT NOT NULL,
Type INT NOT NULL,
Template varchar(1000),
CreatedDate datetime DEFAULT NULL,
LastModifiedDate timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
CreatedUserId INT DEFAULT 0,
LastModifiedUserId INT DEFAULT 0,
Delivery INT DEFAULT 0,
DeliveryWindow INT DEFAULT 1,
BusinessCalendar INT NOT NULL DEFAULT 0,
DeliveryTime datetime DEFAULT NULL,
CardCount INT DEFAULT 0,
Segment INT DEFAULT 0,
FrontImage varchar(255) DEFAULT NULL,
IncludeItems INT DEFAULT 1,
IncludeReview INT DEFAULT 1,
IncludeCoupon INT DEFAULT 1,
services varchar(5000) DEFAULT NULL,
Industry INT DEFAULT NULL,
PRIMARY KEY (ID)
);
INSERT INTO TextMessageTemplate (BusinessID, Type, Template, Industry)
VALUES ('0', '203', 'Template1', null); INSERT INTO TextMessageTemplate (BusinessID, Type, Template, Industry)
VALUES ('0', '204', 'Template2', null);
版权声明:本文博主原创文章,博客,未经同意不得转载。
HSQL一个简短的引论的更多相关文章
- Saiku一个简短的引论
一个简短的引论 Saiku成立于2008年,通过Tom Barber和Paul Stoellberger研究. 最初叫Pentaho分析工具.最初是基于OLAP4J图书馆的使用GWT采用前端分析工具包 ...
- Hibernate一个简短的引论
我们从几个方面进行阐述Hibernate When? What ? How? When? Hibernate由来是因为当时EJBBean1.1在处理entittBean架构时,花费的时间要比业务逻辑很 ...
- Jsoup一个简短的引论——采用Java抓取网页数据
转载请注明出处:http://blog.csdn.net/allen315410/article/details/40115479 概述 jsoup 是一款Java 的HTML解析器,可直接解析某个U ...
- Mybatis之ResultMap一个简短的引论,关联对象
基础部分能够查看我的还有一篇博客http://blog.csdn.net/elim168/article/details/40622491 MyBatis中在查询进行select映射的时候.返回类型能 ...
- Spark第一个研究笔记1一片 - Spark一个简短的引论
该公司推出的在线项目Spark拥有近1随着时间的推移.有效,Spark事实上,优秀的分布式计算平台,以提高生产力. 开始本篇笔记.此前的研究会Spark研究报告共享出来(由于篇幅的限制,它将被划分成制 ...
- Cache基础知识OR1200在ICache一个简短的引论
以下摘录<步骤吓得核心--软-core处理器的室内设计与分析>一本书 12.1 Cache基本知识 12.1.1 Cache的作用 处理器的设计者通常会声称其设计的处理器一秒钟能做多少次乘 ...
- HTML5分析实战WebSockets一个简短的引论
HTML5 WebSockets规范定义了API,同意web页面使用WebSockets与远程主机协议的双向通信. 介绍WebSocket接口,并限定了全双工通信信道,通过套接字网络. HTML5 W ...
- Oracle 指数 一个简短的引论
1 索引创建语法: CREATE UNIUQE | BITMAP INDEX <schema>.<index_name> ON <schema>.< ...
- PL/SQL一个简短的引论
前言 文本 PL/SQL (Procedure Language,程序语言)SQL 1999主要的数据库供应商提供结构化的共同语言 PL/SQL只有支持Oracle数据库 基本的语法 多行凝视 ...
随机推荐
- Oracle 排序问题(null带来的)
null 导致排序有问题, 对于数字的,一定要用nvl来解决.
- [TypeScript] Using Interfaces to Describe Types in TypeScript
It’s easy to pass the wrong value to a function. Typescript interfaces are great because they catch ...
- POJ 2642 The Brick Stops Here 0-1背包
poj: http://poj.org/problem?id=2642 大意: 给出n(n<=200)块黄铜合金,还有它们的浓度和价钱.给出若干个个询问使它们在n块中取 M 块 使得这M块合金的 ...
- openGL线型和线宽以及线的抗锯齿
openGL线型和线宽以及线抗锯齿 一. 线宽 Opengl的线宽设置:glLineWidth(width); width为float类型值,在0~10.0,大于10以上按10来处理. 若开启线的反走 ...
- SIP对话、事务详解
1,SIP对话的建立(图片来自于网络) SIP对话的建立包括invite request,response,ACK.其中response包含临时响应(1XX response)和最终响应(非1XX r ...
- [Angular2 Form] patchValue, setValue and reset() for Form
Learn how to update part of form model, full form model and reset whole form. We have form definetio ...
- Facebook开源软件列表
从 Facebook 的 GitHub 账户中可以看到,Facebook 已经开源的开源项目有近 300 个,领域涉及移动.前端.Web.后端.大数据.数据库.工具和硬件等.Facebook 开源项目 ...
- win7
http://www.xitongiso.com/?pot http://www.potplayer.org/
- [转载]剥析surging的架构思想
1.前言 2.通信机制 2.1 简介 在单体应用中,模块之间的调用通信通过引用加载方法或者函数来实现,但是单体应用最终都会因为团队壮大,项目模块的扩展和部署等出现难以维护的问题.随着业务需求 ...
- Unity3d优化包的大小
http://wenku.baidu.com/link?url=MEUtNP6k1W7gXK2LcHdKXGqwoTD4HZDsBpsu9iFYjuL3WCIXgl2-rBHhBWP_zo5Xm4Yx ...