If you use hsqldb in client-server mode you can set it up to log all the
sql queries (see Advanced Topics in the HSQLDB docs). Or configure p6spy
to do the same thing on the OJB side... This might give you some ideas
about what it is trying to do...

I assume that your db connection in the repository is set to use the
HSQLDB driver, etc?

Good luck,

Rob :)

-----Original Message-----
From: Brian Sam-Bodden [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, 6 January 2004 7:33 a.m.
To: [EMAIL PROTECTED]
Subject: HSQLDB + JBoss Help (Function is Not Supported SQL Exception)


HEEELLLLLPP!

I've worked throught most of the my configuration woes with OJB, JBoss 
3.0.8 and HSQLDB. Everthing seems to be in place and I can query objects

from the DB without a problem. The only problem is saving my objects to 
the DB. I get a SQL error (function not supported).

Here's the Session Bean code...

/**
  * @author <a href="mailto:[EMAIL PROTECTED]">Brian
Sam-Bodden</a>
  *
  * @ejb.bean
  *      name="ConferenceFacade"
  *      type="Stateless"
  *      view-type="both"
  *      jndi-name="ejb.ConferenceFacadeHome"
  *      local-jndi-name="ejb.ConferenceFacadeLocalHome"
  * @ejb.transaction
  *      type="Required"
  * @ejb.util
  *      generate="physical"
  */
public abstract class ConferenceFacadeBean implements SessionBean { ...
     /**
      * @ejb.interface-method
      * @ejb.transaction
      *      type="NotSupported"
      *
      * @return
      */        
     public Collection getAllConferences() {
         PersistenceBroker broker = pbf.defaultPersistenceBroker();
         Collection allConferences = Collections.EMPTY_LIST;

        try {
             Query query = new QueryByCriteria(Conference.class, null);
             allConferences = broker.getCollectionByQuery(query);
         } catch (PersistenceBrokerException pbe) {
             throw new EJBException("Could not retrieve list of 
conferences");
         } finally {
             if (broker != null)        broker.close();
        }

        return allConferences;
     }
        
     /**
      * @ejb.interface-method
      * @ejb.transaction
      *      type="NotSupported"
      *
      * @return
      */        
     public boolean saveConference(Conference conference) {
         PersistenceBroker broker = pbf.defaultPersistenceBroker();
         boolean result = true;
                
        try {
            broker.beginTransaction();
             broker.store(conference);
            broker.commitTransaction();
         } catch (PersistenceBrokerException pbe) {
             result = false;
             broker.abortTransaction();
         } finally {
             if (broker != null) broker.close();
        }
                
        return result;
     }          

The conference POJO

package com.ejdoab.pojos;

import java.io.Serializable;
import java.util.Date;

/**
  * @ojb.class
  *     generate-table-info="true"
  *     table="conferences"
  */
public class Conference implements Serializable {

        /**
         * @ojb.field
         *     column="PK_ID"
         *     jdbc-type="INTEGER"
         *     primarykey="true"
         *     autoincrement="true"
         */     
        protected Integer id;

        /**
         * @ojb.field
         *     column="NAME"
         *     jdbc-type="VARCHAR"
         */
        protected String name;
        
        /**
         * @ojb.field
         *     column="DESCRIPTION"
         *     jdbc-type="LONGVARCHAR"
         */     
        protected String description;
        
        /**
         * @ojb.field
         *     column="STARTDATE"
         *     jdbc-type="DATE"
         */     
        protected Date startDate;
        
        /**
         * @ojb.field
         *     column="ENDDATE"
         *     jdbc-type="DATE"
         */
        protected Date endDate;

        /**
         * @ojb.field
         *     column="ABSTRACTSUBMISSIONSTARTDATE"
         *     jdbc-type="DATE"
         */     
        protected Date abstractSubmissionStartDate;
        
        /**
         * @ojb.field
         *     column="ABSTRACTSUBMISSIONENDDATE"
         *     jdbc-type="DATE"
         */             
        protected Date abstractSubmissionEndDate;
        
        /**
         * no-arg constructor
         */
        public Conference() {
        }
        
        /**
         * all-args constructor
         *
         * @param id
         * @param name
         * @param description
         * @param startDate
         * @param endDate
         * @param abstractSubmissionStartDate
         * @param abstractSubmissionEndDate
         */
        public Conference(
                Integer id,
                String name,
                String description,
                Date startDate,
                Date endDate,
                Date abstractSubmissionStartDate,
                Date abstractSubmissionEndDate) {
                this.id = id;
                this.name = name;
                this.description = description;
                this.startDate = startDate;
                this.endDate = endDate;
                this.abstractSubmissionStartDate =
abstractSubmissionStartDate;
                this.abstractSubmissionEndDate =
abstractSubmissionStartDate;
        }

        //
        // getters
        //
        
        public Integer getId() {
                return id;
        }
        
        public String getName() {
                return name;
        }
        
        public String getDescription() {
                return description;
        }               

        public Date getStartDate() {
                return startDate;
        }

        public Date getEndDate() {
                return endDate;
        }

        public Date getAbstractSubmissionStartDate() {
                return abstractSubmissionStartDate;
        }
        
        public Date getAbstractSubmissionEndDate() {
                return abstractSubmissionEndDate;
        }       

     //
     // setters
     //

        public void setId(Integer integer) {
                id = integer;
        }

        public void setName(String string) {
                name = string;
        }
        
        public void setDescription(String string) {
                description = string;
        }       

        public void setStartDate(Date date) {
                startDate = date;
        }
        
        public void setEndDate(Date date) {
                endDate = date;
        }
                
        public void setAbstractSubmissionStartDate(Date date) {
                abstractSubmissionStartDate = date;
        }
        
        public void setAbstractSubmissionEndDate(Date date) {
                abstractSubmissionEndDate = date;
        }
        
        //
        //
        //
        
        public String toString() {
                return new StringBuffer()
                    .append("[Conference] id = ")
                    .append(id)
                    .append(", name = ")
                    .append(name)
                    .append(", description = ")
                    .append(description)
                    .toString();                
        }
}


The table for the Conference Objects

CREATE TABLE Conferences (
   pk_Id INTEGER NOT NULL PRIMARY KEY,
   Name varchar(64),
   Description LONGVARCHAR,
   StartDate DATETIME,
   EndDate DATETIME,
   AbstractSubmissionStartDate DATETIME,
   AbstractSubmissionEndDate DATETIME
);

The OJB XDoclet generated repository-user.xml

<!-- file containing the repository descriptions for user-defined types
-->
<!-- Generated by the xdoclet-ojb module -->

<class-descriptor
     class="com.ejdoab.pojos.Conference"
     table="conferences"
 >
     <field-descriptor
         name="id"
         column="PK_ID"
         jdbc-type="INTEGER"
         primarykey="true"
         autoincrement="true"
     >
     </field-descriptor>
     <field-descriptor
         name="name"
         column="NAME"
         jdbc-type="VARCHAR"
     >
     </field-descriptor>
     <field-descriptor
         name="description"
         column="DESCRIPTION"
         jdbc-type="LONGVARCHAR"
     >
     </field-descriptor>
     <field-descriptor
         name="startDate"
         column="STARTDATE"
         jdbc-type="DATE"
     >
     </field-descriptor>
     <field-descriptor
         name="endDate"
         column="ENDDATE"
         jdbc-type="DATE"
     >
     </field-descriptor>
     <field-descriptor
         name="abstractSubmissionStartDate"
         column="ABSTRACTSUBMISSIONSTARTDATE"
         jdbc-type="DATE"
     >
     </field-descriptor>
     <field-descriptor
         name="abstractSubmissionEndDate"
         column="ABSTRACTSUBMISSIONENDDATE"
         jdbc-type="DATE"
     >
     </field-descriptor>
</class-descriptor>


Here's the stack trace....


13:03:55,640 INFO  [PersistenceBrokerFactoryDefaultImpl] Create 
PersistenceBroker instance pool, pool configuration was {when
ExhaustedAction=0, maxIdle=-1, maxActive=100, maxWait=2000, 
removeAbandoned=false, numTestsPerEvictionRun=10, testWhileIdle=f alse,
minEvictableIdleTimeMillis=1000000, testOnReturn=false, 
logAbandoned=false, removeAbandonedTimeout=300, timeBetweenEvic
tionRunsMillis=-1, testOnBorrow=false} 13:03:55,670 INFO
[RepositoryPersistor] OJB Descriptor Repository: 
jar:file:/C:/java/jboss/jboss-3.0.8/server/tcms/tmp/deplo
y/server/tcms/deploy/ojb.sar/10.ojb.sar!/repository.xml
13:03:55,870 INFO  [RepositoryPersistor] Read class descriptors took 210
ms 13:03:55,880 INFO  [RepositoryPersistor] OJB Descriptor Repository: 
jar:file:/C:/java/jboss/jboss-3.0.8/server/tcms/tmp/deplo
y/server/tcms/deploy/ojb.sar/10.ojb.sar!/repository.xml
13:03:55,950 INFO  [RepositoryPersistor] Read connection repository took

70 ms
13:03:56,010 INFO  [PersistenceBrokerFactoryBaseImpl] Create new PB 
instance for PBKey org.apache.ojb.broker.PBKey: jcdAlias=
tcms, user=sa, password=*****, already created persistence broker 
instances: 0
13:03:56,060 INFO  [ObjectCacheFactory] Start creating new ObjectCache 
instance
13:03:56,060 INFO  [ObjectCacheFactory] Default ObjectCache class was 
org.apache.ojb.broker.cache.ObjectCacheDefaultImpl
13:03:56,060 INFO  [CacheDistributor] Use property 
'descriptorBasedCaches' is set 'false'
13:03:56,060 INFO  [ObjectCacheFactory] Instantiate new 
org.apache.ojb.broker.cache.CacheDistributor class object 13:03:56,060
INFO  [ObjectCacheFactory] New ObjectCache instance was created
13:03:56,311 INFO  [PersistenceBrokerFactoryBaseImpl] Create new PB 
instance for PBKey org.apache.ojb.broker.PBKey: jcdAlias=
tcms, user=sa, password=*****, already created persistence broker 
instances: 1
13:03:56,311 INFO  [ObjectCacheFactory] Start creating new ObjectCache 
instance
13:03:56,321 INFO  [ObjectCacheFactory] Default ObjectCache class was 
org.apache.ojb.broker.cache.ObjectCacheDefaultImpl
13:03:56,321 INFO  [CacheDistributor] Use property 
'descriptorBasedCaches' is set 'false'
13:03:56,321 INFO  [ObjectCacheFactory] Instantiate new 
org.apache.ojb.broker.cache.CacheDistributor class object 13:03:56,321
INFO  [ObjectCacheFactory] New ObjectCache instance was created
13:03:56,361 INFO  [CacheDistributor] Create new 
ObjectCacheImplementation for 'class
org.apache.ojb.broker.util.sequence.Hig
hLowSequence'
13:03:56,371 ERROR [JdbcAccessImpl] SQLException during the execution of

the insert (for a com.ejdoab.pojos.Conference): This
  function is not supported
java.sql.SQLException: This function is not supported
         at org.hsqldb.Trace.getError(Trace.java:180)
         at org.hsqldb.Trace.getError(Trace.java:144)
         at org.hsqldb.Trace.error(Trace.java:192)
         at 
org.hsqldb.jdbcPreparedStatement.getNotSupported(jdbcPreparedStatement.j
ava:1602)
         at 
org.hsqldb.jdbcPreparedStatement.setCharacterStream(jdbcPreparedStatemen
t.java:1375)
         at 
org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.setCharacterStr
eam(WrappedPreparedStatement.java:644)
         at 
org.apache.ojb.broker.platforms.PlatformDefaultImpl.setObjectForStatemen
t(Unknown 
Source)
         at 
org.apache.ojb.broker.accesslayer.StatementManager.bindInsert(Unknown 
Source)
         at 
org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeInsert(Unknown 
Source)
         at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(Unknown
Source)
         at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown Source)
         at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown Source)
         at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown
Source)
         at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown
Source)
         at 
com.ejdoab.beans.ConferenceFacadeBean.saveConference(ConferenceFacadeBea
n.java:93)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
         at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at 
org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(Stat
elessSessionContainer.java:660)
         at 
org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(
CachedConnectionInterceptor.java:186)
         at 
org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(Statele
ssSessionInstanceInterceptor.java:77)
         at 
org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterce
ptor.java:107)
         at 
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptor
CMT.java:210)
         at 
org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:98)
         at 
org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.jav
a:130)
         at 
org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:208)
         at 
org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer
.java:313)
         at org.jboss.ejb.Container.invoke(Container.java:738)
         at 
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
         at 
org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:383
)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
         at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at 
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
         at sun.rmi.transport.Transport$1.run(Transport.java:148)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
         at 
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
         at 
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.ja
va:701)
         at java.lang.Thread.run(Thread.java:534)
13:03:56,381 INFO  [ConnectionManagerImpl] Rollback was called, do 
rollback on current connection null


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to