Topic
  • 4 replies
  • Latest Post - ‏2011-08-12T00:41:01Z by alimanji
richhall
richhall
2 Posts

Pinned topic unknown enitity name in query

‏2010-04-21T23:20:05Z |
Hi,

I have a JPA project contains entity classes. Another EJB project that contains session beans to access and query for entities. When I ran it, I got this error message.

Caused by: javax.ejb.EJBException: See nested exception; nested exception is: <openjpa-1.2.2-SNAPSHOT-r422266:821449 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query filter "SELECT e FROM Employee e". Error message: The name "Employee" is not a recognized entity or identifier. Known entity names: []
Caused by: <openjpa-1.2.2-SNAPSHOT-r422266:821449 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query filter "SELECT e FROM Employee e". Error message: The name "Employee" is not a recognized entity or identifier. Known entity names: []
at org.apache.openjpa.kernel.exps.AbstractExpressionBuilder.parseException(AbstractExpressionBuilder.java:118)
at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getClassMetaData(JPQLExpressionBuilder.java:180)
at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.resolveClassMetaData(JPQLExpressionBuilder.java:150)
at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(JPQLExpressionBuilder.java:225)
at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(JPQLExpressionBuilder.java:195)
at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateType(JPQLExpressionBuilder.java:188)
at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.access$600(JPQLExpressionBuilder.java:69)
at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.populate(JPQLExpressionBuilder.java:1756)
at org.apache.openjpa.kernel.jpql.JPQLParser.populate(JPQLParser.java:56)
at org.apache.openjpa.kernel.ExpressionStoreQuery.populateFromCompilation(ExpressionStoreQuery.java:153)
at org.apache.openjpa.kernel.QueryImpl.newCompilation(QueryImpl.java:658)
at org.apache.openjpa.kernel.QueryImpl.compilationFromCache(QueryImpl.java:639)
at org.apache.openjpa.kernel.QueryImpl.compileForCompilation(QueryImpl.java:605)
at org.apache.openjpa.kernel.QueryImpl.compileForExecutor(QueryImpl.java:667)
at org.apache.openjpa.kernel.QueryImpl.getOperation(QueryImpl.java:1492)
at org.apache.openjpa.kernel.DelegatingQuery.getOperation(DelegatingQuery.java:123)
at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:243)
at org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:294)
at entities.controller.EmployeeManager.getEmployee(EmployeeManager.java:147)

Any clue?

Thanks,
Rich
Updated on 2011-08-12T00:41:01Z at 2011-08-12T00:41:01Z by alimanji
  • sutter
    sutter
    94 Posts

    Re: unknown enitity name in query

    ‏2010-04-22T02:22:02Z  
    Hi,
    First off, this looks to be a question for base WebSphere v7 and not specific to the OSGi/JPA Feature Pack. This forum is being used to track questions and issues related to the OSGi/JPA Feature Pack. General questions about WebSphere v7 should either be posted on the WebSphere Application Server forum [1] or you can open a PMR. Thanks.

    But, since you posted here, I might be able to help out. At one point, there was a problem if the first time you accessed an Entity type (ie. Employee) via a Query instead of some other access. Does your test application start right off with the Query for an Employee? If so, what happens if you just insert something simple like...

    Employee e = new Employee();

    ...before executing your query? Does that clear up the problem?

    Like I mentioned, I thought this problem was resolved already. So, maybe you are hitting something else...

    Good luck,
    Kevin

    [1] http://www.ibm.com/developerworks/forums/forum.jspa?forumID=266
  • richhall
    richhall
    2 Posts

    Re: unknown enitity name in query

    ‏2010-04-22T13:38:16Z  
    • sutter
    • ‏2010-04-22T02:22:02Z
    Hi,
    First off, this looks to be a question for base WebSphere v7 and not specific to the OSGi/JPA Feature Pack. This forum is being used to track questions and issues related to the OSGi/JPA Feature Pack. General questions about WebSphere v7 should either be posted on the WebSphere Application Server forum [1] or you can open a PMR. Thanks.

    But, since you posted here, I might be able to help out. At one point, there was a problem if the first time you accessed an Entity type (ie. Employee) via a Query instead of some other access. Does your test application start right off with the Query for an Employee? If so, what happens if you just insert something simple like...

    Employee e = new Employee();

    ...before executing your query? Does that clear up the problem?

    Like I mentioned, I thought this problem was resolved already. So, maybe you are hitting something else...

    Good luck,
    Kevin

    [1] http://www.ibm.com/developerworks/forums/forum.jspa?forumID=266
    Thanks Kevin.

    Bingo. That's exactly the problem. I am using RSA 7.5 with embeded WAS 7.0 test env. thought I have the latest fixpak already.

    Thanks again.
    Rich
  • sutter
    sutter
    94 Posts

    Re: unknown enitity name in query

    ‏2010-04-22T17:36:01Z  
    • richhall
    • ‏2010-04-22T13:38:16Z
    Thanks Kevin.

    Bingo. That's exactly the problem. I am using RSA 7.5 with embeded WAS 7.0 test env. thought I have the latest fixpak already.

    Thanks again.
    Rich
    Excellent. Glad it was easy to work around.

    I did some checking and the fix for this problem should be in the next WebSphere fixpack (7.0.0.11). WebSphere tries to deliver a fixpack each quarter.

    I'm not sure how RAD or RSA picks up these fixes for their embedded WAS v7 runtime environment.

    At least we know this is the problem you were hitting, you have a workaround, and that a solution is in the pipeline... :-)

    Thanks,
    Kevin
  • alimanji
    alimanji
    1 Post

    Re: unknown enitity name in query

    ‏2011-08-12T00:41:01Z  
    • sutter
    • ‏2010-04-22T17:36:01Z
    Excellent. Glad it was easy to work around.

    I did some checking and the fix for this problem should be in the next WebSphere fixpack (7.0.0.11). WebSphere tries to deliver a fixpack each quarter.

    I'm not sure how RAD or RSA picks up these fixes for their embedded WAS v7 runtime environment.

    At least we know this is the problem you were hitting, you have a workaround, and that a solution is in the pipeline... :-)

    Thanks,
    Kevin
    This workaround was useful for me as well. I see this problem in RAD v8 running against WebSphere App Server v8 (8.0.0.20110503_0200).

    Should this issue should even show in WAS v8? Possible regression?