| Author |
jta transaction and database
|
Brajendra Mathema
Ranch Hand
Joined: Jun 02, 2009
Posts: 39
|
|
hi i am trying to use jta in container managed application ,
so is it that JTA closes the database connection itself and we don't need to close the database connection explicitly..
if so in my application i am using stateless session bean and persistence unit with transaction type JTA
however i am facing problem of connection not available ... all the connection in the pool gets occupied and database throws exception telling maximum connection size reached....
i am wondering what is the problem....
if any one can help...any help would be appreciable
this is important to me..
thankyou
brajen
|
 |
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Joined: Aug 26, 2006
Posts: 4967
|
|
How have you configured declarative security on your EJB? And what changes have you made to the configuration to ensure the container takes care of the transaction?
If done properly, you won't run out of connections to the database.
-Cameron McKenzie
|
Author of Hibernate Made Easy, What is WebSphere???, JSF 2.0 Made Easy and the SCJA Certification Guides
|
 |
Brajendra Mathema
Ranch Hand
Joined: Jun 02, 2009
Posts: 39
|
|
hi,
i have injected the persistence context in my session bean as:
@PersistenceContext(unitName = "Project-PU")
private EntityManager em;
my glassfish setting under resource is as follows
General Settings
Name: mssql/db_mssql
Datasource Classname: com.microsoft.sqlserver.jdbc.SQLServerXADataSource
Resource Type: javax.sqlXADataSource
Pool Settings
Initial and Minimum Pool Size: 10 Connections
Maximum Pool Size: 100 Connections
Pool Resize Quantity: 5 Connections
Idle Timeout: 300 Seconds
Max Wait Time: 60000 Milliseconds
Connection Validation
Connection Validation: not checked(i.e disabled)
Validation Method: auto-commit(selected value)
Table Name: not selected
On Any Failure: not checked
Allow Non Component Callers: not checked
Transaction
Non Transactional Connections: Enabled
Transaction Isolation:not selected
Isolation Level: not selected
in advance tab : default values are used
so what's the problem...
any idea....
what else are the required setting for CMT in glassfish or stateless ejb class
thanks..
-brajen
|
 |
Brajendra Mathema
Ranch Hand
Joined: Jun 02, 2009
Posts: 39
|
|
Hi, in the above case do i have to use transaction attributes in the stateless session bean...
please give me some idea..
thankyou
brajen
|
 |
Rajesh Kottayil
Greenhorn
Joined: Jun 21, 2009
Posts: 7
|
|
brajen mathema wrote:hi,
i have injected the persistence context in my session bean as:
@PersistenceContext(unitName = "Project-PU")
private EntityManager em;
my glassfish setting under resource is as follows
General Settings
Name: mssql/db_mssql
Datasource Classname: com.microsoft.sqlserver.jdbc.SQLServerXADataSource
Resource Type: javax.sqlXADataSource
Pool Settings
Initial and Minimum Pool Size: 10 Connections
Maximum Pool Size: 100 Connections
Pool Resize Quantity: 5 Connections
Idle Timeout: 300 Seconds
Max Wait Time: 60000 Milliseconds
Connection Validation
Connection Validation: not checked(i.e disabled)
Validation Method: auto-commit(selected value)
Table Name: not selected
On Any Failure: not checked
Allow Non Component Callers: not checked
Transaction
Non Transactional Connections: Enabled
Transaction Isolation:not selected
Isolation Level: not selected
in advance tab : default values are used
so what's the problem...
any idea....
what else are the required setting for CMT in glassfish or stateless ejb class
thanks..
-brajen
Hello brajen mathema,
I had one suggestion on database driver configuration you selected,
can you try it with the
com.microsoft.sqlserver.jdbc.SQLServerDataSource driver.
|
 |
 |
|
|
subject: jta transaction and database
|
|
|