Hi,
Configuration: Hibernate 2 / My SQL 4.1 and JBOSS 2.3.6. I am using the hibernate.cfg.xml and hibernate.properties file instead of the hibernate-service and jboss-service... ISSUE?
Otherwise, I playing with multi-threading and I am encountering the fact that I am missing records when processing the second thread. Here is the details:
The following line is where the code stops:
OfferBookMarketOverview offerBookMarketOverview;
try {
offerBookMarketOverview = (OfferBookMarketOverview) t.session.get(
OfferBookMarketOverview.class, productId, LockMode.UPGRADE);
} catch (HibernateException ex) {
throw new BaseException(ErrorIds.DB_TECHNICAL_ERROR, ex);
}
Later, the first thread inserts a record in my Offer table... then the second tread takes over with the following line:
try {
offers = t.session.createCriteria(Offer.class).add(
Expression.eq("productId", productId)).add(
Expression.eq("side", side)).list();
} catch (HibernateException ex) {
throw new BaseException(ErrorIds.DB_TECHNICAL_ERROR, ex);
}
Here, the newly entered offer is missing...
WHY? I tried to change caching from Eh to Hashtable, etc.... but still the same thing.
Thanks for your help...
David.
|