Select all from a table hibernate -


so have following code:

query query = session.createquery("from weather");         list<weathermodel> list = query.list();         weathermodel w = (weathermodel) list.get(0); 

i wan't items table weather, keep getting following error:(line 23 create query)

java.lang.nullpointerexception     @ action.weatheraction.validate(weatheraction.java:23)     @ com.opensymphony.xwork2.validator.validationinterceptor.dobeforeinvocation(validationinterceptor.java:251)     @ com.opensymphony.xwork2.validator.validationinterceptor.dointercept(validationinterceptor.java:263)............ 

what's problem?

query query = session.createquery("from weather"); //you weayher object list<weathermodel> list = query.list(); //you accessing  list<weathermodel> 

they both different entities

query query = session.createquery("from weather");    list<weather> list = query.list();   weather w = (weather) list.get(0); 

Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -