Re: [OJB-developers] Question about Identity
Brought to you by:
thma
From: Georg S. <ge...@me...> - 2002-05-13 12:52:09
|
On Mon, 13 May 2002, Thomas Mahler wrote: > Say we have a baseclass A and a class B extending A. > say we have an instance of B, object b with primary key pk_b. > > Now, if we don't have the restriction that identities are on the extend > level we could build non-equivalent identies pointing to the same object b: > 1. id_A = new Identity(A,pk_b) > 2. id_B = new Identity(B,pk_b) > > as id_A is not equivalent with id_B OJB won't be able to detect that > they are referring to the same instance. OK, I get the point > I have not thought about all deeper implications, but this could be a > performance improvement! You can give it a try and check if all JUnit > tests are still OK! I added a field objectsRealClass to Identity and changed the getDBObject(Identity id) method in PersistenceBrokerImpl, so that it will first look if that field is set and use that concrete class. I used the cvs-version from this morning and had the problem that the following tests failed without having changed a line of code yet: testTimestampLock() testPathExpressionsMtoNDecomposed() testPathExpressionsMtoN() When applying my changes the same 3 failures showed up, so I suppose the changes at least don't do anything bad for the rest. Of course I can't talk for the 3 tests mentioned above. By the way, Identity.java is an example of a file which seems to be in the cvs-repository with the wrong line ending format. It contains an extra Carriage Return for each line ending. PersistenceBrokerImpl on the other hand doesn't show that behaviour. Cheers Georg P.D.: Attached are the 2 diff files |