Skip to content

Commit 1d70f7b

Browse files
committed
Upgrade MyBatis build to use HSQLDB 2.0.0
1 parent 9ecd368 commit 1d70f7b

File tree

9 files changed

+36
-28
lines changed

9 files changed

+36
-28
lines changed

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,9 @@
215215
<scope>test</scope>
216216
</dependency>
217217
<dependency>
218-
<groupId>hsqldb</groupId>
218+
<groupId>org.hsqldb</groupId>
219219
<artifactId>hsqldb</artifactId>
220-
<version>1.8.0.1</version>
220+
<version>2.0.0</version>
221221
<scope>test</scope>
222222
</dependency>
223223
<dependency>

src/test/java/com/ddl/hsql/jpetstore-hsqldb-schema.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ create table profile (
5555
userid varchar(80) not null,
5656
langpref varchar(80) not null,
5757
favcategory varchar(30),
58-
mylistopt int,
59-
banneropt int,
58+
mylistopt boolean,
59+
banneropt boolean,
6060
constraint pk_profile primary key (userid)
6161
);
6262

src/test/java/com/ibatis/sqlmap/maps/RepeatingGroupMapping.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,10 @@
9696
<select id="getAllProductCategoriesJIRA250" resultMap="categoryResultJIRA250">
9797
select
9898
c.catid, c.name as catname, c.descn as catdescn,
99-
null as productid, null as category, null as prodname,
100-
null as proddescn
99+
cast(null as varchar(1)) as productid,
100+
cast(null as varchar(1)) as category,
101+
cast(null as varchar(1)) as prodname,
102+
cast(null as varchar(1)) as proddescn
101103
from category c
102104
</select>
103105

src/test/java/com/ibatis/sqlmap/maps/SqlMapConfig.properties

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
driver=org.hsqldb.jdbcDriver
2-
url=jdbc:hsqldb:.
2+
3+
# HSQLDB2 requires that the get_column_name property be set false
4+
# for the returned column name to be the same as the label. This
5+
# is required for MyBatis tests where columns are renamed in a
6+
# select statement (select fred AS betty ...)
7+
url=jdbc:hsqldb:mem:somename;get_column_name=false
8+
39
username=sa
410
password=
511

