Skip to content

Commit

Permalink
Uses lowercase for database column names in se database archetype to …
Browse files Browse the repository at this point in the history
…fix issue #4187 (#4273)

Uses lowercase for database column names in se database archetype to fix issue #4187

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>
  • Loading branch information
ljnelson authored Jun 15, 2022
1 parent 1ed4574 commit ebf640d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2021 Oracle and/or its affiliates.
Copyright (c) 2021, 2022 Oracle and/or its affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -151,14 +151,14 @@
webClient.get()
.path("/pokemon/1")
.request(JsonObject.class)
.thenAccept(pokemon -> assertThat(pokemon.getString("NAME"), is("Bulbasaur")))
.thenAccept(pokemon -> assertThat(pokemon.getString("name"), is("Bulbasaur")))
.toCompletableFuture()
.get();
webClient.get()
.path("/pokemon/name/Charmander")
.request(JsonObject.class)
.thenAccept(pokemon -> assertThat(pokemon.getJsonNumber("ID_TYPE").intValue(), is(10)))
.thenAccept(pokemon -> assertThat(pokemon.getJsonNumber("id_type").intValue(), is(10)))
.toCompletableFuture()
.get();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
db:
source: jdbc
connection:
url: jdbc:h2:mem:test;DB_CLOSE_DELAY=-1
url: jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DATABASE_TO_LOWER=TRUE
# url: jdbc:h2:tcp://localhost:1521/test
username: sa
password:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ public class PokemonMapperProvider implements DbMapperProvider {
@Override
public Pokemon read(DbRow row) {
DbColumn id = row.column("ID");
DbColumn name = row.column("NAME");
DbColumn type = row.column("ID_TYPE");
DbColumn id = row.column("id");
DbColumn name = row.column("name");
DbColumn type = row.column("id_type");
return new Pokemon(id.as(Integer.class), name.as(String.class), type.as(Integer.class));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

package {{package}};

import java.util.List;
Expand All @@ -15,7 +14,7 @@ import io.helidon.dbclient.spi.DbMapperProvider;
/**
* Provider for PokemonType mappers.
*
* Pokemon, and Pokemon character names are trademarks of Nintendo.
* Pokemon, and Pokemon character names, are trademarks of Nintendo.
*/
@Priority(1000)
public class PokemonTypeMapperProvider implements DbMapperProvider {
Expand All @@ -34,8 +33,8 @@ public class PokemonTypeMapperProvider implements DbMapperProvider {
@Override
public PokemonType read(DbRow row) {
DbColumn id = row.column("ID");
DbColumn name = row.column("NAME");
DbColumn id = row.column("id");
DbColumn name = row.column("name");
return new PokemonType(id.as(Integer.class), name.as(String.class));
}

Expand Down

0 comments on commit ebf640d

Please sign in to comment.