• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Need ORM that allows interception (and modifiation) of qeuries

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am designing a solution for a project, but to achieve my current design goals I need to be able to intercept (and modify) 99% of all queries in the ORM before they are executed.
NOTE: for purposes of code maintenance and performance intercepting the result sets while functional is not adequate

Ideally, I would like to intercept and manipulate the query objects (specifically add additional 'where' parameters) and not have to intercept the native SQL. Though I could work with intercepting the native sql, if I had to.

I have only used hibernate before for ORM, I have been unsuccessful in finding a means to do this sort of interception with the hibernate API(I would love it if someone can point me to a solution in hibernate)

I have just discovered @queryreceptors in eclipselink but I'm not sure this is what I'm looking for though, if there is a eclipselink guru out there that could clarify it for me that would be awesome. Anyone else aware of any other ORM that may provide this type of functionality?

Many thanks in advance,
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not a technology per se, but you could use AOP to write an interceptor on the methods that the ORM uses to access the database? That would let you modify them as they go by.
 
Kevin Embree
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Interesting idea, I haven't used a generic AOP before, that would provide the benefit that I don't have to abandon hibernate, which I'm already comfortable with.
Any AOP recommendations? I happen to be developing for a Wildfly application server. They probably have a bundled one. I'll have to check. If anyone else knows of a ORM with built-in functionality to do this I'd still like to know of it.
But for now I will read up on AOPs.

thanks!
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I recommend reading this similar discussion: https://coderanch.com/t/648601/ORM/databases/native-SQL-fragment-clause-bigger
 
Kevin Embree
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For me the solution I'm going with is using a visitListener in JOOQ. It allows full automated manipulation of the SQL and with proper usage can ensure the correct manipulations are applied to every applicable SQL throughout the entire application.
 
reply
    Bookmark Topic Watch Topic
  • New Topic