Title: Message

Hi there,

 

I have some problems with container configurations, locking and commit options and optimized loading strategy (Ok this is a lot) with jboss-3.2.6RC2.

What we need is to have optimistic locking policy and optimized loading eventually (when possible) together with caching (like a little child we want to have it all).

 

The first question is can I combine the “org.jboss.ejb.plugins.lock.JDBCOptimisticLock” locking policy with other types of container then the “Instance Per Transaction CMP 2.x EntityBean”? And if so with which one’s.

Can I combine any type of container with any type of commit option (knowing that we do not have a cluster and we can pretend to be the sole user of the (Oracle 9i) database)? When not which types are compatible with which commit options (or put in another way what makes a container definition compatible (or incompatible) with a certain commit option).

Also there is an <optimistic-locking> tag which can be set to different values (<read-strategy/>, <modified-strategy/>, ..)

When I use the “Instance Per Transaction CMP 2.x EntityBean” container configuration with “org.jboss.ejb.plugins.lock.JDBCOptimisticLock” and specify

<optimistic-locking>

    <read-strategy/>

</optimistic-locking>

in the entity beans tags in jbosscmp-jdbc.xml

I get an exception thrown

2005-04-24 11:39:21,546 ERROR [org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackLocalException in method: public abstract void javax.ejb.EJBLocalObject.remove() throws javax.ejb.RemoveException,javax.ejb.EJBException, causedBy:

java.sql.SQLException: ORA-00932: inconsistent datatypes: expected - got BLOB

 

      at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)

      at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)

      at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)

      at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)

      at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093)

      at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047)

      at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)

      at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2709)

      at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)

      at org.jboss.resource.adapter.jdbc.CachedPreparedStatement.executeUpdate(CachedPreparedStatement.java:63)

      at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:335)

      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand.execute(JDBCStoreEntityCommand.java:136)

      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.storeEntity(JDBCStoreManager.java:651)

      at org.jboss.ejb.plugins.CMPPersistenceManager.storeEntity(CMPPersistenceManager.java:369)

      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.storeEntity(CachedConnectionInterceptor.java:394)

      at org.jboss.ejb.EntityContainer.storeEntity(EntityContainer.java:693)

      at org.jboss.ejb.GlobalTxEntityMap$2.synchronize(GlobalTxEntityMap.java:134)

      at org.jboss.ejb.GlobalTxEntityMap$GlobalTxSynchronization.synchronize(GlobalTxEntityMap.java:253)

      at org.jboss.ejb.GlobalTxEntityMap.synchronizeEntities(GlobalTxEntityMap.java:166)

      at org.jboss.ejb.EntityContainer.synchronizeEntitiesWithinTransaction(EntityContainer.java:119)

      at org.jboss.ejb.EntityContainer.remove(EntityContainer.java:496)

 

When I modify the strategy to <modified-strategy/> the error changes (in another location of the application) to

