Hibernate and Oracle native functions
I have an entity that maps to an external oracle table which is one of the primary data sources of my application. This entity is modelled using hibernate.
The oracle table now has a complex function defined the calculates some special values. I need to call this function somehow - almost as another accessor on the entity.
What would you suggest is the best way to incorporate this function call so that I can maintain relatively normal hibernate access to the entities?
I have a solution using the @Formula annotation
In order to keep the decoupling from your database, provided by Hibernate, I would rely on Oracle to invoke this function, using triggers or views.
The main advantage of this approach is that it is totally seamless to your Hibernate implementation.