substring works with string but not with char

#1

i want to select all entities whose name starts with a specific letter, i can use this query with a string parameter

select f from Foo f where substring(f.name, 1, 1) = ?1

but when i use a char, the query does not return anything.

i think it should also be possible to use char/Character types, do you agree?

#2

I am not sure that this comparison is valid, since the type of the left side expression is String and the type on the right side expression (the parameter) is Character.

In ObjectDB as in Java char is comparable to int but not to String.

Maybe an exception has to be thrown on attempt to set a non String value for the parameter in this case.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
#3

yes, i changed my mind and agree with you. throwing an exception is this case is good idea ;)


Post Reply

To post a reply and/or subscribe to update notifications - please login