Announcement Announcement Module
Collapse
No announcement yet.
How to disable count query? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to disable count query?

    I have to use an older version of JPA and the Hibernate EntityManager (3.4.0.GA), rather than the current 3.5.5.Final.

    Because of this, the createQuery method does not have a second parameter (the class in question). For example, with a domain class of Account, I see:

    public static long Account.countAccounts() {
    return entityManager().createQuery("select count(o) from Account o", Long.class).getSingleResult();
    }

    With the older EntityManager, you don't have the second parameter, Long.class in this case.

    With the handy @RooEntity (mentioned here: http://static.springsource.org/sprin...rsistence.html), I can remove a number of methods:

    @RooEntity(findAllMethod="",findEntriesMethod="",countMethod="")

    This gets rid of all the problems but one. The moment I remove the countMethod as shown above, I get another method with the same problem:

    public static long Account.Accounts() {
    return entityManager().createQuery("select count(o) from Account o", Long.class).getSingleResult();
    }

    This method was not present before (the normal count method was present, though). Is there some way to get rid of the new Accounts() method?

    Is there some better way to get rid of these calls to the entity manager? Is there something I turned on that I should instead turn off?

    What I'm trying to do is run with the older version of Hibernate (due to corporate approval policies, alas). Is there another work-around to this?

    With Roo, the finders are simple enough, I can easily write my own. I just want to make it so that my code can compile with these admittedly older jars.

    I'm using Roo 1.1.0.RELEASE.

    Any help appreciated.

    Thanks,
    -Eric
Working...
X