openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rajeev Chaudhary (JIRA)" <j...@apache.org>
Subject [jira] Created: (OPENJPA-1499) java.lang.ClassCastException: [Ljava.lang.Object;
Date Fri, 05 Feb 2010 20:28:27 GMT
java.lang.ClassCastException: [Ljava.lang.Object;
-------------------------------------------------

                 Key: OPENJPA-1499
                 URL: https://issues.apache.org/jira/browse/OPENJPA-1499
             Project: OpenJPA
          Issue Type: Bug
         Environment: openjpa-1.2.2.jar, Oracle10G
            Reporter: Rajeev Chaudhary



Size::5
<Feb 5, 2010 3:16:24 PM EST> <Error> <HTTP> <BEA-101020> <[weblogic.servlet.internal.WebAppServletContext@10ca5bd
- appName: 'TestOpenJpa', name: 'TestOpenJpa.war', context-path: '/TestOpenJpa', spec-version:
'2.5'] Servlet failed with Exception
java.lang.ClassCastException: [Ljava.lang.Object;
	at org.wadsworth.bean.CheckMe.getData(CheckMe.java:26)
	at org.wadsworth.eclep.servlet.FrontContoller.doGet(FrontContoller.java:32)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
	at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
	Truncated. see log file for complete stacktrace


public class CheckMe {
	@SuppressWarnings("unchecked")
	public static void getData(){
		EntityManagerFactory factory = Persistence.createEntityManagerFactory("hellojpa");
		EntityManager em2 = factory.createEntityManager();
		Query q = em2.createQuery("SELECT f.gazCountyCode,f.gazTownCode,f.gazTownName FROM GazTown
f").setMaxResults(5);
		System.out.println("Size::"+q.getResultList().size());
		List<GazTown> results = q.getResultList();   ----> ClassCastException here
		System.out.println(results.get(0).toString()+"<<< Sizeoo >>>::::::"+q.getResultList().size());
		for (GazTown m : results) {
			System.out.println("Success:::"+m.getGazTownName());
		}
		em2.close();
        factory.close();
	}

Note: I am getting the result and the size is being shown as 5. But when I cast the resultset,
then I get the exception.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message