Hi Brian,

Brian Sam-Bodden wrote:

Fellow OJBers,
  I have an application running on JBoss 3.0.8, using

I recommend you to use JBoss 3.2.2 or higher. In all other 3.x versions there seems to be a bug in connection resource handling of JBoss (we introduce eager-release attribute as workaround, but this seems to be cause side-effects when using complex object model)


the latest version of OJB (from CVS). I'm using the
provided HSQLDB version that comes with JBoss.
  I have a couple of questions on the setup:

1). Which OJB internal tables do I need?

you can use OJB without any internal tables. More info see http://db.apache.org/ojb/platforms.html

When are this
tables generated. I see them in them in
repository_internal.xml. Do they get created the first
time they are needed? Or do I have to create them?

you have to create them yourself. OJB use torque to create all tables used in the tutorials/junit tests. See ant target in build.xml



2). From reading the newsgroups posting I see that hsql does not support database based key generation.

right, hsql only supports Identity columns.


So I
switch the sequence manager className in my jdbc
connection to use the HighLo Seq manager. Of course
that one depends on one of the internal tables. I'm
assuming that if the database is not shared the
InMemory manager is the way to go for performance
reasons, right?

yes, if it's not shared and JBoss is not clustered.



3.) THe application in its current state uses a SessionBean to do all of the data access. I seem to be able to do queries just fine but when I try to insert a new object I get the error shown below. Also, the PK for this object is an Integer field. Should I set that value to null for a new object, since the Seq. Manager is going to assign that value? I don't see the Seq Man classes involved in the error below. So I guess it might be something I goofed on. Any help would be appreaciated. I have followed the instructions on the deployment page, for deploying on JBoss (sar creation).

Here's one of the simple mappings that produces the
error below

In managed environments it's not allowed to start pb-transaction (or any other, except JTA UserTransaction):


>         try {
>   !!          broker.beginTransaction();
>             broker.store(conference);
>   !!        broker.commitTransaction();
>         } catch (PersistenceBrokerException pbe) {
>             result = false;
>   !!         broker.abortTransaction();
>         } finally {
>             if (broker != null) broker.close();
>         }

In your deployment descriptor you enabled cm-tx (xdoclet: > * @ejb.transaction type="Required"), thus all tx demarcation will be done by the container.

regards,
Armin


<!-- 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>

The code for this looks like (in the SessionBean)

...

* @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 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;
}
...



2004-01-03 21:58:33,534 ERROR
[org.apache.ojb.broker.accesslayer.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.java:1602)


at
org.hsqldb.jdbcPreparedStatement.setCharacterStream(jdbcPreparedStatement.java:1375)


at
org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.setCharacterStream(WrappedPreparedStatement.java:644)


at
org.apache.ojb.broker.platforms.PlatformDefaultImpl.setObjectForStatement(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)


Any guidance would be appreciated.

Regards,
  Brian


--------------------------------------------------------------------- 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