Search This Blog

Wednesday, 11 April 2012

Can we auto and explicitly wire a bean ?

While the Spring Container allows us to auto-wire a bean, it does not mean, that the bean must be completely auto wired by the container.

Tuesday, 10 April 2012

Autodetecting The Autowiring

The last technique in autowiring is auto-detect. In this case we tell the Spring container to uses its own brains while configuring the bean.

Saturday, 7 April 2012

One to One and Proxies

As a part of its default fetch strategy, Hibernate uses proxies for collections and all associations when we get an Entity from the database. The proxies have only their id set with access to any other property triggering a further select statement. The idea here is to only hit these tables when the data is needed. But the behavior varies slightly for one to one associations.

Tuesday, 3 April 2012

Lazy Behavior in Hibernate

Hibernate has an attribute called lazy. This makes an appearance in various parts of the hbm file. The first point is the class element. (To try these properties, I am using the same Book- Shelf example from an earlier post.)

Sunday, 1 April 2012

hibernate.use_identifier_rollback

Consider the below code that loads an entity from the database and deletes it.
public static void rollBackDelete() {
    Session session = sessionFactory.openSession();
    Entity entity = new Entity();