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.

You could call the function directly using a stored procedure with HQL. Unless, of course, you're going to have to call this function for every entry in the table. But if you do it within the same hibernate session, as long as you aren't doing to many calls at the same time, this should work without a significant performance hit.

Need Your Help

How to make UIImageView.clipsToBounds = NO allow userInteraction outside of bounds?

ios objective-c uiimageview

I currently have my UIImageView.clipsToBounds = NO; and it works great except I need userInteraction to be enabled so that if a child view is touched I can respond to the touch. Anyone know how to ...