For my sins in a wicked earlier life, I am now working as an Oracle developer on a strange hybrid Java/Oracle project. The latest oddity is that our Java developers need to pass some dynamically generated SQL query conditions into the database for us to construct a SQL query and database view that will then be made available to another application. The columns and joins are relatively simple, but they are wondering how to format the SQL query conditions so as to make sure we capture nested AND/OR conditions etc. We've ruled out a simple string, mainly because the Java app doesn't know enough about the DB to build it reliably.
My idea is that we could use an ORM e.g. Hibernate on the Java side simply to build a query object, then extract the XML query definition and pass this into the Oracle process for us database monkeys to unpick for ourselves. However, we don't use an ORM right now (don't ask me why), and the architects won't want to introduce any extra dependencies e.g. forcing synchronisation of Hibernate and DB table definitions etc. This might rule out using Hibernate, but I don't know enough about these things to judge e.g. if we can simply force Hibernate to think it knows about the relevant DB objects for building the query.
I realise this is a weird way of doing this, but can anybody suggest a suitable ORM or some other simple SQL builder for the Java guys to use that would produce a fairly generic query representation e.g. in XML that we can then pass into the DB to extract on the Oracle side?
We decided just to make up our own simple XML query format, loosely based on the OGC OpenGIS Filter Encoding standard (http://www.opengeospatial.org/standards/filter). Our cut-down version is good enough for our purposes, and requires no extra Java, which is fine with us Oracle-heads!