Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8999171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:08:41+00:00 2026-06-16T00:08:41+00:00

May I know by configuring the data source in Spring like this: <bean id=dataSource

  • 0

May I know by configuring the data source in Spring like this:

<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
  <property name="jndiName" value="jdbc/dev"/>
  <property name="lookupOnStartup" value="false"/>
  <property name="cache" value="true"/>
  <property name="proxyInterface" value="javax.sql.DataSource"/>
</bean>

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
  <property name="dataSource">
    <ref bean="dataSource"/>
  </property>
  ...
</bean>

And configuring my BOC and DAO object in Spring like this:

<bean id="Dao" class="com.dao.impl.DaoImpl">
  <property name="sessionFactory" ref="sessionFactory"/>
</bean>

<bean id="Bo" class="com.bo.impl.BoImpl">
  <property name="theDao">
    <ref local="Dao"/>
  </property>
</bean>

Currently I am testing it with 3 users, 1 successfully insert data into DB, 1 is hung, and 1 is missing in action, meaning there is no response, no log was capture in Websphere Application Server. With 3 users concurrently using the app has failed the test case, may I know how could I ensure all these are thread safe when come to a situation when there are 1000 users using the app concurrently?


UPDATE

In response to @Adrian Shum query:

Regarding the BO thing, I’m not sure what pattern is this. But I’m BOC is stand for Business Object Controller, the purpose of having this unit class is to separate the business logic from DAO object. Eventually this will end up the XHTML/JSP is the front-end, BO is the business controller, and DAO is concern about hibernate and query construction.

In order to retrieve the session factory, every DAO object must extends the HibernateDaoSupport, this is how Spring-Hibernate Integration work according to this tutorial. Here is some code snippet:

class DAO extends HibernateDaoSupport implements IDao {

  public void save( Pojo pojo ) {
    getHibernateTemplate().save(pojo);
  }

  public void update( Pojo pojo ) {
    getHibernateTemplate().update(pojo);
  }

  public void delete( Pojo pojo ) {
    getHibernateTemplate().delete(pojo);
  }
}

I know that Spring object are singleton by default. Does this means each thread will have only ONE object or the whole JVM instance will have only ONE object? What if I declare those BO and DAO object as session scope like this:

<bean id="Dao" class="com.dao.impl.DaoImpl" scope="session">
  <property name="sessionFactory" ref="sessionFactory"/>
</bean>

<bean id="Bo" class="com.bo.impl.BoImpl" scope="session">
  <property name="theDao">
    <ref local="Dao"/>
  </property>
</bean>

Regarding the data update or retrieval, this could happen as the 3 users that we are testing on is actaully targeting on the same record. There might be a lock as I notice that there is a function doing this code:

Query queryA = session.createQuery("Delete From TableA where fieldA = :theID");
queryA.setParameter("theID", "XX");
queryA.executeUpdate();

Query queryB = session.createQuery("Delete From TableB where fieldB = :theID");
queryB.setParameter("theID", "YY");
queryB.executeUpdate();

// update tableB object
session.save(tableBObj);

// update each tableA object
for(TableAObj obj : TableAObjList) {                
  session.save(obj);
  session.flush();
  session.evict(obj);
}

The TableA(slave) and TableB(master) has relationship in each other. I know there is a database design between TableA and TableB but this is beyond of this question. I’m just curious whether this function could cause the concurrent issue even though I made this class as singleton?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:08:42+00:00Added an answer on June 16, 2026 at 12:08 am

    I have the problem resolved. It is due to the DB2 failed to handle concurrency issues by adding a new column into the table, and make it as a primary key.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As you may know, the standard SWT main loop looks like this: Display display
As you may know Coherence provides filtering api against its cache-cluster, like this: //
You may know this recommendation from Microsoft about the use of exceptions in .NET:
As you may know, when we have this code in Javascript : function getName()
As you may know, pinterest api seems down now.( api.pinterest.com )In this site: http://tijn.bo.lt/pinterest-api
Some of you may know me from this question: Sticky Footer (not sticking!) Thanks
As you may know from my previous posts, I'm learning Python. And this time
You awesome people may know how to do this. I know that once I
I am using facebox (you may know of it) and my script looks like
i'm trying to read contents of PNG file. As you may know, all data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.