Buggy code:
public class AccendantAction extends BaseAction { private int buyfilmplanid ; private String filmname ; private String introduction ; private String ontime ; private String offtime ; private float price ; private String imageURL ; private int filmlength ; private int targetPage ; private int messageid ; private int filmid ; private String content ; private String options ; private String starttime ; private String endtime ; private String filmtypes ; private HashMap < String , String > toJsonMap = new HashMap < String , String > ( ) ; BaseDao baseDao ; FilmManager filmManager ; PlanManager planManager ; public void setBaseDao ( BaseDao baseDao ) { } public void setFilmManager ( FilmManager filmManager ) { } public void setPlanManager ( PlanManager planManager ) { } public String getFilmtypes ( ) { } public void setFilmtypes ( String filmtypes ) { } public String getStarttime ( ) { } public void setStarttime ( String starttime ) { } public String getEndtime ( ) { } public void setEndtime ( String endtime ) { } public int getFilmlength ( ) { } public void setFilmlength ( int filmlength ) { } public String getContent ( ) { } public void setContent ( String content ) { } public String getOptions ( ) { } public void setOptions ( String options ) { } public int getMessageid ( ) { } public void setMessageid ( int messageid ) { } public int getFilmid ( ) { } public void setFilmid ( int filmid ) { } public int getTargetPage ( ) { } public void setTargetPage ( int targetPage ) { } public HashMap < String , String > getToJsonMap ( ) { } public void setToJsonMap ( HashMap < String , String > toJsonMap ) { } public String getImageURL ( ) { } public void setImageURL ( String imageURL ) { } public String getFilmname ( ) { } public void setFilmname ( String filmname ) { } public String getIntroduction ( ) { } public void setIntroduction ( String introduction ) { } public int getBuyfilmplanid ( ) { } public void setBuyfilmplanid ( int buyfilmplanid ) { } public String getOntime ( ) { } public void setOntime ( String ontime ) { } public String getOfftime ( ) { } public void setOfftime ( String offtime ) { } public float getPrice ( ) { } public void setPrice ( float price ) { } public String info ( ) { } public String start_activity ( ) { } public String publish_film ( ) { } public String view_instruction ( ) { String accendantid = ( ( String ) ( session . get ( "userid" ) ) ) ; Accendant accendant = ( ( Accendant ) ( baseDao . load ( Accendant . class , accendantid ) ) ) ; request . setAttribute ( "accendant" , accendant ) ; Session hibernateSessoion = baseDao . getNewSession ( ) ; try { int message_List_Size = ( ( Integer ) ( hibernateSessoion . createSQLQuery ( "SELECT<seq2seq4repair_space>count(*)<seq2seq4repair_space>c<seq2seq4repair_space>FROM<seq2seq4repair_space>message<seq2seq4repair_space>WHERE<seq2seq4repair_space>message.from<seq2seq4repair_space>=<seq2seq4repair_space>'manager'<seq2seq4repair_space>AND<seq2seq4repair_space>message.to='accendant'<seq2seq4repair_space>ORDER<seq2seq4repair_space>BY<seq2seq4repair_space>`time`<seq2seq4repair_space>DESC" ) . addScalar ( "c" , INTEGER ) . list ( ) . get ( 0 ) ) ) ; int defaultSize = 5 ; int message_PageSize = ( ( message_List_Size + defaultSize ) - 1 ) // defaultSize ; if ( ( targetPage ) > message_PageSize ) { targetPage = message_PageSize ; } if ( ( targetPage ) <= 0 ) { targetPage = 1 ; } <START_BUG> List < Message > messages = hibernateSessoion . createSQLQuery ( "SELECT<seq2seq4repair_space>*<seq2seq4repair_space>c<seq2seq4repair_space>FROM<seq2seq4repair_space>message<seq2seq4repair_space>WHERE<seq2seq4repair_space>message.from<seq2seq4repair_space>=<seq2seq4repair_space>'manager'<seq2seq4repair_space>AND<seq2seq4repair_space>message.to='accendant'<seq2seq4repair_space>ORDER<seq2seq4repair_space>BY<seq2seq4repair_space>`time`<seq2seq4repair_space>DESC" ) . addEntity ( Message . class ) . list ( ) ; <END_BUG> request . setAttribute ( "pageSize" , message_PageSize ) ; request . setAttribute ( "pageIndex" , targetPage ) ; request . setAttribute ( "messages" , messages ) ; return "success" ; } catch ( Exception e ) { e . printStackTrace ( ) ; return "fail" ; } finally { hibernateSessoion . close ( ) ; } } public String publishAFilm ( ) { } public String failToBuyFilm ( ) { } public String replytoInstruction ( ) { } public String start_activity_film ( ) { } public String createActivity ( ) { } public String generatePlansin3Days ( ) { } }

Fix:
List < Message > messages = hibernateSessoion . createSQLQuery ( "SELECT<seq2seq4repair_space>*<seq2seq4repair_space>FROM<seq2seq4repair_space>message<seq2seq4repair_space>WHERE<seq2seq4repair_space>message.from<seq2seq4repair_space>=<seq2seq4repair_space>'manager'<seq2seq4repair_space>AND<seq2seq4repair_space>message.to='accendant'<seq2seq4repair_space>ORDER<seq2seq4repair_space>BY<seq2seq4repair_space>`time`<seq2seq4repair_space>DESC" ) . addEntity ( Message . class ) . list ( ) ;