SQL オブジェクト API を使用してDBGame
の行にマップできますか? GAMES
これが私の試みです:
データクラス:
public class Game {
protected int id;
protected int whoseTurn;
protected int winner;
protected char[][] board;
public Game(int id, int turn, int winner, char[][] board ) {
this.id=id;
this.whoseTurn=turn;
this.winner=winner;
this.board=board;
}
@JsonProperty
public int getId() {
return id;
}
@JsonInclude(Include.NON_NULL)
public int getWhoseTurn() {
return whoseTurn;
}
@JsonInclude(Include.NON_NULL)
public int getWinner() {
return winner;
}
public char[][] getBoard() {
return board;
}
}
ダオ:
@RegisterMapper(GameMapper.class)
public interface GameDAO {
@SqlUpdate("create table if not exists GAMES (ID integer, WHOSE_TURN varchar(10), WINNER varchar(10), BOARD char(1)[][])")
void createTableIfNotExists();
@SqlUpdate("insert into GAMES (ID, WHOSE_TURN, WINNER, BOARD) values (:id, :whoseTurn, :winner, :board)")
void insert(@BindBean Game game);
}
がinsert
呼び出されると、次のエラーが発生します。
org.postgresql.util.PSQLException: Can't infer the SQL type to use for an instance of [[C. Use setObject() with an explicit Types value to specify the type to use.
とは[[C
? なんとかしてこれを機能させることはできますか?そうでない場合は、代替案をいただければ幸いです。