This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes jta transaction and database Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply Bookmark "jta transaction and database" Watch "jta transaction and database" New topic
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.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: jta transaction and database
 
Similar Threads
JTA Problem in VAJ 4
Local transactions in application servers.
Relation between Connection Timeout and Transaction Timeout ?
Make hibernate use JTA transaction in WAS 5.1
Attn : Kyle - JTA Enabling in WAS 4.0.2(Urgent)