1 Reply Latest reply on Apr 30, 2005 4:33 AM by Robin Young

    Optimizing query performance

    Mark Auburn Newbie

      In order to get decent performance out of our application with EJB3.0, I desperately need to be able to use Hibernate's query cache and the second-level cache.

      I've created my hibernate.properties file as:

      hibernate.transaction.manager_lookup_class=org.hibernate.transaction.JBossTransactionManagerLookup
      hibernate.query.factory_class=org.hibernate.hql.ast.ASTQueryTranslatorFactory
      hibernate.connection.datasource=java:/OracleDS
      hibernate.dialect=org.hibernate.dialect.Oracle9Dialect
      # Clustered cache with TreeCache
      hibernate.cache.provider_class=org.jboss.ejb3.entity.TreeCacheProviderHook
      hibernate.treecache.mbean.object_name=jboss.cache:service=EJB3EntityTreeCache
      hibernate.cache.use_query_cache=true
      hibernate.show_sql=true

      However, I don't see any way to configure queries to actually use the query cache without both using named queries (which aren't supported until Preview 5) and setting the Hibernate mapping to indicate that the query is cacheable (which isn't available in the EJB3.0 annotations).

      Is there anyway to set a default Hibernate property to cache all queries somehow? Or some other way to hack around this?

      Help! Thanks...

      - Mark