[
https://issues.apache.org/jira/browse/OPENJPA-1499?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12832177#action_12832177
]
Rajeev Chaudhary commented on OPENJPA-1499:
-------------------------------------------
Hi Jeremy, thanks for the immediate reply. One more thing to add GazTown table
doesn't have a primary key. so I used composite key and everything is working
fine now. Thanks for your help
> 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
> Original Estimate: 96h
> Remaining Estimate: 96h
>
> Size::5
> <Feb 5, 2010 3:16:24 PM EST> <Error> <HTTP> <BEA-101020>
> <[weblogic.servlet.internal.webappservletcont...@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.