Reputation: 255
Greetings everybody,
I came across the feature of using java in oracle, a few days back. Ever since I am wondering about the possibility of writing static methods in java replacing regular PL/SQL logic.
As I have reasonably adequate experience with java plus the rich libraries it offers, I am tempted to write java methods instead of regular PL/SQL. Would this be a good practice?. Will there be much performance overhead in doing so?. Thanks in advance.
Upvotes: 3
Views: 2243
Reputation: 1151
It depends! They are two languages for different purposes!
What kind of operations do you want to do?
In this case, I believe Pl/SQL is the best choice for performance.
Attention, I wrote PL/SQL:
The power of this two languages, strictly tied in Oracle, let you write application which access data in Oracle in faster and easier way than in any other language.
Do you need:
In this case I think Java is a better choice, 3rd choice in Oracle.
But I'm not reinventing the wheel, this information are largely accessible and proved by Oracle experts like Tom Kyte etc.
Just some useful link to search:
Upvotes: 6
Reputation: 2438
I think it can be acceptable if you store the CRUD operations as stored procs. If you use any ORM framework, then you might map the SPs. It is more usual that the database is the more stable part of the application. The application might be refactored or replaced, but the database does not change (it is just my experience).
Upvotes: 2
Reputation: 23443
There will be overheads involved in your decision to walk away from PL/SQL into Java code.
Although i am not a big believer of putting business logic into PL/SQL, i have seen just too many companies doing that, including my own.
The "performance consideration" of doing this does not come as whether or not to use static
methods. For example, you may need to declare an arraylist to sort the values, and depending on the values, retrieve more results from the database in another query.
IMO, i would put business logic in my application, and not invest in PL/SQL. This also helps to ensure DBMS portability and not buy-in.
Upvotes: 10