1. In a given transaction, if I need to insert/update few records (say around 5 records) in different tables (say around 5 tables), can someone tell me which is the best approach to follow: JDBC batch updates or stored procedures?
2. We are going to use Hibernate3.0 in our project. In that case which is the prefered solution: Using JDBC batch updates through Hibernate or using stored procedures through Hibernate?
Thanks
Sivaraman
-
JDBC Batch Updates vs Stored Procedures (7 messages)
- Posted by: siva raman
- Posted on: December 27 2005 08:12 EST
Threaded Messages (7)
- JDBC Batch Updates vs Stored Procedures by Jyothish John on December 28 2005 06:49 EST
- JDBC Batch Updates vs Stored Procedures by siva raman on December 30 2005 00:07 EST
- JDBC Batch Updates vs Stored Procedures by umar ali on December 30 2005 10:20 EST
- JDBC Batch Updates vs Stored Procedures by Mathew Thomas on December 30 2005 15:23 EST
- Complex SPs and loose-coupling to DB by Brian Nulty on January 04 2006 07:59 EST
- JDBC Batch Updates vs Stored Procedures by abhishek bhargava on January 09 2006 13:13 EST
- JDBC Batch Updates vs Stored Procedures by George Coller on February 09 2006 17:41 EST
-
JDBC Batch Updates vs Stored Procedures[ Go to top ]
- Posted by: Jyothish John
- Posted on: December 28 2005 06:49 EST
- in response to siva raman
Stored Procs.......!!!!!! -
JDBC Batch Updates vs Stored Procedures[ Go to top ]
- Posted by: siva raman
- Posted on: December 30 2005 00:07 EST
- in response to Jyothish John
ok. Thanks for your suggestion. Can you please tell what is the advantage in using stored procedures? Won't JDBC Batch updates give the same/equivalent performance as Stored procedures? -
JDBC Batch Updates vs Stored Procedures[ Go to top ]
- Posted by: umar ali
- Posted on: December 30 2005 10:20 EST
- in response to siva raman
I'll prefer JDBC updates 'cos stored procedures have different syntaxes for different databases. Also, some databases do not support SPs at all. -
JDBC Batch Updates vs Stored Procedures[ Go to top ]
- Posted by: Mathew Thomas
- Posted on: December 30 2005 15:23 EST
- in response to siva raman
In my current project i use hibernate 3.0. But I use stored procedures in ORacle for certain data intense tasks. For example a certain use case requires making copies of existing data and this would involve potentially thousands of records. Perfect for stored procs and a definite no-no for any type of ORM tool.
In your case u have only 5 records..so its not a data intensive task. Secondly I am guessing you have relations between these tables in which case hibernate may be the better choice. Then again if these 5 inserts/updates happen very very often then there can be a case for jdbc or stored procs.
not sure i answered anything... see these questions are very dependent on the project + use case. Only u can make the call. -
Complex SPs and loose-coupling to DB[ Go to top ]
- Posted by: Brian Nulty
- Posted on: January 04 2006 07:59 EST
- in response to Mathew Thomas
We too have Hibernate 3.0 an Oracle 9i Database and many (fairly complex) Stored Procedures. We need the stored procedures for performance reasons but we also want to reduce our dependecies on the database (or at least confine required changes from a database change to a well-defined and limited number of places). Has anyone any suggestions for this? I don't think that JDBC batch updates will be useful because they are just for simple updates and can't provide additional logic (but I may well be wrong).
TIA - BrianIn my current project i use hibernate 3.0. But I use stored procedures in ORacle for certain data intense tasks. For example a certain use case requires making copies of existing data and this would involve potentially thousands of records. Perfect for stored procs and a definite no-no for any type of ORM tool.In your case u have only 5 records..so its not a data intensive task. Secondly I am guessing you have relations between these tables in which case hibernate may be the better choice. Then again if these 5 inserts/updates happen very very often then there can be a case for jdbc or stored procs.not sure i answered anything... see these questions are very dependent on the project + use case. Only u can make the call.
-
JDBC Batch Updates vs Stored Procedures[ Go to top ]
- Posted by: abhishek bhargava
- Posted on: January 09 2006 13:13 EST
- in response to siva raman
1. I think that stored procedures would be faster since stored procedures are precompiled at the database end whereas queries need to be compiled if they are not being cached. Also stored procedures are helpful when your INSERT queries depends upon other tables.
2. Again Hibernate too uses JDBC to query the database.
So stored procedures are a better approach.
3. The only advantage of Batch updates is that multiple JDBC statements are executed in a single JDBC call.
Please tell me if I am wrong.
Regards,
Abhishek Bhargava -
JDBC Batch Updates vs Stored Procedures[ Go to top ]
- Posted by: George Coller
- Posted on: February 09 2006 17:41 EST
- in response to siva raman
1. In a given transaction, if I need to insert/update few records (say around 5 records) in different tables (say around 5 tables), can someone tell me which is the best approach to follow: JDBC batch updates or stored procedures?2. We are going to use Hibernate3.0 in our project. In that case which is the prefered solution: Using JDBC batch updates through Hibernate or using stored procedures through Hibernate?ThanksSivaraman
Probably too late for your project but why not prototype both and see which one works better for your data/environment. Many people jump toward using stored procedures with the assumption that they'll perform better (and they may). The question is how do they perform under load.
If high load isn't a problem then who cares which one performs sightly better? I'd go for the JDBC for easier maintenance (assuming your team is stronger in java than plsql).