We are using BMP and have a service bean call a business method from an Entity 
bean. We find that the return value is by call-by-reference, that is what the 
service bean obtained is actally the same instrance stored in the entity bean. 

We are using commit option 'A' and remote interface (not local interface), why 
this situation will happen ? and how to disable it?

sample code ...  a method in the service bean ..

/*********************/
 Context ctx = JBossContext.getContext();
                        
  Object obj = ctx.lookup("ejb/ZDMDocumentsEB");
     com.dms.ejb.entity.ZDMDocumentsEntityRemoteHome homeInterface =
            (com.dms.ejb.entity.ZDMDocumentsEntityRemoteHome) 
javax.rmi.PortableRemoteObject.narrow(obj, 
com.dms.ejb.entity.ZDMDocumentsEntityRemoteHome.class);
                      
            ZDMDocumentsEntityRemote remote = (ZDMDocumentsEntityRemote)
                homeInterface.findByPrimaryKey("804", "");

 // (1) !! an object reference is return by the entity bean class 
 // This ojbject is a member of the entity bean class

// doc is a helper class 
    DocumentImpl doc = (DocumentImpl) remote.getEntityForView("");

// (2) we try to set another value 
                                 
     doc.setFiled("Set another value");

// (3) get the data again
          
   DocumentImpl doc2 = (DocumentImpl) remote.getEntityForView("");
// STRANGE !! We find that 'doc' and 'doc2' are the same object !!
// and the modification  on 'doc' is reflected on 'doc2' !!!!!
            
        System.out.println("doc2 == doc " + (doc == doc2));


/*********************/

Please advice.. 

Thanks for your help!!

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

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


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to