Search This Blog

Friday, 22 June 2012

Hibernate And Bulk Operations -2

I the previous post we saw bulk updates via Hibernate. We can also perform bulk deletes and bulk inserts through Hibernate.
Bulk Deletes
static void testBulkDelete() {
    Session session = sessionFactory.openSession();
    Transaction transaction = null;

Tuesday, 5 June 2012

Hibernate And Bulk Operations -1

We have often executed SQL queries of the type:
update <table> set <record_column> = <value> where <condition>;
These kind of queries that results in multiple records being updated are termed bulk updates.Hibernate allows us to do the same too. Consider the below code that updates the name column of all Entity records

Saturday, 2 June 2012

Hibernate And Batch Operations

There are often scenarios in our application wherein we need to perform batch updates. For example if there was a need to update the zip code of all records in Address table a batch update would be a very good way to achieve the same. A single update SQL query would ensure that the job is done at the database level.
However there arise complications in big applications wherein the update operation would be much more complex then a singe update query or the code complexity better handled in java then in a stored procedure.

Sunday, 13 May 2012

The ApplicationContextAware Interface

In the previous post we saw how the ApplicationContext as the more powerful container in Spring. In a BeanFactory based environment Spring provides us with the BeanFactoryAware interface to help a bean get access to its loading BeanFactory container.Similarly for the application context

Tuesday, 1 May 2012

Using the ApplicationContext

In all of the previous posts we have been working with the BeanFactory. However in order to use all of Spring's functionalities we need to use a more powerful version of the Spring Container.