発生している問題・エラーメッセージ
HTTPステータス 500 - org.hibernate.exception.SQLGrammarException: could not extract ResultSet メッセージ org.hibernate.exception.SQLGrammarException: could not extract ResultSet 説明 The server encountered an internal error that prevented it from fulfilling this request. 例外 javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not extract ResultSet org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:149) org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:157) org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1423) org.hibernate.query.Query.getResultList(Query.java:146) controllers.dispatch.DispatchIndexServlet.doGet(DispatchIndexServlet.java:45) javax.servlet.http.HttpServlet.service(HttpServlet.java:622) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) filters.LoginFilter.doFilter(LoginFilter.java:72) filters.EncodingFilter.doFilter(EncodingFilter.java:38) 原因 org.hibernate.exception.SQLGrammarException: could not extract ResultSet org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:63) org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42) org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:111) org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:97) org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:69) org.hibernate.loader.Loader.getResultSet(Loader.java:2168) org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1931) org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1893) org.hibernate.loader.Loader.doQuery(Loader.java:938) org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:341) org.hibernate.loader.Loader.doList(Loader.java:2692) org.hibernate.loader.Loader.doList(Loader.java:2675) org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2507) org.hibernate.loader.Loader.list(Loader.java:2502) org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:502) org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:392) org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:216) org.hibernate.internal.SessionImpl.list(SessionImpl.java:1490) org.hibernate.query.internal.AbstractProducedQuery.doList(AbstractProducedQuery.java:1445) org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1414) org.hibernate.query.Query.getResultList(Query.java:146) controllers.dispatch.DispatchIndexServlet.doGet(DispatchIndexServlet.java:45) javax.servlet.http.HttpServlet.service(HttpServlet.java:622) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) filters.LoginFilter.doFilter(LoginFilter.java:72) filters.EncodingFilter.doFilter(EncodingFilter.java:38) 原因 com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'dispatch0_.stack_area' in 'field list' sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) java.lang.reflect.Constructor.newInstance(Constructor.java:423) com.mysql.jdbc.Util.handleNewInstance(Util.java:425) com.mysql.jdbc.Util.getInstance(Util.java:408) com.mysql.jdbc.SQLError.createSQLException(SQLError.java:944) com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3973) com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3909) com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2527) com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2680) com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2484) com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1858) com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1966) org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:60) org.hibernate.loader.Loader.getResultSet(Loader.java:2168) org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1931) org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1893) org.hibernate.loader.Loader.doQuery(Loader.java:938) org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:341) org.hibernate.loader.Loader.doList(Loader.java:2692) org.hibernate.loader.Loader.doList(Loader.java:2675) org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2507) org.hibernate.loader.Loader.list(Loader.java:2502) org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:502) org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:392) org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:216) org.hibernate.internal.SessionImpl.list(SessionImpl.java:1490) org.hibernate.query.internal.AbstractProducedQuery.doList(AbstractProducedQuery.java:1445) org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1414) org.hibernate.query.Query.getResultList(Query.java:146) controllers.dispatch.DispatchIndexServlet.doGet(DispatchIndexServlet.java:45) javax.servlet.http.HttpServlet.service(HttpServlet.java:622) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) filters.LoginFilter.doFilter(LoginFilter.java:72) filters.EncodingFilter.doFilter(EncodingFilter.java:38)
該当のソースコード
Java
1package models; 2 3import java.sql.Date; 4 5import javax.persistence.Column; 6import javax.persistence.Entity; 7import javax.persistence.GeneratedValue; 8import javax.persistence.GenerationType; 9import javax.persistence.Id; 10import javax.persistence.NamedQueries; 11import javax.persistence.NamedQuery; 12import javax.persistence.Table; 13 14@Table(name = "trucks") 15@NamedQueries({ 16 @NamedQuery( 17 name = "getAllDispatch", 18 query = "SELECT d FROM Dispatch AS d ORDER BY d.id DESC" 19 ), 20 @NamedQuery( 21 name = "getDispatchCount", 22 query = "SELECT COUNT(d) FROM Dispatch AS d" 23 ), 24}) 25@Entity 26public class Dispatch{ 27 @Id 28 @Column(name = "id") 29 @GeneratedValue(strategy = GenerationType.IDENTITY) 30 private Integer id; 31 32 @Column(name = "task_date", nullable = false) 33 private Date task_date; 34 35 @Column(name = "task_type", nullable = false) 36 private String task_type; 37 38 @Column(name = "office_name", nullable = false) 39 private String office_name; 40 41 @Column(name = "truck_code", nullable = false) 42 private String truck_code; 43 44 @Column(name = "stack_area", nullable = false) 45 private String stack_area; 46 47 @Column(name = "wholesale_area", nullable = false) 48 private String wholesale_area; 49 50 @Column(name = "truck_type", nullable = false) 51 private String truck_type; 52 53 54 public Integer getId() { 55 return id; 56 } 57 58 public void setId(Integer id) { 59 this.id = id; 60 } 61 62 public Date getTask_date() { 63 return task_date; 64 } 65 66 public void setTask_date(Date task_date) { 67 this.task_date = task_date; 68 } 69 70 public String getOffice_name() { 71 return office_name; 72 } 73 74 public void setOffice_name(String office_name) { 75 this.office_name = office_name; 76 } 77 78 79 public void setTask_type(String task_type){ 80 this.task_type = task_type; 81 } 82 83 84 public String getTruck_code() { 85 return truck_code; 86 } 87 88 public void setTruck_code(String truck_code) { 89 this.truck_code = truck_code; 90 } 91 92 public String getStack_area() { 93 return stack_area; 94 } 95 96 public void setStack_area(String stack_area) { 97 this.stack_area = stack_area; 98 } 99 100 public String getWholesale_area() { 101 return wholesale_area; 102 } 103 104 public void setWholesale_area(String wholesale_area) { 105 this.wholesale_area = wholesale_area; 106 } 107 108 public String getTruck_type() { 109 return truck_type; 110 } 111 112 public void setTruck_type(String truck_type) { 113 this.truck_type = truck_type; 114 } 115}
試したこと
該当ソースコードのnullableをtrueからfalseに変更した。
カラム名が間違っているとのことなので
全てのソースコードを見てみたが
'dispatch0_.stack_area' と書いている所は無かった
補足情報(FW/ツールのバージョンなど)
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。