You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by Fr...@capgroup.com on 2008/04/03 19:40:04 UTC

OpenJPA subclasses overwrite toString() - why?

About the OpenJPaID class:

The openjpaId class has a method to output a nice format key.toString()
which is type+objectId. This method has been overwritten by children
classes. Why is this?
The overwritten method only outputs the objectId and therefore is not
convenient when looking into the cache. Can this be reversed?

Even the logging output is not useful with only the objectId (think about
saving multiple object from a graph with same int value for PK - in such a
case the output does not say which class was saved properly or not.

An alternative is to use a nice String as the key for the cache but this is
not efficient compare to using the hashcode of OpenJpaId. So I guess this
is not a good option.

Can we get rid of the toString() method on all subclass of OpenJPAId?


F