Hi,
I do not understand eactly why you would want to know which bean (pk
identity) is loaded and within a transaction if thats what your asking. How
the containers reause instances across transactions and handles concurrency
is really of no concern during your bean development and really should not
influence any coding issues. Maybe you could elaborate on why you need this
info.
kind regards,
William
> -----Original Message-----
> From: Giri [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, April 13, 2000 2:18 PM
> To: [EMAIL PROTECTED]
> Subject: Load Balancing using Entity Beans
>
> Hi All,
>
> I am using atleast 2 Entity Beans , each of which maintain a
> Database connection. Now inside Stateful Session Bean I am accessing the
> Database through the
> connection provided by the entity Beans.
>
> My question is suppose 2 clients are accessing the Session
> Bean, and if the Session Bean created by client1 is accessing Entity Bean
> 1 , how can I route my 2nd
> Session Bean created by client2 to the "Entity Bean2"?
>
> All the 2 Entity Beans are created during client1 calling the
> ejbHome.create() of Session Bean1.
>
> The attributes of " Session Bean" class are :
> EntityBeanHome th;
> EntityBean items[] = new EntityBean[2];
> protected transient Context ctx;
>
>
> Is there any method which can tell me whether the particular Entity Bean
> is free or in use?
>
>
> public void ejbCreate()
> {
>
> try
> {
> ctx = new InitialContext();
>
> try
> {
> th = (EntityBeanHome) ctx.lookup("EntityBeanEJB");
>
> System.out.println("\n After JNDI lookup... " );
>
>
> for (int i = 0; i < 2; i++)
> {
> System.out.println("\n Inside for loop... " );
>
> try
> {
> System.out.println("\n Inside try block... " );
>
> items[i] = th.findByPrimaryKey(new EntityBeanPK(i));
> }
> catch (FinderException e)
> {
> try
> {
> System.out.println("\n Inside try block of catch...
> " );
>
> items[i] = th.create(i);
> System.out.println("Creating... " + i);
> }
> catch (CreateException ee)
> {
> System.out.println("Unable to create transcript");
> System.out.println(ee);
> ee.printStackTrace();
> }
> }
> } // end of for loop
> } // end of try
> catch (NamingException e)
> {
> System.out.println(e.getMessage());
> System.out.println("Explanation " + e.getExplanation());
> e.printStackTrace();
> }
> catch (Exception e)
> {
> System.out.println(e);
> e.printStackTrace();
> }
>
>
> Please Help ..
>
> Thanx in advance..
>
> ==========================================================================
> =
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> of the message "signoff EJB-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
***********************************************************************
Bear Stearns is not responsible for any recommendation, solicitation,
offer or agreement or any information about any transaction, customer
account or account activity contained in this communication.
***********************************************************************
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".