Update from 1.4.191 to 1.4.192 leads to unit test failure

103 views
Skip to first unread message

Wim Deblauwe

unread,
Sep 27, 2016, 11:21:39 AM9/27/16
to H2 Database
Hi,

I am using H2 1.4.191 (Pulled in via Spring Boot 1.3.5). I wanted to try to upgrade to Spring Boot 1.3.8 (which uses H2 1.4.192 by default), but one of my unit tests suddenly fails. I managed to make it work again by explicitly going back to H2 1.4.191 with Spring Boot 1.3.8. If I use H2 1.4.192 with Spring Boot 1.3.5, then the test also failed. So something must have changed in 1.4.192 which makes it fail.

I am using Spring Data and the unit test uses:

jdbcTemplate.queryForObject("SELECT image_id FROM game", Object.class)

This returns a non-null value using 1.4.191 and a null value using 1.4.192.

I know this is very little info to go by, but maybe it rings a bell with somebody?

regards,

Wim

Wim Deblauwe

unread,
Sep 27, 2016, 11:44:16 AM9/27/16
to H2 Database
Update:

I have found via the debugger that there is indeed a behavioural change between 1.4.191 and 1.4.192. The jdbcTemplate from Spring uses in the end the "resultSet.getObject(index, requiredType)" method. In 1.4.191, this throws an AbstractMethodError, which Spring handles by calling another method. In 1.4.192, this no longer throws this exception, but the method in H2 returns null. 

The org.h2.result.LocalResult has 1 row with 1 value with a ValueBytes object of 16 bytes (representing a UUID).

Should this be considered a bug in H2 1.4.192 ?

regards,

Wim

Op dinsdag 27 september 2016 17:21:39 UTC+2 schreef Wim Deblauwe:

Noel Grandin

unread,
Sep 28, 2016, 2:43:22 AM9/28/16
to h2-da...@googlegroups.com
That is unfortunate.

Luckily Philippe Marschall has already implemented that method properly, so if you build a jar from our repository, that should fix your bug.


Wim Deblauwe

unread,
Sep 29, 2016, 2:06:20 AM9/29/16
to H2 Database
Good to hear that there is a fix. For now, I replaced:

jdbcTemplate.queryForObject("SELECT image_id FROM game", Object.class)

with:

jdbcTemplate.queryForObject("SELECT image_id FROM game", byte[].class)

And that makes it work as will with H2 1.4.192.

regards,

Wim


Op woensdag 28 september 2016 08:43:22 UTC+2 schreef Noel Grandin:

Philippe Marschall

unread,
Oct 3, 2016, 1:14:03 PM10/3/16
to H2 Database


On Wednesday, September 28, 2016 at 8:43:22 AM UTC+2, Noel Grandin wrote:
That is unfortunate.

Luckily Philippe Marschall has already implemented that method properly, so if you build a jar from our repository, that should fix your bug.

Well byte[] was one of the classes I left out :-( but I added it now :-)


Cheers
Philippe

Philippe Marschall

unread,
Oct 3, 2016, 1:15:26 PM10/3/16
to H2 Database


On Thursday, September 29, 2016 at 8:06:20 AM UTC+2, Wim Deblauwe wrote:
Good to hear that there is a fix. For now, I replaced:

jdbcTemplate.queryForObject("SELECT image_id FROM game", Object.class)

with:

jdbcTemplate.queryForObject("SELECT image_id FROM game", byte[].class)

This should also remove the need for a cast, shouldn't it? What data type is image_id?

Cheers
Philippe

Wim Deblauwe

unread,
Oct 4, 2016, 2:58:28 AM10/4/16
to H2 Database
I only did a check if it was not null in my unit test, so there was no cast involved.

regards,

Wim

Op ma 3 okt. 2016 om 19:15 schreef Philippe Marschall <philippe....@gmail.com>:
--
You received this message because you are subscribed to a topic in the Google Groups "H2 Database" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/h2-database/InWprFw2B0o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to h2-database...@googlegroups.com.
To post to this group, send email to h2-da...@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages