ObjectDB ObjectDB

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?

edit
delete
#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
edit
delete
#3

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

edit
delete

Reply

To post on this website please sign in.