[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-3032) count query used by Query is not compliant JPQL

Dan Allen (JIRA) jira-events at lists.jboss.org
Tue Mar 31 12:12:22 EDT 2009

    [ https://jira.jboss.org/jira/browse/JBSEAM-3032?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12459869#action_12459869 ] 

Dan Allen commented on JBSEAM-3032:

That was my initial instinct. The reason I didn't do it was because it seemed like too broad of an approach. What if the developer is using two persistence units in the same app that have different providers? Or is that just ridiculous case? I just figured it's safer to check that implementation being used for the current class.

If you still prefer to use PersistenceProvider, I'll switch it over. So it would be:

if (!(PersistenceProvider.instance() instanceof HibernatePersistenceProvider)) {
    useCompliantCountQuerySubject = true;

Or are you saying shift the decision to the PersistenceProvider too?

useCompliantCountQuerySubject = PersistenceProvider.instance().supportsCompliantCountQuerySubject(getEntityManager());

Frankly I think the lookup for a PersistenceProvider should pass the EntityManager as an argument:


That way we are sure we are getting the correct one.

> count query used by Query is not compliant JPQL
> -----------------------------------------------
>                 Key: JBSEAM-3032
>                 URL: https://jira.jboss.org/jira/browse/JBSEAM-3032
>             Project: Seam
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: 2.0.2.GA, 2.1.0.A1
>            Reporter: Dan Allen
>            Assignee: Dan Allen
>             Fix For: 2.2.0.CR1
>         Attachments: JBSEAM-3032-branch20-v1.txt, JBSEAM-3032-trunk-v1.txt, JBSEAM-3032-trunk-v2.txt
>   Original Estimate: 1 hour
>  Remaining Estimate: 1 hour
> The count query used by getCountEjbQl() in Query is not compliant JPQL. It should be:
> select count(Entity) from Entity entity
> instead of
> select count(*) from Entity entity
> Where "entity" is the class name of the entity (for instance, Person). You can test this by using TopLink or OpenJPA.
> All we need to do is replace the * with the name of the Entity. (We don't even need to fish for the alias used in the query).

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the seam-issues mailing list