src/test/java/com/scripts/order-init.sql

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ CREATE TABLE ORDERS (
2323

2424
-- Creating Test Data
2525

26-
INSERT INTO ORDERS VALUES (1, 1, '2003-02-15 8:15:00', 'VISA', '999999999999', '05/03', '11 This Street', 'Victoria', 'BC', 'C4B 4F4',2);
27-
INSERT INTO ORDERS VALUES (2, 4, '2003-02-15 8:15:00', 'MC', '888888888888', '06/03', '222 That Street', 'Edmonton', 'AB', 'X4K 5Y4',1);
28-
INSERT INTO ORDERS VALUES (3, 3, '2003-02-15 8:15:00', 'AMEX', '777777777777', '07/03', '333 Other Street', 'Regina', 'SK', 'Z4U 6Y4',2);
29-
INSERT INTO ORDERS VALUES (4, 2, '2003-02-15 8:15:00', 'MC', '666666666666', '08/03', '444 His Street', 'Toronto', 'ON', 'K4U 3S4',1);
30-
INSERT INTO ORDERS VALUES (5, 5, '2003-02-15 8:15:00', 'VISA', '555555555555', '09/03', '555 Her Street', 'Calgary', 'AB', 'J4J 7S4',2);
31-
INSERT INTO ORDERS VALUES (6, 5, '2003-02-15 8:15:00', 'VISA', '999999999999', '10/03', '6 Their Street', 'Victoria', 'BC', 'T4H 9G4',1);
32-
INSERT INTO ORDERS VALUES (7, 4, '2003-02-15 8:15:00', 'MC', '888888888888', '11/03', '77 Lucky Street', 'Edmonton', 'AB', 'R4A 0Z4',2);
33-
INSERT INTO ORDERS VALUES (8, 3, '2003-02-15 8:15:00', 'AMEX', '777777777777', '12/03', '888 Our Street', 'Regina', 'SK', 'S4S 7G4',1);
34-
INSERT INTO ORDERS VALUES (9, 2, '2003-02-15 8:15:00', 'MC', '666666666666', '01/04', '999 Your Street', 'Toronto', 'ON', 'G4D 9F4',2);
35-
INSERT INTO ORDERS VALUES (10, 1, '2003-02-15 8:15:00', 'VISA', '555555555555', '02/04', '99 Some Street', 'Calgary', 'AB', 'W4G 7A4',1);
26+
INSERT INTO ORDERS VALUES (1, 1, '2003-02-15 08:15:00', 'VISA', '999999999999', '05/03', '11 This Street', 'Victoria', 'BC', 'C4B 4F4',2);
27+
INSERT INTO ORDERS VALUES (2, 4, '2003-02-15 08:15:00', 'MC', '888888888888', '06/03', '222 That Street', 'Edmonton', 'AB', 'X4K 5Y4',1);
28+
INSERT INTO ORDERS VALUES (3, 3, '2003-02-15 08:15:00', 'AMEX', '777777777777', '07/03', '333 Other Street', 'Regina', 'SK', 'Z4U 6Y4',2);
29+
INSERT INTO ORDERS VALUES (4, 2, '2003-02-15 08:15:00', 'MC', '666666666666', '08/03', '444 His Street', 'Toronto', 'ON', 'K4U 3S4',1);
30+
INSERT INTO ORDERS VALUES (5, 5, '2003-02-15 08:15:00', 'VISA', '555555555555', '09/03', '555 Her Street', 'Calgary', 'AB', 'J4J 7S4',2);
31+
INSERT INTO ORDERS VALUES (6, 5, '2003-02-15 08:15:00', 'VISA', '999999999999', '10/03', '6 Their Street', 'Victoria', 'BC', 'T4H 9G4',1);
32+
INSERT INTO ORDERS VALUES (7, 4, '2003-02-15 08:15:00', 'MC', '888888888888', '11/03', '77 Lucky Street', 'Edmonton', 'AB', 'R4A 0Z4',2);
33+
INSERT INTO ORDERS VALUES (8, 3, '2003-02-15 08:15:00', 'AMEX', '777777777777', '12/03', '888 Our Street', 'Regina', 'SK', 'S4S 7G4',1);
34+
INSERT INTO ORDERS VALUES (9, 2, '2003-02-15 08:15:00', 'MC', '666666666666', '01/04', '999 Your Street', 'Toronto', 'ON', 'G4D 9F4',2);
35+
INSERT INTO ORDERS VALUES (10, 1, '2003-02-15 08:15:00', 'VISA', '555555555555', '02/04', '99 Some Street', 'Calgary', 'AB', 'W4G 7A4',1);

src/test/java/org/apache/ibatis/binding/BindingTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public void shouldExecuteBoundSelectMapOfBlogsById() {
127127
Map<Integer,Blog> blogs = mapper.selectBlogsAsMapById();
128128
assertEquals(2, blogs.size());
129129
for(Map.Entry<Integer,Blog> blogEntry : blogs.entrySet()) {
130-
assertEquals(blogEntry.getKey(), blogEntry.getValue().getId());
130+
assertEquals(blogEntry.getKey(), (Integer) blogEntry.getValue().getId());
131131
}
132132
} finally {
133133
session.close();

src/test/java/org/apache/ibatis/session/SqlSessionTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public void shouldSelectAllAuthorsAsMap() throws Exception {
104104
final Map<Integer,Author> authors = session.selectMap("domain.blog.mappers.AuthorMapper.selectAllAuthors", "id");
105105
assertEquals(2, authors.size());
106106
for(Map.Entry<Integer,Author> authorEntry : authors.entrySet()) {
107-
assertEquals(authorEntry.getKey(), authorEntry.getValue().getId());
107+
assertEquals(authorEntry.getKey(), (Integer) authorEntry.getValue().getId());
108108
}
109109
} finally {
110110
session.close();

src/test/java/org/apache/ibatis/submitted/complex_property/db/User.xml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,22 @@
77
<mapper namespace="User">
88

99
<resultMap type="UserAlias" id="UserResult">
10-
<id column="id" jdbcType="BIGINT" property="id"/>
10+
<id column="id" jdbcType="INTEGER" property="id"/>
1111
<result column="username" jdbcType="VARCHAR" property="username"/>
1212
<result column="password" jdbcType="VARCHAR" property="password.encrypted"/>
13-
<result column="administrator" jdbcType="BIT" property="administrator"/>
13+
<result column="administrator" jdbcType="BOOLEAN" property="administrator"/>
1414
</resultMap>
1515

1616
<select id="find" parameterType="long" resultMap="UserResult">
17-
SELECT * FROM user WHERE id = #{id:BIGINT}
17+
SELECT * FROM user WHERE id = #{id:INTEGER}
1818
</select>
1919

2020
<select id="version" parameterType="long" resultType="int">
21-
SELECT version FROM user WHERE id = #{id,jdbcType=BIGINT}
21+
SELECT version FROM user WHERE id = #{id,jdbcType=INTEGER}
2222
</select>
2323

2424
<delete id="delete" parameterType="UserAlias">
25-
DELETE FROM user WHERE id = #{id:BIGINT}
25+
DELETE FROM user WHERE id = #{id:INTEGER}
2626
</delete>
2727

2828
<insert id="insert" parameterType="UserAlias" useGeneratedKeys="false">
@@ -36,17 +36,17 @@
3636
( #{id},
3737
#{username,jdbcType=VARCHAR},
3838
#{password.encrypted:VARCHAR},
39-
#{administrator,jdbcType=BIT}
39+
#{administrator,jdbcType=BOOLEAN}
4040
)
4141
</insert>
4242

4343
<update id="update" parameterType="UserAlias">
4444
UPDATE user SET
4545
username = #{username,jdbcType=VARCHAR},
4646
password = #{password.encrypted,jdbcType=VARCHAR},
47-
administrator = #{administrator,jdbcType=BIT}
47+
administrator = #{administrator,jdbcType=BOOLEAN}
4848
WHERE
49-
id = #{id,jdbcType=BIGINT}
49+
id = #{id,jdbcType=INTEGER}
5050
</update>
5151

5252
<!-- Unique constraint check -->

src/test/java/org/apache/ibatis/submitted/complex_property/db/db.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ create table user (
22
id int,
33
username varchar(32) not null,
44
password varchar(128) not null,
5-
administrator int,
5+
administrator boolean,
66
primary key (id)
77
);

0 commit comments

Comments
 (0)