You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by "Janssen, Roger" <Ro...@ibanx.nl> on 2005/07/01 00:21:38 UTC

Querying on value in hashset that is mapped on varchar

Hi,

I have got a question that i cannot resolve myself. I have a class with an
member of type Set (implemented by HashSet). This set will contain string
values. In the class descriptor i configured the usage of a conversion
strategy (from string-hashset to varchar). Storing an object and retrieving
it works fine.

Now i want to query, giving selection criteria based on this member.
Searching with the 'equals' operator will not return anything if the object
has multiple values stored in the hashset. I can understand that, and regard
this as correct behaviour. I should be able to retrieve the object using a
clause with the 'like' operator. Here it gets nasty. The ojb Criteria class
expects the values to be in the same type as the member, in this case i add
a criteria value that is an instance of HashSet with one string value. (This
works, and is needed, otherwise the conversionstrategy will fail because it
expects a HashSet.) Searching with the 'like' operator, i get a
ClassCastException however, because the LikeCriteria class expects a String
as the value! But when a pass a string a the value, building the query will
fail because then the conversionstrategy is executed and it expects a Set!!!

Do you get the paradox?

Does somebody know how to get around it??

Oh yeah.. i am using 1.0-rc6 (waiting for the 1.1 that has some new
functionality i am eagerly awaiting)

And it would be great if the Criteria class would be pluggable, so if
necessary, i could use my own implementation... (this might have been such a
case :) )

thanx,

Roger Janssen
iBanx


************************************************************************* 
The information contained in this communication is confidential and is 
intended solely for the use of the individual or entity to  whom it is 
addressed.You should not copy, disclose or distribute this communication 
without the authority of iBanx bv. iBanx bv is neither liable for 
the proper and complete transmission of the information has been maintained 
nor that the communication is free of viruses, interceptions or 
interference. 

If you are not the intended recipient of this communication please return 
the communication to the sender and delete and destroy all copies. 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org