persistence@glassfish.java.net

Getting ejb ql query resultset

From: Kiril Minanov <minanov_at_gmail.com>
Date: Sun, 19 Aug 2007 19:48:44 +0200

Hi,

This is an example in which I am tring so expolain my problem.
What i want to do is take only some of the fields fromquery, not the entire
object (List of objects), because my table is very beig and it has many
foreign keys to other tables
and if I take the all table it takes a lot of memmory and the query is very
slow.
But whenever I try to take the resut I get a casting error

How can I get a reult set like with standard java


        EntityManager em = Menu.emf.createEntityManager();

        String query_string =
                    "SELECT" +
                        "t.column_1" +
                        "t.column_2" +
                    "FROM " +
                    " Table t ";

        Query query = em.createQuery(query_string);

        List<TableClass> results = (List<TableClass>)query.getResultList()
//This is where the problem occurs



-- 
minance