LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-14-2005, 11:10 AM   #1
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,092
Blog Entries: 1

Rep: Reputation: 90
EJB: Problem with concurrent calls to EJBs (according to JBoss)


I'm working on a EJB project on JBoss.

I have a connection to DB for every user. I can't use the JNDI pool of connections, because every user connects with his/her own password. So I created a stateful session bean that "remembers" the username and password and the DB connection.

That has worked perfectly.

Of course, due to the fact that I'm working with my own DB connections, I'm using BMP. What I do to "share" une user's connection with all the beans (in one user's session) is have the connection be one of the elements of the PK instance. When I have to work with the DB in the entity beans, I get the connection from the PK. That's a solution that has worked perfectly so far.

However I just learned on friday that Session Beans don't support concurrent calls. That approach doesn't work because I was sharing a single Connection Session bean among all the entity beans, therefore it was possible that two beans wanted to ask the connecion bean for a DB operation. I just started to get problems when I inserted code for ejbLoad() in one of my beans. As the server calls ejbStore anytime, It's obvious the call was happening when There was another Connection Session bean operation going on.

I decided to give each bean one clone of the Connection Session bean. Now each bean has its very own Connection Bean to ask for DB operations at any time. (Remember, the DB connection is handled by a Connection Session bean).

But this approach fails too. :'( I don't know why.

I have decided to change my approach radically and include the DB username and password in the PK instance so that I will create a brand new Connection bean every time one entity bean is to be active.

Do you have other ideas?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem deploying EJBs on JBoss eantoranz Programming 1 04-15-2005 01:46 PM
JBoss: no concurrent calls on stateful beans eantoranz Programming 0 03-11-2005 12:43 PM
jboss start problem dodgethis Linux - Software 0 03-11-2005 11:36 AM
EJB: Problem when creating entity beans eantoranz Programming 1 03-08-2005 08:58 AM
Jboss hell with ejbs plz help juby Programming 0 12-15-2003 02:01 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration