title: PostgreSQL and Glassfish EJB__TIMER__TBL table
body: <p>I'm trying to use the timer service provided by Glassfish. Thus, I have to create a table named <code>EJB__TIMER__TBL</code> and configure jdbc resource in Glassfish.</p>
  
  <p>I want to store this table on postgreSQL on a schema named <code>glassfish</code>. So my ddl is this one (I replace the <code>BLOB</code> type to <code>BYTEA</code>) :</p>
  
  <pre><code>CREATE SCHEMA glassfish;
  
  CREATE TABLE glassfish.EJB__TIMER__TBL (
      CREATIONTIMERAW      BIGINT        NOT NULL,
      BLOB                 BYTEA,
      TIMERID              VARCHAR(255)  NOT NULL,
      CONTAINERID          BIGINT        NOT NULL,
      OWNERID              VARCHAR(255)  NULL,
      STATE                INTEGER       NOT NULL,
      PKHASHCODE           INTEGER       NOT NULL,
      INTERVALDURATION     BIGINT        NOT NULL,
      INITIALEXPIRATIONRAW BIGINT        NOT NULL,
      LASTEXPIRATIONRAW    BIGINT        NOT NULL,
      SCHEDULE             VARCHAR(255)  NULL,
      APPLICATIONID        BIGINT        NOT NULL,
      CONSTRAINT PK_EJB__TIMER__TBL PRIMARY KEY (TIMERID) 
  );
  
  DROP ROLE IF EXISTS glassfish;                      
  CREATE ROLE glassfish WITH NOINHERIT LOGIN PASSWORD '...';
  REVOKE ALL PRIVILEGES ON ALL TABLES IN SCHEMA glassfish FROM glassfish;
  REVOKE ALL PRIVILEGES ON ALL FUNCTIONS IN SCHEMA glassfish FROM glassfish;
  GRANT USAGE ON SCHEMA glassfish TO glassfish;
  GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA glassfish TO glassfish;
  GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA glassfish TO glassfish;
  GRANT USAGE ON ALL SEQUENCES IN SCHEMA glassfish TO glassfish;
  ALTER USER glassfish SET search_path to 'glassfish';
  </code></pre>
  
  <p>I configured a jdbc pool and resource for Glassfish :</p>
  
  <pre><code>asadmin create-jdbc-connection-pool 
  --datasourceclassname org.postgresql.ds.PGConnectionPoolDataSource 
  --restype javax.sql.ConnectionPoolDataSource 
  --property User=glassfish:Password=...:PortNumber=5432:DatabaseName=...:ServerName=localhost jdbc/simPool/glassfish
  
  
  asadmin create-jdbc-resource --connectionpoolid jdbc/simPool/glassfish jdbc/sim/glassfish
  </code></pre>
  
  <p>And I properly enter <code>jdbc/sim/glassfish</code> in the jdbc resource to use for timer service in Glassish GUI.</p>
  
  <p>Each time I deploy my app, I receive Exception :</p>
  
  <pre><code>[#|2013-02-18T11:42:42.562+0100|WARNING|glassfish3.1.2|org.eclipse.persistence.session.file
  
  :/E:/softs/serveurs/glassfish3_1122/glassfish/domains/domain1/applications/ejb-timer-service-app/WEB-INF/classes/___EJB__Timer__App|_ThreadID=58;_ThreadName=Thread-2;|Local Exception Stack: 
  Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
  Internal Exception: org.postgresql.util.PSQLException: ERREUR: la relation « EJB__TIMER__TBL » n'existe pas
    Position : 193
  Error Code: 0
  Call: SELECT "TIMERID", "APPLICATIONID", "BLOB", "CONTAINERID", "CREATIONTIMERAW", "INITIALEXPIRATIONRAW", "INTERVALDURATION", "LASTEXPIRATIONRAW", "OWNERID", "PKHASHCODE", "SCHEDULE", "STATE" FROM "EJB__TIMER__TBL" WHERE (("OWNERID" = ?) AND ("STATE" = ?))
      bind =&gt; [2 parameters bound]
  Query: ReadAllQuery(name="findTimersByOwnerAndState" referenceClass=TimerState sql="SELECT "TIMERID", "APPLICATIONID", "BLOB", "CONTAINERID", "CREATIONTIMERAW", "INITIALEXPIRATIONRAW", "INTERVALDURATION", "LASTEXPIRATIONRAW", "OWNERID", "PKHASHCODE", "SCHEDULE", "STATE" FROM "EJB__TIMER__TBL" WHERE (("OWNERID" = ?) AND ("STATE" = ?))")
      at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:333)
      at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:644)
      at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:535)
      at org.eclipse.persistence.internal.sessions.AbstractSession.basicExecuteCall(AbstractSession.java:1717)
  </code></pre>
  
  <p>So my table <code>EJB__TIMER__TBL</code> doesn't seem to be accessible by Glassfish.</p>
  
  <p>When I create another project, configure a <code>persistence.xml</code> file with the same credentials as my pooled connexion above and create a simple query <code>SELECT COUNT(*) FROM EJB__TIMER__TBL</code>, I receive <code>0</code> so my connexion is well established and the default schema accessed is <code>glassfish</code> as espected.</p>
  
  <p>In <code>${glassfish_root}\glassfish\lib\install\databases</code> there is some ddls but neither for postgresql...so where am I doing wrong ?</p>
  
  <p>NB: when I test to configure service timer with MySQL jdbc resource, it's work...</p>
  
  <p>Thanks for help</p>