所以我有以下代码:
Query query = session.createQuery("from Weather");
List<WeatherModel> list = query.list();
WeatherModel w = (WeatherModel) list.get(0);
我不想从表 Weather 中获取所有项目,但我不断收到以下错误:(第 23 行是我创建查询的地方)
java.lang.NullPointerException
at action.WeatherAction.validate(WeatherAction.java:23)
at com.opensymphony.xwork2.validator.ValidationInterceptor.doBeforeInvocation(ValidationInterceptor.java:251)
at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263)............
有什么问题?