Query objects and hashCode() + equals()

2009-10-16 Thread Joerg von Frantzius
Hi, it would be nice if the spec would mandate that implementations of javax.jdo.Query do correctly implement hashCode() and equals(). Alternatively, Query.toString() could be required to return the single-string representation of the query, or some dedicated method was added to provide it. This

Re: Query objects and hashCode() + equals()

2009-10-23 Thread Craig L Russell
Hi Jörg, On Oct 16, 2009, at 9:50 AM, Joerg von Frantzius wrote: Hi, it would be nice if the spec would mandate that implementations of javax.jdo.Query do correctly implement hashCode() and equals(). As users execute mutator methods on queries, the string representation would change. And f

Re: Query objects and hashCode() + equals()

2009-11-16 Thread Joerg von Frantzius
Hi Craig, you are absolutely right about the Query object being mutable, and this conflicting with its use as a key in a HashMap. But telling from the general contracts of Map, equals() and hashCode(), I don't think that there exists a requirement for Map keys to be immutable. There may also be ot

Re: Query objects and hashCode() + equals()

2009-11-16 Thread Craig L Russell
Hi Jörg, On Nov 16, 2009, at 8:32 AM, Joerg von Frantzius wrote: Hi Craig, you are absolutely right about the Query object being mutable, and this conflicting with its use as a key in a HashMap. But telling from the general contracts of Map, equals() and hashCode(), I don't think that there

Re: Query objects and hashCode() + equals()

2009-11-17 Thread Joerg von Frantzius
Hi Craig, please see below... On 11/17/2009 12:52 AM, Craig L Russell wrote: [..] > Right. What I said is that for use as an element in a Set or as a key > in a Map, the instance should return the identical hashCode and behave > identically with respect to equals. So while the instance itself do

Re: Query objects and hashCode() + equals()

2009-11-17 Thread CRomberg
(sub)set of the immutable fields. Cheers, Christian From: Joerg von Frantzius To: Craig L Russell Cc: jdo-dev@db.apache.org, JDO Expert Group Date: 17.11.2009 12:55 Subject: Re: Query objects and hashCode() + equals() Hi Craig, please see below... On 11/17/2009 12:52 AM, Craig L

Re: Query objects and hashCode() + equals()

2009-11-17 Thread Andy Jefferson
> Our application framework caches the results of certain queries. It does > not hand out the respective Query objects to application code, and it > does not itself invoke any mutators on these Query objects. DataNucleus v2.x also allows caching of query results (for non-legacy JDOQL implementati

Re: Query objects and hashCode() + equals()

2009-11-17 Thread Joerg von Frantzius
Hi Andy, all I could find in the docs was http://www.datanucleus.org/extensions/query_cache.html which is about caching of "query compilations". Or do you mean that it could be used to store query results along with a cached QueryCompilation object? On 11/17/2009 06:19 PM, Andy Jefferson wrote: >

Re: Query objects and hashCode() + equals()

2009-11-17 Thread Andy Jefferson
> all I could find in the docs was > http://www.datanucleus.org/extensions/query_cache.html which is about > caching of "query compilations". Or do you mean that it could be used to > store query results along with a cached QueryCompilation object? PMF prop(s) http://www.datanucleus.org/products/a