Incredible,
My session bean receive a PK (a very stupid Serializable object).
1. If I do nothing on it and pass to the Home of my entity bean (fbpk), no
problem - I don't need my toString()
2. If I access it by a java.lang.Object method (toString()) I have the
problem.
3. If I acces it by one of its own method (getPk(), yes well my PK have one
field called pk), I don't have the problem.
4. (you guessed it) If I define toString() in it and access it by a debug
message (System.out.println(pk)), I don't have the problem. What makes me
hurrah a bit quickly because it is only a workaround.
toString() is the only method coming from java.lang.Object that I can run,
so I guess the problem is linked to that.
I hacked the interceptors to see the cache Id : its value is OK, but its
hashCode change:
If on the session bean, I access the PK by this Object.toString() method,
the received PK on the entity bean have a different hashCode() than if I do
not run toString(), which kill the cache.
If on the session bean, I access the PK by getPk() or a defined toString(),
the received PK on the entity bean have the same hashCode().
Is this a JVM bug, a RMI problem, an acid pill in my coke ?
I understand why it is not so common though. I will tatoo on my front "ADD
A TOSTRING IN YOUR PK"
Fuck me to find that.
me sleep now. tomorrow back to reality.
Vincent.
> -----Message d'origine-----
> De : [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]De la part de marc
> fleury
> Envoyé : jeudi 5 juillet 2001 22:14
> À : [EMAIL PROTECTED]
> Objet : RE: [JBoss-dev] container-cache-conf 1/1
>
>
> it's a really odd one, the only place we use toString is in the
> passivation
> engines (store to file) so you are looking at something else besides the
> cache.
>
> Find what's screwed up it is an interesting one,
>
> marcf
>
> |-----Original Message-----
> |From: [EMAIL PROTECTED]
> |[mailto:[EMAIL PROTECTED]]On Behalf Of
> |Vincent Harcq
> |Sent: Thursday, July 05, 2001 3:51 PM
> |To: [EMAIL PROTECTED]
> |Subject: RE: [JBoss-dev] container-cache-conf 1/1
> |
> |
> |Wow it's an old one.
> |I solve my problem by adding a toString() method to the PK class.
> |I don't see the reason why it helped me but it does.
> |For some reason the get() on the cache (with the ID, this is the
> |PK) can not
> |find an existing bean and load a new one (see "Activated bean
> MasterDO" in
> |the log).
> |I don't understand a lot on JBoss internal but I thought a Map lookup was
> |using the hashCode() method, not the toString() method.
> |
> |> -----Message d'origine-----
> |> De : [EMAIL PROTECTED]
> |> [mailto:[EMAIL PROTECTED]]De la part de
> |> Vincent Harcq
> |> Envoyé : jeudi 5 juillet 2001 13:04
> |> À : [EMAIL PROTECTED]
> |> Objet : RE: [JBoss-dev] container-cache-conf 1/1
> |>
> |>
> |> Hi,
> |> Please read this example.
> |> It is simpler that the previous one.
> |> I don't understand why I am the only one to complain on that.
> |>
> |> MyService is a SessionBean. It is a facade the the entity bean.
> |> Master is en EntityBean accessed with a Detail object through
> the session
> |> bean.
> |>
> |> I attach the ejb jar, the Client and the sources.
> |>
> |> The problem is the (*) that activate a second instance from the cache.
> |>
> |>
> |>
> |>
> |> Client Code :
> |> =============
> |> // Create the Master
> |> MasterDetail master = new MasterDetail("","");
> |> MyService s = shome.create();
> |> master = s.addMaster(master);
> |> s.remove();
> |>
> |> // Modify the Master
> |> String timestamp = Long.toString((new
> |> java.util.Date()).getTime());
> |> System.out.println("Change to "+timestamp);
> |> master.setName(timestamp);
> |> s = shome.create();
> |> s.modifyMaster(master.getPk(),master);
> |> s.remove();
> |>
> |> s = shome.create();
> |> (*)
> |> System.out.println("Good:"+s.findMaster(master.getPk()).getName());
> |> s.remove();
> |>
> |> // Modify the Master a second time
> |> timestamp = Long.toString((new
> java.util.Date()).getTime());
> |> System.out.println("Change to "+timestamp);
> |> master.setName(timestamp);
> |> s = shome.create();
> |> s.modifyMaster(master.getPk(),master);
> |> s.remove();
> |>
> |> s = shome.create();
> |>
> |> System.out.println("Bad:"+s.findMaster(master.getPk()).getName());
> |> s.remove();
> |>
> |> // Modify the Master a third time
> |> timestamp = Long.toString((new
> java.util.Date()).getTime());
> |> System.out.println("Change to "+timestamp);
> |> master.setName(timestamp);
> |> s = shome.create();
> |> s.modifyMaster(master.getPk(),master);
> |> s.remove();
> |>
> |> s = shome.create();
> |>
> |> System.out.println("Bad:"+s.findMaster(master.getPk()).getName());
> |> s.remove();
> |>
> |> Result on Client :
> |> ==================
> |> go
> |> Change to 994329289172
> |> Good:994329289172
> |> Change to 994329289253
> |> Bad:994329289172
> |> Change to 994329289323
> |> Bad:994329289172
> |> end
> |>
> |> Result on Server :
> |> ==================
> |> [com.hm.test.jboss.ejb.ServiceBean ] (45 ) - Executing addMaster
> |> [com.hm.test.jboss.ejb.MasterDOBean ] (81 ) - ejbCreate
> |> [com.hm.test.jboss.ejb.MasterDOBean ] (45 ) -
> |> setpk=34ee66:e7829fb74c:-7ffd
> |> [com.hm.test.jboss.ejb.MasterDOBean ] (46 ) -
> |> this=com.hm.test.jboss.ejb.MasterDOCMP@28e0bd
> |> [com.hm.test.jboss.ejb.MasterDOBean ] (59 ) - setname=
> |> [com.hm.test.jboss.ejb.MasterDOBean ] (60 ) -
> |> this=com.hm.test.jboss.ejb.MasterDOCMP@28e0bd
> |> [com.hm.test.jboss.ejb.MasterDOBean ] (73 ) - setdescription=
> |> [com.hm.test.jboss.ejb.MasterDOBean ] (74 ) -
> |> this=com.hm.test.jboss.ejb.MasterDOCMP@28e0bd
> |> [com.hm.test.jboss.ejb.MasterDOBean ] (37 ) -
> |> this=com.hm.test.jboss.ejb.MasterDOCMP@28e0bd
> |> [com.hm.test.jboss.ejb.MasterDOBean ] (101) - Executing getDetails
> |> 34ee66:e7829fb74c:-7ffd
> |> [com.hm.test.jboss.ejb.MasterDOBean ] (51 ) -
> |> this=com.hm.test.jboss.ejb.MasterDOCMP@28e0bd
> |> [com.hm.test.jboss.ejb.MasterDOBean ] (65 ) -
> |> this=com.hm.test.jboss.ejb.MasterDOCMP@28e0bd
> |> [com.hm.test.jboss.ejb.MasterDOBean ] (37 ) -
> |> this=com.hm.test.jboss.ejb.MasterDOCMP@28e0bd
> |> [com.hm.test.jboss.ejb.ServiceBean ] (101) - Executing
> |> modifyMaster(34ee66:e7829fb74c:-7ffd,com
> |> [com.hm.test.jboss.ejb.MasterDOBean ] (133) - Executing setDetails
> |> [com.hm.test.jboss.ejb.MasterDOBean ] (59 ) - setname=994330842494
> |> [com.hm.test.jboss.ejb.MasterDOBean ] (60 ) -
> |> this=com.hm.test.jboss.ejb.MasterDOCMP@28e0bd
> |> [com.hm.test.jboss.ejb.MasterDOBean ] (73 ) - setdescription=
> |> [com.hm.test.jboss.ejb.MasterDOBean ] (74 ) -
> |> this=com.hm.test.jboss.ejb.MasterDOCMP@28e0bd
> |> [com.hm.test.jboss.ejb.ServiceBean ] (101) - Executing
> |> modifyMaster(34ee66:e7829fb74c:-7ffd,com
> |> [com.hm.test.jboss.ejb.MasterDOBean ] (133) - Executing setDetails
> |> [com.hm.test.jboss.ejb.MasterDOBean ] (59 ) - setname=994330842535
> |> [com.hm.test.jboss.ejb.MasterDOBean ] (60 ) -
> |> this=com.hm.test.jboss.ejb.MasterDOCMP@28e0bd
> |> [com.hm.test.jboss.ejb.MasterDOBean ] (73 ) - setdescription=
> |> [com.hm.test.jboss.ejb.MasterDOBean ] (74 ) -
> |> this=com.hm.test.jboss.ejb.MasterDOCMP@28e0bd
> |> [com.hm.test.jboss.ejb.ServiceBean ] (83 ) - Executing
> |> findMaster:com.hm.test.jboss.interfaces.
> |> [MasterDO ] (61 ) - Activated
> |bean MasterDO
> |> with id = com.hm.test.jbos
> |> [com.hm.test.jboss.ejb.MasterDOBean ] (37 ) -
> |> this=com.hm.test.jboss.ejb.MasterDOCMP@1cc014
> |> [com.hm.test.jboss.ejb.MasterDOBean ] (101) - Executing getDetails
> |> 34ee66:e7829fb74c:-7ffd
> |> [com.hm.test.jboss.ejb.MasterDOBean ] (51 ) -
> |> this=com.hm.test.jboss.ejb.MasterDOCMP@1cc014
> |> [com.hm.test.jboss.ejb.MasterDOBean ] (65 ) -
> |> this=com.hm.test.jboss.ejb.MasterDOCMP@1cc014
> |> [com.hm.test.jboss.ejb.MasterDOBean ] (37 ) -
> |> this=com.hm.test.jboss.ejb.MasterDOCMP@1cc014
> |> [com.hm.test.jboss.ejb.ServiceBean ] (101) - Executing
> |> modifyMaster(34ee66:e7829fb74c:-7ffd,com
> |> [com.hm.test.jboss.ejb.MasterDOBean ] (133) - Executing setDetails
> |> [com.hm.test.jboss.ejb.MasterDOBean ] (59 ) - setname=994330842655
> |> [com.hm.test.jboss.ejb.MasterDOBean ] (60 ) -
> |> this=com.hm.test.jboss.ejb.MasterDOCMP@28e0bd
> |> [com.hm.test.jboss.ejb.MasterDOBean ] (73 ) - setdescription=
> |> [com.hm.test.jboss.ejb.MasterDOBean ] (74 ) -
> |> this=com.hm.test.jboss.ejb.MasterDOCMP@28e0bd
> |> [com.hm.test.jboss.ejb.ServiceBean ] (83 ) - Executing
> |> findMaster:com.hm.test.jboss.interfaces.
> |> [com.hm.test.jboss.ejb.MasterDOBean ] (37 ) -
> |> this=com.hm.test.jboss.ejb.MasterDOCMP@1cc014
> |> [com.hm.test.jboss.ejb.MasterDOBean ] (101) - Executing getDetails
> |> 34ee66:e7829fb74c:-7ffd
> |> [com.hm.test.jboss.ejb.MasterDOBean ] (51 ) -
> |> this=com.hm.test.jboss.ejb.MasterDOCMP@1cc014
> |> [com.hm.test.jboss.ejb.MasterDOBean ] (65 ) -
> |> this=com.hm.test.jboss.ejb.MasterDOCMP@1cc014
> |> [com.hm.test.jboss.ejb.MasterDOBean ] (37 ) -
> |> this=com.hm.test.jboss.ejb.MasterDOCMP@1cc014
> |>
> |>
> |> Again please help...
> |>
> |>
> |
> |
> |_________________________________________________________
> |Do You Yahoo!?
> |Get your free @yahoo.com address at http://mail.yahoo.com
> |
> |
> |_______________________________________________
> |Jboss-development mailing list
> |[EMAIL PROTECTED]
> |http://lists.sourceforge.net/lists/listinfo/jboss-development
>
>
>
> _______________________________________________
> Jboss-development mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-development
>
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development