4 Replies Latest reply on Jan 22, 2010 9:54 PM by Tony Brouwer

    HibernatePersistenceProvider does not support feature Feature.WILDCARD_AS_COUNT_QUERY_SUBJECT

    Tony Brouwer Newbie
      I am getting a MySQL error in sql generated by the EntityQuery class for tables with compound pk. EntityQuery is generating code like: "select count(a,b) from table" for tables with compound pks (such as TEE table in the Seam in Action Open18 app). MySQL does not support multiple values for the count(x) function so it throws an error. EntityQuery when  generating this code first checks:


      If true then it generates select count(*). When false select count(a,b).

      The implementation for HibernatePersistenceProvider has a @postcreate method called init() which sets this feature. It looks like this @postcreate method does not get executed.

      This integration test fails:

      package org.hack.util.test;

      import org.jboss.seam.Component;
      import org.jboss.seam.mock.SeamTest;
      import org.jboss.seam.persistence.HibernatePersistenceProvider;
      import org.jboss.seam.persistence.PersistenceProvider;
      import org.jboss.seam.persistence.PersistenceProvider.Feature;
      import org.testng.annotations.Test;

      public class PersistenceProviderTest extends SeamTest {

          public void verifyPersistenceProvider() throws Exception {
              // setupClass();
              new FacesRequest() {
                  protected void invokeApplication() {
                      PersistenceProvider pp =
                          (PersistenceProvider) Component.getInstance(
                      System.out.println("PersistenceProvider=" + pp.getClass());
                      assert (pp.getClass().equals(HibernatePersistenceProvider.class)) :
                          "Expected HibernatePersistenceProvider, found" + pp.getClass();
                      assert (pp.supportsFeature(Feature.WILDCARD_AS_COUNT_QUERY_SUBJECT)) :
                          "Hibernate PersistenceProvider does not support wildcard count";