You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Christian Toennessen (JIRA)" <ji...@apache.org> on 2013/06/24 08:19:19 UTC

[jira] [Created] (OPENJPA-2404) First query after server start-up created with Criteria-Api causes ClassCastException

Christian Toennessen created OPENJPA-2404:
---------------------------------------------

             Summary: First query after server start-up created with Criteria-Api causes ClassCastException
                 Key: OPENJPA-2404
                 URL: https://issues.apache.org/jira/browse/OPENJPA-2404
             Project: OpenJPA
          Issue Type: Bug
          Components: criteria, jpa, query
    Affects Versions: 2.2.2, 2.2.1
         Environment: Tomcat 6.x, Eclipse 3.7.2, Windowx XP
            Reporter: Christian Toennessen


If we are creating the first query after the server start-up with the criteria-api every following query crashes with a ClassCastException "org.apache.openjpa.util.StringId cannot be cast to com.provinzial.entity.EntityA".
If the first query is a named-query with "normal" JPQL there is no problem using both, the named queries or the queries created by criteria-api.

We've got an Entity-A having a one-to-many relation to Entity-B. Entity-B has to be loaded eager. The problem doesn't exist if Entity-B is loaded lazy.

A workaround is to fire a JPQL-Query of a "dummy Entity-A" at the server start-up, but this is not a nice solution...

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira