Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Query for a Integer/int and treat it like a String (with LIKE %123%)

Hi Chris,

When EclipseLink is in Object-Relational mode(JPA or Native API), we are somewhat limited by the capabilities of the underlying SQL implementation. Any query that goes to the database is going to have to run SQL to get results from the DB. Unless there is a way to translate your query so it can be executed on any DB, there is not much additional "magic" we can provide. The only place we avoid that is in our in-memory querying (mentioned below), and that will depend on having all possible results in-memory.

I am not sure about how various DBs handle LIKE with numbers. I suspect some allow it to work and some do not.

All I can suggest is to write your query so it works on MySQL and any other DBs you are able to test. Then check your EclipseLink session's database platform to ensure you are on a supporting platform and either throw an exception or execute a different query.

If you can think of SQL that will work on other DBs, our expression framework is quite extensible, and it may be possible to extend our expression framework to produce different queries depending on the DB platform. This is, of course, dependent on being able to come up with a query that will work in the generic case.

If any of the strategies suggested is helpful, this mailing list should be able to help get them going for you,
-Tom

t3_chris wrote:
Hi Tom!

It's curious but i found out that MySQL is able to perform queries with
"LIKE"-clauses on INT and BIGINT datatypes. I fear, that if i would be able
to hand this MySQL specific Query to EclipseLink i'd loose database
independence and stick to MySQL?

Regards,
  christian



Back to the top