[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - read-only

andreas.ammer@eyesys.se do-not-reply at jboss.com
Fri Nov 3 04:39:09 EST 2006


Hello, i recently started for a company fixing some of the problems they had in their java code. The problem remaining in the application is the amount of deadlocks in the database. The system is running on jboss 4.0.2, ejb2.0, xdoclet 1.1.2, j2sdk1.4.1, mysql 4.0.16.

I dont know that much about configuring beans but ive noticed that trying to fix the order of all transactions in the application looks like it could take weeks if at all even possible. Ive been reading around a bit and found that you can set certain methods in a bean to read-only. For example this site: http://docs.jboss.org/jbossas/jboss4guide/r4/html/ch5.chapter.html 
in chapter 5.4.6.4. there is a description on how making readonly methods to avoid deadlocks.

What ive done is this.
In the code of the bean:
     * @ejb.persistence
     *      read-only="true"   <<< added this
     *      column-name="uuid"
     *      sql-type="VARCHAR(35)"

and in the jboss-web.xml i added method-attributes:
   <ejb-ref>
      <ejb-ref-name>ejb/SomeBean</ejb-ref-name>
      <jndi-name>ejb/SomeBean</jndi-name>
        <method-attributes>
            
                <method-name>getUUID</method-name>
                <read-only>true</read-only>
            
        </method-attributes>
   </ejb-ref>

with the ref-name linked to the web-..xml:
   <ejb-ref>
      <ejb-ref-name>ejb/SomeBean</ejb-ref-name>
      <ejb-ref-type>EntityBean</ejb-ref-type>
      capi.SomeBeanHome
      capi.SomeBean
   </ejb-ref>    

Deadlocks only appear when accessing the primary key field (uuid) of the table, the changes ive made in both the code and the xml-file seem to have no effect at all. Is there some crucial detail im missing here? Would appreciate any input. 

Thanks in advance
Andreas


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3982887#3982887

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3982887



More information about the jboss-user mailing list