[jboss-user] [Beginner's Corner] - Locking, Transaction, SFSB, 2 apps

Urs Rothenhäusler do-not-reply at jboss.com
Tue Dec 6 02:37:50 EST 2011


Urs Rothenhäusler [http://community.jboss.org/people/braca] created the discussion

"Locking, Transaction, SFSB, 2 apps"

To view the discussion, visit: http://community.jboss.org/message/639968#639968

--------------------------------------------------------------
Hello,

I get a row locking error from the database when I try to *read* (and possibly write) a record from a table which has exactly one row. This table holds a value for generating a key. The problem is that this table/entity is accessed by different applications. It's implement like this:

@Stateful
@Remote( VZBusinessRemote.class )
@Local( VZBusinessLocal.class )
public class VZBean implements VZBusinessLocal, VZBusinessRemote {

    @PersistenceContext(unitName="AUnitEJB") 
    private EntityManager em;

    @EJB( name="vzBeanAVPBasis", beanName="AVPBasisBean" )
    private AVPBasisBusinessLocal basisBean;

    private Long key;

@Override
    public void unmarshalAVZ( AVZ avz, int startAt, int endat ){
...domanythings...
         key = basisBean.findKeyAndSaveKey();
....domanythings...
}

After invoking the SFSB unmarshalAVZ() and calling basisBean.findKeyAndSaveKey() inside this method other applications cannot read nor write to the table/entity with the key table. Even if I call em.clear() after getting and updating the key table the record is locked for other application, but it should be possible for other apps even to write to the locked record. When the method unmarshalAVZ() is finished, locking isn't a problem anymore, but this method can take a very long time and thus locks the key table.

So - what can I do or what's wrong?

Thanks for an answer
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/639968#639968]

Start a new discussion in Beginner's Corner at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20111206/61fbf870/attachment-0001.html 


More information about the jboss-user mailing list