Triplicate
Select mbid00, mbmc00, llurl0, cfwz00, mbsltp, sycs00, lrsj00 from (
Select mbid00, mbmc00, llurl0, cfwz00, mbsltp, sycs00, lrsj00, rownum as con from (
Select * from JZ_MBXXB0 where 1 = 1 and lbid00 =
'123'
Order by lrsj00)
Where rownum <=
10
) Where con> =
1
In hibernate + Mysql
- /**
- * Paging Query
- */
- @ SuppressWarnings("Unchecked")
- PublicList doSearch (PageDao pageDAO,Final IntPageSize,
- FinalString name00)ThrowsException {
- List list =NewArrayList ();
- StringBuffer SQL =NewStringBuffer (
- "From Book B where B. name00 LIKE '%");
- SQL. append (name00 );
- SQL. append ("% '");
- FinalString typeSql =NewString (SQL );
- // Set the number of entries displayed on each page
- PageDAO. setPagesize (pageSize );
- IntPagesize = pageDAO. getPagesize ();
- // Obtain the total number of records
- List count = (listmediahibernatetemplate.exe cute (
- NewHibernateCallback (){
- PublicObject doInHibernate (Session session)
- ThrowsHibernateException, SQLException {
- Query q = session. createQuery (typeSql );
- // Q. setFirstResult (0 );
- // Q. setMaxResults (2 );
- List ss = q. list ();
- ReturnQ. list ();// No null is returned even if no data is found. Only isEmpty can be used.
- }
- }
- );
- PageDAO. getRsCountForSQL (count. size ());
- // Obtain the total number of pages
- PageDAO. GetPageCount ();
- // Obtain the current page
- Final IntCurrpage = pageDAO. GetCurrentPageForRequest ();
- // Set the toolbar type
- String pool = pageDAO. pagetool (PageDao. Text );
- // System. out. println (pageDAO. getParamUrl ());
- List <BookDTO> dt =NewArrayList <BookDTO> ();
- List rs = (listpolichibernatetemplate.exe cute (
- NewHibernateCallback (){
- PublicObject doInHibernate (Session session)
- ThrowsHibernateException, SQLException {
- Query q = session. createQuery (typeSql );
- Q. setFirstResult (currpage-1) * PageSize );
- Q. setMaxResults (pageSize );// Currpage *
- List ss = q. list ();
- ReturnQ. list ();// No null is returned even if no data is found. Only isEmpty can be used.
- }
- }
- );
- For(Iterator it = rs. iterator (); it. hasNext ();){
- Object obj = it. next ();
- BookDTO dto =NewBookDTO ();
- BeanUtils. copyProperties (obj, dto );
- Dt. add (dto );
- }
- // Session. setAttribute ("pagedto", pageDAO );
- List. add (0, Dt );
- List. add (1, Pool );
- ReturnList;
- }