openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: Remove toString from children of OpenJPAId - Please - please - please
Date Tue, 08 Apr 2008 19:40:19 GMT
The OpenJPAId used as the key for the cache needs to be able to stringify
in a pretty format.
Once the data is in the cache - it is very important to be able to look at
the cache and see what is or is not in there.
Becuase the cache is a separate product from the OR mapping - the
toString() method is the only thing the cache can use.

Abe - I am not sure I understand exactly what your objection was. But if
your are implying that the toString() method is used to implement some
functionality (either for kodo or OpenJPA) - then does not that sound to
you like you should have used a specific method to implement your specific
behavior. I mean the toString() method on a object is there to be able to
print (as a string) an object into some kind of pretty format - it is not
meant to be used to implement some specific logic.

In organizations using caching products - I really can not see how I could
argue with the IT folks and tell them they can not look into the cache
anymore because someone somewhere decided it made sense to overwrite a
toString() method. Well... to be fair I could argue it - but I am pretty
sure I would look foolish.

Maybe it is just me - and quite frankly it seems that way since only Craig
so far seems to be supporting this request. But I do think that this is a
huge deal. The way it is right now this is not production ready. The IT
folks will eat me alive if I give them this kind of solutions (and I would
not be very proud myself ;) )

Any chance somebody else sees the light here and can puh this proposal

PS: I am just trying to help, so if folks think this request is not valid
then please let me know and I will drop it. I am not proposing a patch
becuase there is no code to write - just code to get rid of.


             Craig L Russell                                               
             n.COM>                                                     To 
             Sent by:                                                   cc 
             .COM                                                  Subject 
                                       Re: Remove toString from children   
                                       of OpenJPAId - Please - please -    
             04/07/2008 04:30          please                              
             Please respond to                                             

Hi Abe,

On Apr 7, 2008, at 8:57 AM, Abe White wrote:

> I believe parts of OpenJPA may rely on being able to stringify an id
> and
> then reconstruct it using the id class's Class,string constructor.
> (And
> if not OpenJPA, then certainly Kodo's JDO bindings).

Right, so the String should be the more detailed String but with the
actual subclass name instead of the superclass.

So isn't this a bug, for which we would dearly love to see a patch?


P.S. As Patrick pointed out, anyone can play with the code via svn and
see where the problem is and how to fix it.

It might be good to start with a test case and we can discuss whether
the behavior currently implemented is correctly designed.
> On Fri, 2008-04-04 at 17:32 -0700,
> wrote:
>> I dont think anyone responded to this request yet - so I am asking
>> again
>> I would like OpenJPA to remove all the toString() method on all
>> children
>> class of OpenJPAId.
>> Reason: OpenJPAId class already has the toString() and it handles
>> it well.
>> It puts the type and the id together - like this:
>> com.myCompany.Account-2345
>> This is very useful behavior when managing a cache (or even looking
>> into
>> the log file).
>> Currently all the children have their own toString() which just
>> outputs the
>> id - This is not useful becuase it is not possible to distinguish
>> between
>> the types inside one cache. All types in the cache are
>> DataCachePCData.
>> Frederic
>> PS: Can someone give me check in right in the code base... ;) -
>> Have a good
>> week end everyone.
> Notice:  This email message, together with any attachments, may
> contain information  of  BEA Systems,  Inc.,  its subsidiaries  and
> affiliated entities,  that may be confidential,  proprietary,
> copyrighted  and/or legally privileged, and is intended solely for
> the use of the individual or entity named in this message. If you
> are not the intended recipient, and have received this message in
> error, please immediately return this by email and then delete it.

Craig Russell
Architect, Sun Java Enterprise System
408 276-5638
P.S. A good JDO? O, Gasp!

View raw message