This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Five Lines of Code and have Christian Clausen on-line!
See this thread for details.
Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

Jean Jorge Michel

+ Follow
since Oct 29, 2008
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jean Jorge Michel

Guys, I resolved this error.

In a Brazilian JUG e-mail list (RSJUG) one participant named Julio told me that I should start Spring`s context together my application and not instantiate in every backbean`s method an ApplicationContext object. It was my error, creating always a new instance of my pool, etc�

Searching in Google I found how make it and now all it is working fine

My web.xml:

In faces-config.xml I defined that the backbean receive a facade.

Set how resolves this EL expression

In faces-config.xml too:

In login backbean have an attribute named userFacade, getters and setters to this and none instantiate code of ApplicationContext object, Spring inject it to me.

Thanks for all answers.
Satish, thanks for your attention.

I am new Spring�s user (of course hahaha), and this configuration is the result of hours and hours fighting with Spring and search on Google a silver bullet to save me.

Today on morning (now in Rio de Janeiro/Brazil is 10: 50AM) I tried:

And the problem is the same.

Let me show �all problem�.

I Start MySQL DB and log in, is created 2 connections.
When I start my Tomcat and do login my pool is initialized and is created three new connections.
After login my JSF navigation rule redirect the browser to home, this page search on DB my notes and show it in a table. In this point is created more three connections. Now I have 8 connections with MySQL.

My transaction management is ignored or my pool is crazy =)

Here is my codes.

First login flow.

Second home flow:

Some idea?

Thanks for all help.
Is not it, do not work ;(

I am looking in MySQL console (Windows� command prompt) and for all hit is open a new connection
This problem will kill my project, if I do not able to control this problem Spring + Hibernate will be removed from the project and I will be forced to use procedures + JDC (noooooo!!!).

Someone have any idea to help me?


My new attempt is:

Hi guys!

I�m trying using Spring + Hibernate to persist system�s objects (Hibernate) and control transactions (Spring).
But every interaction with DB (MySQL) a new connection is opened, ignoring my pool (c3p0) configuration.

My example is so simple, User and Note objects to persist.
My example is organized in three packages:

There are two classes:

These objects are annotated to Hibernate.

There are three interfaces:

And three implementations:
SpringDAO extends HibernateDaoSupport
and implements GenericDAOInterface
UserDAO extends SpringDAO
and implements UserDAOInterface
NoteDAO extends SpringDAO
and implements NoteDAOInterface

These objects are annotated with @Repository.

There are two interfaces:

And two implementations:
UserFacade implements UserFacadeInterface
NoteFacade implements NoteFacadeInterface

These objects are annotated with @Transactional.

When I use the system this work fine, I can persiste my beans. I look in MySQL and my system start the first operation (login) creating three connections and to every operation with DB (list my notes, view register/view page with correct register data filed, etc) is opened a connection in MySQL.

I tried create a TransactionManager, TransactionInterceptor, etc� into my applicationContext.xml but I cant�t make Spring use my transaction configuration!!! I tried put in dataSource bean a declararion type: <property name="transactionManager"><ref local="transactionManager"/></property> but don�t work or in Hibernate properties: <prop key="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</prop>.

Someone can help me? My config file is: