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?

Answers


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.


Need Your Help

Execute Stored Procedure in PHP not working

php sql stored-procedures views

We are currently using this PHP code in order to query a view however, we want this to now execute a stored procedure.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.