statement3.execute("CREATE TABLE accomodation_fare_relations (\n" + " id integer,\n" + " id_accomodation integer NOT NULL,\n" + " id_room_fare integer NOT NULL,\n" + " PRIMARY KEY (id),\n" + " FOREIGN KEY (id_accomodation) REFERENCES accomodation(id)\n" + " ON DELETE CASCADE,\n" + " FOREIGN KEY (id_room_fare) REFERENCES room_fare(id)\n" + " ON DELETE CASCADE\n" + ");"); This should create my table, and this should make a query: @Test public void testSelect() throws SQLException { PreparedStatement ps = conn.prepareStatement("SELECT " + "accomodation.type," + "room_fare.value," + "room_fare.season " + "FROM accomodation_fare_relations " + "JOIN accomodation ON accomodation.id = accomodation_fare_relations.id_accomodation " + "JOIN room_fare ON room_fare.id = accomodation_fare_relations.id_room_fare"); ResultSet resultSet = ps.executeQuery(); while (resultSet.next()) { System.out.println(resultSet.getString("type")); System.out.println(resultSet.getDouble("value")); System.out.println(resultSet.getString("season")); System.out.println("-------------------------"); System.out.println("-------------------------"); } } However, I am getting this error: org.h2.jdbc.JdbcSQLSyntaxErrorException: Table "accomodation_fare_relations" not found; SQL statement: SELECT accomodation.type,room_fare.value,room_fare.season FROM accomodation_fare_relations JOIN accomodation ON accomodation.id = accomodation_fare_relations.id_accomodation JOIN room_fare ON room_fare.id = accomodation_fare_relations.id_room_fare [42102-200] I have no idea how to solve this, I managed to create the tables, that have the many-to-many relations, but I do not know how to solve this.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)