• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using OR mapper query XML format as a dumb query format?

 
chris webster
Bartender
Posts: 2407
33
Linux Oracle Postgres Database Python Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

Thanks for any help you can offer!

Chris
 
Arun Kumarr
Ranch Hand
Posts: 661
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried JPA.
 
chris webster
Bartender
Posts: 2407
33
Linux Oracle Postgres Database Python Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the suggestion, Arun.

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!

Chris
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic