This is what iam getting on my console

:18:37:52,743 ERROR [BeanLock] removing bean lock and it has tx set! 
org.jboss.ej
[EMAIL PROTECTED], bean=User, id=com.webforum.entit
[EMAIL PROTECTED], refs=0, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId
=Nagadev/33, BranchQual=, localId=33], synched=null, timeout=5000, queue=[]
18:37:52,753 ERROR [LogInterceptor] RuntimeException in method: public abstract
java.lang.Integer com.webforum.entity.user.UserEntity.getUserId() throws java.rm
i.RemoteException:
java.lang.IllegalStateException: removing bean lock and it has tx set!
        at org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock.removeRef(QueuedP
essimisticEJBLock.java:461)





and  i got some info that this can occur when primary key class hashcode/equals 
methods implemented badly

Please verify my PK class


here it is 

package com.webforum.entity.user;

import java.io.Serializable;

public class UserEntityPK implements Serializable {

        public Integer userId; //primary-key field

        public UserEntityPK() {
        }

        public UserEntityPK(Integer userId) {
                this.userId = userId;
        }

        public Integer getUserId() {
                return userId;
        }

        /**
         * This is the overridden method of Object class
         * @param       obj reference object to compare
         * @return      boolean trueif this object is same as the object
         * argument, false otherwise.
         */
        public boolean equals(Object obj) {
                if (obj == null || !(obj instanceof UserEntityPK))
         return false;
      else if (((UserEntityPK)obj).userId == userId) 
         return true;
      else 
         return false;

        }

        public String toString(){
                return String.valueOf(userId); 
        }

        /**
         * This is the overriden method which returns hashCode
         * @return      int the hashCode
         */
        public int hashCode() {
                return userId.hashCode();
        }
}













This is code snippet where iam using Bean method ()  getUserId()



Collection colUser=null;
                try{

                ctx=new InitialContext();
                userHome =(UserEntityHome)ctx.lookup("User");

                UserEntityPK userPK=new UserEntityPK(userId);
        
                UserEntity userEntity=userHome.findByPrimaryKey(userPK);
                
                        User user=new User();
user.userId=userEntity.getUserId();------where iam getting the problem



Please help in this.    


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

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


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to