Hi there I’m using JPA to query a database and I should do a column like 'whatever%' query.
My DB is currently Mysql so I could do that without problem, but I was wondering if there was somewhere a method to retrieve the Wildcard character of the database.
There’s little chance I change the DB but well … I’m trying to be as generic as possible.
So is “%” the only wildcard (not talking about _) used, and will forever be ?
Thanks for info!
%is ANSI SQL. This value isn’t configurable in any of the major databases, and as such there is no need for these databases to provide a method to return the wildcard character.This should only be a concern if you think you might migrate to a non-ANSI SQL database, such as MS Access, which uses a
*as a wildcard character.If is is a possibility, I’d suggest making the wildcard character configurable in your application, and provide a variable containing the wildcard character instead of a hard-coded character.