Win a copy of Head First Android this week in the Android forum!

Ngoc Tiep Vu

+ Follow
since Nov 11, 2008
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ngoc Tiep Vu

Originally posted by Satish Kandagadla:

Did you use the same HibernateUtil class as the one posted in the Hibernate site or you have created one of your own? can you paste the code for HibernateUtil class?


Thank you for your reply. I have HibernateUtil class created. Here is the code:


public class HibernateUtil {

public static final String JNDI_SESSION_FACTORY_NAME = "...";
public static final String JNDI_CLASS = "...";
public static final String JNDI_URL = "...";

public static Configuration hibernateConfig = null;
public static SessionFactory sessionFactory = null;

* Log4j logger
private static Log logger = LogFactory.getLog(HibernateUtil.class);

* Initialize hibernate configuration and create SessionFactory object
* @return true if success
public static void setup() {

try {
// Check if the SessionFactory not exists then build it. The new SessionFactory is
// automatic binded with JNDI (see hibernate.cfg.xml)
if (getSessionFactory() == null) {"creating hibernate session fatory...");
hibernateConfig = new Configuration().configure();

sessionFactory = hibernateConfig.buildSessionFactory();
catch (Throwable ex) {
logger.debug("HibernateUtil.setup: " + ex.getMessage());
throw new ExceptionInInitializerError(ex.getMessage());

* Return the global SessionFactory
* @return SessionFactory
public static SessionFactory getSessionFactory() {

return sessionFactory;

* Close the current SessionFactory and release all resource.
* The other Functions schould not be called after calling of this function
public static void shutdown () {"close hibernate session fatory...");

if (sessionFactory != null)

sessionFactory = null;
hibernateConfig = null;

I am a Beginner with Jboss and webservice. In Jboss there is a type of web service: "Web service enabling an EJB". I do not know, what is the difference between this type of Web service and the normal web service ? what is the advantages of "Web service enabling an EJB" in Jboss.

Thanks in advance.
13 years ago

Originally posted by Satish Kandagadla:
Have you tried checking the database after updating it with the first client? Is the data updated in the database?

[ November 14, 2008: Message edited by: Satish Kandagadla ]

Yes, i have check the data in database server. After updating with the first client, data in database is updated, but the second client can read only the old data.

Originally posted by Paul Sturrock:
Post the code where you update your data.

Hello Paul,

Thank you very much for your replying. Here is my code for update data and load data:

[ November 14, 2008: Message edited by: Paul Sturrock ]

Originally posted by Paul Sturrock:
Please don't wake up old topics.

Sunil Kumar Gupta had two applications accessing the database, the Java one doing so through a web service backed by Hibernate. And he was using the second level cache. Is your application's architectrue the same (or simmilar) and have you tried all the suggestions listed above?

Sorry for my inconvenience. But i have the same problem with Suni Kumar Gupta. I have try all suggestions in this thread, but these can not solve my problem.

In my application architecture, i have two different clients, that accessing the same database with hibernate. Each clients create its own Hibernate Session Factory. When a Client update new data, another client can only get the old data, except when i restart the another client (that means a new Session Factory was new created).

Here is my Hibernate Configuration:


<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://...</property>
<property name="hibernate.connection.username">...</property>
<property name="hibernate.connection.password">...</property>
<property name="hibernate.connection.pool_size">10</property>
<property name="show_sql">false</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.cglib.use_reflection_optimizer">false</property>
<property name="hibernate.cache.use_query_cache">false</property>
<property name="hibernate.cache.use_second_level_cache">false</property>

<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>

And cache status in hibernate log file:

Second-level cache: disabled
Query cache: disabled

Thank you for your helps.
Hello, i have the same problem too, can anyone help ?