Statement statement = conn.createStatement();
// characters
ResultSet rs = statement.executeQuery ("SELECT * FROM characters");
while (rs.next()) {
CharacterEntity character = new CharacterEntity (
rs.getInt ("character_id"),
rs.getInt ("ja_ucs_code"),
rs.getInt ("ja_element_id"),
rs.getInt ("ja_jis_code"),
rs.getInt ("ja_jouyou_grade"),
rs.getInt ("zh_simplified_ucs_code"),
rs.getInt ("zh_simplified_element_id"),
rs.getInt ("zh_traditional_ucs_code"),
rs.getInt ("zh_traditional_element_id")
);
allCharacters.put (new Integer (character.characterId), character);
}
// character_readings
rs = statement.executeQuery ("SELECT * FROM character_readings");
while (rs.next()) {
int characterId = rs.getInt("character_id");
CharacterEntity character = (CharacterEntity)allCharacters.get (new Integer (characterId));
character.readings.set (
rs.getString("source_language_code"),
new Integer (rs.getInt("reading_index")),
new Reading (
rs.getString("source_reading"),
rs.getString("jp_reading_type")
)
);
}
// character_reading_meanings
rs = statement.executeQuery ("SELECT * FROM character_reading_meanings");
while (rs.next()) {
int characterId = rs.getInt("character_id");
CharacterEntity character = (CharacterEntity)allCharacters.get (new Integer (characterId));
Reading reading = character.readings.get (rs.getString("source_language_code"), new Integer (rs.getInt("reading_index")));
reading.meanings.set (
rs.getString("dest_language_code"),
new Reading.Meaning (
rs.getString("dest_reading_meaning")
)
);
}
// character_meanings
rs = statement.executeQuery ("SELECT * FROM character_meanings");
while (rs.next()) {
int characterId = rs.getInt("character_id");
CharacterEntity character = (CharacterEntity)allCharacters.get (new Integer (characterId));
character.meanings.set (
rs.getString ("source_language_code"),
rs.getString ("dest_language_code"),
new Meaning (
rs.getString ("dest_meaning")