Hello everyone,

I'm having a problem getting my transaction to commit using ODMG within
jboss.  I've set up everything as mention on the OJB website, and PB-API
works just fine.  I don't recieve any errors and the symptons seem
simlar to what was discussed in this thread:
http://www.mail-archive.com/[EMAIL PROTECTED]/msg03389.html but I
couldn't find where the solution was solved.  I'm using jboss 3.0.7 and
Postgres for my database.  Here are some snippits from my code and
configuration:

session bean:
/**
 * 
 * @ejb:bean    type="Stateless" 
 *                                      name="ojbtest/TestODMG" 
 *                                      jndi-name="ejb/ojbtest/TestODMG"
 *                                      local-jndi-name="ejb/ojbtest/TestODMG"         
                                         
 *                                      display-name="Test ODMG"
 *                                      description="Test ODMG transaction manager 
integration"
 *                                      view-type="both"
 *                                      transaction-type="Container"
 * 
 *  @ejb:transaction type="Required"
 * 
...snip...
    
    
    /**
     * @ejb:interface-method view-type="both"
     * 
     */
    public void insert()
    {
        
        
                
                TestDO temp = new TestDO();
                temp.setSecond("test tx manager");
                
                
                Transaction tx = odmg.currentTransaction();
        
                if(tx.isOpen())
                {
                        log.info("transaction is open");
                }
                else
                {
                        log.info("transaction is not open");
                }
        
                tx.lock(temp,Transaction.WRITE);
                
        
    }
    
        /**
         * 
         * Method ejbCreate.
         * 
         * @ejb:interface-method view-type="both"
         * 
         * @throws CreateException
         * 
         */
        public void ejbCreate() throws CreateException
        {
                
                log.info("creating " + this.getClass().getName());
                

                InitialContext context;
        try
        {
            context = new InitialContext();
                        ODMGFactory factory = (ODMGFactory)
context.lookup("java:/ojb/defaultODMG");
                        odmg = factory.getInstance();
                        Database db = odmg.newDatabase();
                        db.open("default",Database.OPEN_READ_WRITE);
        }
        catch (Exception e)
        {
            log.error(e.getMessage(),e);
        } 
        
                
                

        }
    
}



reposiory_database.xml:

.. snip ...
<jdbc-connection-descriptor
                jcd-alias="default"
                default-connection="true"
                platform="@database.platform@"
                jdbc-level="2.0"
                jndi-datasource-name="java:DefaultDS"
                username="@database.user@"
                password="@database.password@"
                eager-release="true"
            batch-mode="false"
            useAutoCommit="0"
            ignoreAutoCommitExceptions="false"
                
     >

        <connection-pool
            maxActive="21"
            validationQuery="" />

       <sequence-manager
className="org.apache.ojb.broker.util.sequence.SequenceManagerNextValImpl"/>
   </jdbc-connection-descriptor>

... snip ...


repository_user.xml:

<class-descriptor
        class="com.ecaent.test.TestDO"
        table="test"
>
        <field-descriptor
                name="id"
                column="id"
                jdbc-type="INTEGER"
                primarykey="true"
                autoincrement="true"
                sequence-name="seq_test_ojb"
        />
        <field-descriptor
                name="second"
                column="second"
                jdbc-type="VARCHAR"
        />
</class-descriptor>





-- 
Eli Anderson

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to