users@glassfish.java.net

Problem in setMaxResults() Method.

From: <glassfish_at_javadesktop.org>
Date: Thu, 01 Apr 2010 05:38:48 PDT

try{
                        
objJProvider = new JPersistenceProvider(tasktbl);
                        objJProvider.begin();
                        Query query = null;
                
                        query =objJProvider.createNativeQuery("SELECT * FROM tasktbl",TasktblEntity.class);
                        
                        System.out.println(objJProvider.getDelegate());
                        query.setFirstResult(1);
                         query.setMaxResults(5);
                         fetchlist = query.getResultList();
                        System.out.println(fetchlist.size());
                        
                        for(TaskEntity obj:fetchlist){
                                System.out.println(obj.getTaskNo());
                                
                        }



am using JPA.This is My program. Its working till i add setMaxResults() method. if i add that it shows


Hibernate: SELECT limit ? ? * FROM TASKTBL
ORA-00923: FROM keyword not found where expected

Exception in Main()javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query

I don't understand this mechanism. but i definetly need to implement lazy loading in here. do i need any paging mechanism to be defined. or there has any solutions setting batchsize property like Hibernate. here in persistence.xml.

Help needed.Thanks in advance.

                                                
                        [i][/i][b][/b]
[Message sent by forum member 'karthickinnova']

http://forums.java.net/jive/thread.jspa?messageID=394889