PreparedStatement predstaveFilmaStavek = con.prepareStatement("select shows_id from shows where movies_movie_id=?");
predstaveFilmaStavek.setInt(1, bazniIDfilma);
ResultSet predstaveFilma = predstaveFilmaStavek.executeQuery();
ArrayList<Show> predstave = new ArrayList<Show>();
while (predstaveFilma.next()) {
predstave.add(new ShowDao().selectShow(predstaveFilma.getInt(1)));
}
这给了我以下错误:
un. 03, 2017 1:06:18 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [jsp] in context with path [/kino] threw exception [An exception occurred processing JSP page /filmXML.jsp at line 17
14: ResultSet predstaveFilma = predstaveFilmaStavek.executeQuery();
15: ArrayList<Show> predstave = new ArrayList<Show>();
16: while (predstaveFilma.next()) {
17: predstave.add(new ShowDao().selectShow(predstaveFilma.getInt(1)));
18: }
19: %>
20:
Stacktrace:] with root cause
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'id' in 'where clause'
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
我在db中有collumn movies_movie_id ...所以给出了什么?
我必须在这里输入更多的单词,这样我的任务才能被编辑......-.-
创建表的MySQL定义为:
CREATE TABLE shows (
`shows_id` INT auto_increment,
`show_id` VARCHAR(18) NOT NULL,
`date_time` datetime NOT NULL,
`city` VARCHAR(45) NOT NULL,
`center` VARCHAR(45) NOT NULL,
`theater` VARCHAR(45) NOT NULL,
`movies_movie_id` int NOT NULL,
PRIMARY KEY (`shows_id`));
ALTER TABLE shows
ADD CONSTRAINT fk_shows_movies FOREIGN KEY
(`movies_movie_id`) REFERENCES movies(`movies_id`);