2005-04-24 11:59:04,031 ERROR [org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackLocalException in method: public abstract com.ascom.opentas.as.element.internal.entitybeans.Simpleattribute com.ascom.opentas.as.element.internal.entitybeans.SimpleattributeHome.findAttribute(java.lang.Long,java.lang.String) throws javax.ejb.FinderException, causedBy:

javax.ejb.EJBException: Update failed. Expected one affected row: rowsAffected=0, id=7191

      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand.execute(JDBCStoreEntityCommand.java:155)

      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.storeEntity(JDBCStoreManager.java:651)

      at org.jboss.ejb.plugins.CMPPersistenceManager.storeEntity(CMPPersistenceManager.java:369)

      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.storeEntity(CachedConnectionInterceptor.java:394)

      at org.jboss.ejb.EntityContainer.storeEntity(EntityContainer.java:693)

      at org.jboss.ejb.GlobalTxEntityMap$2.synchronize(GlobalTxEntityMap.java:134)

      at org.jboss.ejb.GlobalTxEntityMap$GlobalTxSynchronization.synchronize(GlobalTxEntityMap.java:253)

      at org.jboss.ejb.GlobalTxEntityMap.synchronizeEntities(GlobalTxEntityMap.java:166)

      at org.jboss.ejb.EntityContainer.synchronizeEntitiesWithinTransaction(EntityContainer.java:119)

      at org.jboss.ejb.EntityContainer.findSingleObject(EntityContainer.java:1040)

      at org.jboss.ejb.EntityContainer.findLocal(EntityContainer.java:627)

 

On some container types there is a sync-on-commit-only option (which is always set to false) that is not documented, what does it do exactly. When do I need to put it to true in my container configuration (I checked the source and the default value is false, so in the container definitions in “server\default\conf\standardjboss.xml” where it is defined, it always confirms the default)

 

Then I have some questions concerning optimized loading.

From what I read in the manual the on_find will load me all the matched records (which may be a lot or even to much) and therefore there is the on_load which only loads the page_size specified number of records. But in all the examples the on_find also has the “<page_size>” tag so now I am lost. Is this tag superfluous in case of on_find or are there other differences. Is there a different meaning for on_find and on_load when specified by a ejbfindBy or ejbSelect, and in a relation?

 

When specifying read ahead on 1..n relations in order to:

Load the fields of the related entity bean when accessing the getter from the 1 side.

Loading all the entities when accessing the getter from the n side.

What do I have to specify where.

Here is an example of what I mean.

 

 

In an Entity Bean (called Leaf) there is a method to retrieve the links from this Leaf I used XDoclet tags and the resulting xml is at the end

      /**

      *

      * @ejb.interface-method

      *   view-type = "local"

      *

      * @ejb.relation

      *   name = "fromLeaf-linkFroms"

      *   role-name = "LeafLinkFromsRelationshipRole"

      *

      * @jboss.relation-read-ahead

      *   strategy = "on-find"

      *   eager-load-group = "allFields"

      */

      public abstract java.util.Collection getLinkFroms();

 

 

The Link class the related to Leaf contains the corresponding method

 

      /**

      *

      * @ejb.interface-method

      *   view-type = "local"

      *

      * @ejb.relation

      *   name = "fromLeaf-linkFroms"

      *   role-name = "LinkFromLeafRelationshipRole"

      *

      * @jboss.relation

      *   fk-column = "FROMLEAF_PKLEAFID"

      *   related-pk-field = "pkLeafId"

      *

      * @jboss.load-group

      *   name = "allFields"

      *

      * @jboss.relation-read-ahead

      *   strategy = "on-find"

      *   page-size = "1000"

      *   eager-load-group = "allFields"

      */

      public abstract com.ascom.opentas.as.element.internal.entitybeans.Leaf getFromLeaf();

 

 

In my jbosscmp-jdbc.xml file the corresponding entry looks like

 

 

      <ejb-relation>

                 <ejb-relation-name>fromLeaf-linkFroms</ejb-relation-name>

 

                 <ejb-relationship-role>

                   <ejb-relationship-role-name>LinkFromLeafRelationshipRole</ejb-relationship-role-name>

                               <key-fields/>

 

                   <read-ahead>

                     <strategy>on-find</strategy>

                     <page-size>1000</page-size>

                     <eager-load-group>allFields</eager-load-group>

                   </read-ahead>

                 </ejb-relationship-role>

                  <ejb-relationship-role>

                   <ejb-relationship-role-name>LeafLinkFromsRelationshipRole</ejb-relationship-role-name>

                   <key-fields>

                      <key-field>

                        <field-name>pkLeafId</field-name>

                        <column-name>FROMLEAF_PKLEAFID</column-name>

                      </key-field>

                   </key-fields>

 

                   <read-ahead>

                     <strategy>on-find</strategy>

                     <eager-load-group>allFields</eager-load-group>

                   </read-ahead>

                 </ejb-relationship-role>

      </ejb-relation>

 

Maybe not all of these questions can be answered by one person and I will be very happy if somebody could already get response to part of my questions

 

Many many thanks for any help to a person in distress.

 

Percy Christian

 

Reply via email to