Torsten,

> We are currently using Interbase in a pre-production environment.
> (an e-commerce mall) So far it performs acceptable, but because
> we are only in a test phase now there is a chance we will have to
> switch to Oracle... i'll let you know if you like?!

Have you noticed any peculiarities with your CMP beans and transactions? I'm
running InterBase 6.0 (not 6.0.1) on Linux, with InterClient version 2.0. So
far I've noticed very intermittent and strange behavior with my CMP
beans--it almost seems like the transactions aren't committing.

I've got a CMP entity bean named Account, which contains 4 fields. I have a
client which creates 10 Account instances and terminates. Even if the client
appears to execute properly and exits, I sometimes end up with no new
Account instances showing up in the database. And other times they will show
up. It's the oddest thing. I can't find an explanation for the behavior.

I'm going to upgrade my InterBase installation to 6.0.1 and give it another
try. My JBoss 2.1 installation is the integrated JBoss/Tomcat integration
off the jboss.org site. At startup time it shows:

[Default] JBoss 2.1-BETA Started in 0m:15s

Is 2.1-BETA the current version?

Here are some excerpts from my configuration:

---- jboss.jcml ----

  <mbean code="org.jboss.jdbc.JdbcProvider"
name="DefaultDomain:service=JdbcProvider">
     <attribute name="Drivers">interbase.interclient.Driver</attribute>
  </mbean>

  <mbean code="org.jboss.jdbc.XADataSourceLoader"
name="DefaultDomain:service=XADataSource
,name=InterbaseDS">
    <attribute name="PoolName">InterbaseDS</attribute>
    <attribute
name="DataSourceClass">org.opentools.minerva.jdbc.xa.wrapper.XADataSourceIm
pl</attribute>
    <attribute name="Properties"/>
    <attribute
name="URL">jdbc:interbase://blackangel/d1/db/bmk.gdb</attribute>
    <attribute name="GCMinIdleTime">1200000</attribute>
    <attribute name="JDBCUser">sysdba</attribute>
    <attribute name="Password">xxxx</attribute>
    <attribute name="MaxSize">4</attribute>
    <attribute name="GCEnabled">false</attribute>
    <attribute name="InvalidateOnError">false</attribute>
    <attribute name="TimestampUsed">false</attribute>
    <attribute name="Blocking">true</attribute>
    <attribute name="GCInterval">120000</attribute>
    <attribute name="IdleTimeout">1800000</attribute>
    <attribute name="IdleTimeoutEnabled">false</attribute>
    <attribute name="LoggingEnabled">false</attribute>
    <attribute name="MaxIdleTimeoutPercent">1.0</attribute>
    <attribute name="MinSize">4</attribute>
  </mbean>

---- ejb-jar.xml ----

<ejb-jar>
  <enterprise-beans>
    <entity>
      <description>Account</description>
      <display-name>Account</display-name>

      <ejb-name>Account</ejb-name>
      <home>com.quigley.dashboard.ejb.AccountHome</home>
      <remote>com.quigley.dashboard.ejb.Account</remote>
      <ejb-class>com.quigley.dashboard.ejb.AccountBean</ejb-class>

      <persistence-type>Container</persistence-type>
      <prim-key-class>com.quigley.dashboard.ejb.AccountPK</prim-key-class>
      <reentrant>False</reentrant>

      <cmp-field>
        <field-name>id</field-name>
      </cmp-field>

      <cmp-field>
        <field-name>login</field-name>
      </cmp-field>

      <cmp-field>
        <field-name>password</field-name>
      </cmp-field>

      <cmp-field>
        <field-name>description</field-name>
      </cmp-field>
    </entity>
  </enterprise-beans>

  ...

  <assembly-descriptor>
    <container-transaction>
      <method>
        <ejb-name>Account</ejb-name>
        <method-name>*</method-name>
      </method>

      <trans-attribute>RequiresNew</trans-attribute>
    </container-transaction>
  </assembly-descriptor>
</ejb-jar>

---- jaws.xml ----

<jaws>
  <datasource>InterbaseDS</datasource>
  <type-mapping>InterBase</type-mapping>

  <enterprise-beans>

    <!-- ====== Account =========================================== -->
    <entity>
      <ejb-name>Account</ejb-name>
      <table-name>ACCOUNT</table-name>
      <create-table>false</create-table>

      <cmp-field>
        <field-name>id</field-name>
        <column-name>ACCT_ID</column-name>
        <jdbc-type>INTEGER</jdbc-type>
        <sql-type>INTEGER</sql-type>
      </cmp-field>

      <cmp-field>
        <field-name>login</field-name>
        <column-name>ACCT_LOGIN</column-name>
        <jdbc-type>VARCHAR</jdbc-type>
        <sql-type>VARCHAR(64)</sql-type>
      </cmp-field>

      <cmp-field>
        <field-name>password</field-name>
        <column-name>ACCT_PASSWORD</column-name>
        <jdbc-type>VARCHAR</jdbc-type>
        <sql-type>VARCHAR(64)</sql-type>
      </cmp-field>

      <cmp-field>
        <field-name>description</field-name>
        <column-name>ACCT_DESCRIPTION</column-name>
        <jdbc-type>VARCHAR</jdbc-type>
        <sql-type>VARCHAR(128)</sql-type>
      </cmp-field>
    </entity>
  </enterprise-beans>
</jaws>

---- AccountClient.java ----

...
public class AccountClient {

    /*
     * JNDI Context.
     */
    static Context jndiCtx = null;


//--------------------------------------------------------------------------

    /*
     * Main.
     */
    public static void main(String[] arg) throws Exception {
        // Create a JNDI Context.
        jndiCtx = new InitialContext();

        // Find the SequenceHome in JNDI.
        SequenceHome seqHome = (SequenceHome) jndiCtx.lookup("Sequence");

        // Create a new Sequence EJB instance.
        Sequence seq = seqHome.create();

        // Find the AccountHome in JNDI.
        AccountHome accHome = (AccountHome) jndiCtx.lookup("Account");

        // Iterate 100 times.
        for(int i = 0; i < 10; i++) {

            // Allocate a new ID.
            int id = (int) seq.allocAccountId();

            // Message.
            System.out.println("Instance #" + i + ": " + id);

            // Create a new Account EJB instance.
            Account a = accHome.create(id);

            // Create an AccountHolder with the data.
            a.setHolder(new AccountHolder(id, "login" + i, "password" + i,
                                          "description" + i));
        }

        // Remove the Sequence EJB instance.
        seq.remove();
    }
}


_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to