@Override
Public arraylist<contentext> findlistbasecontentext (int channelid,
int startpage, int endpage) {
String sql = "Select contentext1_.content_id, Contentext1_.title, Contentext1_.short_title," +
"Contentext1_.description, Contentext1_.author, Contentext1_.origin," +
"Contentext1_.origin_url, Contentext1_.release_date, Contentext1_.media_path," +
"Contentext1_.media_type, Contentext1_.title_color, Contentext1_.is_bold," +
"Contentext1_.title_img, Contentext1_.content_img, contentext1_.type_img," +
"contentext1_.type_img118, contentext1_.type_img170, contentext1_.type_img900," +
"Contentext1_.link, Contentext1_.tpl_content, contentext1_.need_regenerate," +
"Channel2_.channel_path" +
"From" +
"Jc_content content0_" +
"INNER JOIN" +
"Jc_content_ext contentext1_" +
"On content0_.content_id=contentext1_.content_id" +
"INNER JOIN" +
"Jc_channel channel2_" +
"On content0_.channel_id=channel2_.channel_id," +
"Jc_channel channel3_" +
"WHERE" +
" ( " +
"Channel2_.lft between Channel3_.lft and Channel3_.rgt" +
" ) "+
"and content0_.site_id=channel3_.site_id" +
"and channel3_.channel_id=" + channelid
+ "and content0_.status=2" +
"ORDER BY" +
"Contentext1_.release_date desc LIMIT" + startpage+ "," +endpage;
list<contentext> contextextlist = new arraylist<contentext> ();
Query query = getsession (). createsqlquery (SQL);
List List = Query.list ();
System.out.println (List.size ());
Iterator iter = List.iterator ();
SimpleDateFormat dateformat=new SimpleDateFormat ("YyyyMMdd");
while (Iter.hasnext ()) {
object[] obj = (object[]) iter.next ();
Contentext contentext = new Contentext ();
int id = (Integer) obj[0];
String title= (String) obj[1];
String short_title= (String) obj[2];
String description= (String) obj[3];
String author= (String) obj[4];
String origin= (String) obj[5];
String Origin_url= (String) obj[6];
Date release_date= (date) obj[7];
String Media_path= (String) obj[8];
String media_type= (String) obj[9];
String title_color= (String) obj[10];
String is_bold= (String) obj[11];
String title_img= (String) obj[12];
String content_img= (String) obj[13];
String type_img= (String) obj[14];
String type_img118= (String) obj[15];
String type_img170= (String) obj[16];
String type_img900= (String) obj[17];
String link= (String) obj[18];
String tpl_content= (String) obj[19];
Boolean need_regenerate= (Boolean) obj[20];
String Channel_path= (String) obj[21];
Contentext.setid (ID);
Contentext.settitle (title);
Contentext.setshorttitle (Short_title);
Contentext.setdescription (description);
Contentext.setauthor (author);
Contentext.setorigin (origin);
Contentext.setoriginurl (Origin_url);
Contentext.setreleasedate (release_date);
Contentext.setmediapath (Media_path);
Contentext.setmediatype (Media_type);
Contentext.settitlecolor (Channel_path); Channel_path
Contentext.settypeimg (TYPE_IMG);
String Releasedate=dateformat.format (release_date);
Contentext.setlink (ReleaseDate); Date
Contentext.settplcontent (tpl_content);
Contentext.setneedregenerate (need_regenerate);
Contextextlist.add (Contentext);
SYSTEM.OUT.PRINTLN ("ID:" +id + "; Title:" +title + "; release_date" +release_date);
}
Return (arraylist<contentext>) contextextlist;
}
Essay-hibernate Query Lookup