I removed all servlet filters and moved the code into a separate servlet. It still does the update. To elminate the exception I made the cache read-write again. But, notice that in the log where it does an update.
Here's the test servlet:
Code:
package com.knowlist.list.main;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.hibernate.Query;
import org.hibernate.Session;
import com.knowlist.list.hh.HibernateInit;
import com.knowlist.list.hh.dao.CustomObjFieldMetaDAO;
import com.knowlist.list.hh.dao._RootDAO;
public class MainPageTest extends HttpServlet {
static {
HibernateInit.doInit();
}
protected void service(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
{
try {
Logger.getLogger(getClass()).debug("1");
Session s = CustomObjFieldMetaDAO.getInstance().getSession();
Query query = s.getNamedQuery("com.knowlist.list.hh.CustomObjFieldMeta.findByObjTypeAndFieldType");
query.setInteger("objType",100);
query.setInteger("fieldType",10);
Logger.getLogger(getClass()).debug("2");
query.uniqueResult();
Logger.getLogger(getClass()).debug("3");
query.uniqueResult();
Logger.getLogger(getClass()).debug("4");
} catch(Exception e) {
throw new ServletException(e);
} finally {
_RootDAO.closeCurrentThreadSessions();
}
}
}
After my app server starts up, here is what is output after I hit this servlet 3 times in a row. Notice that it does the exact same thing each time.
Code:
DEBUG[2005-05-04 19:50:53,453] com.knowlist.list.main.MainPageTest.service(MainPageTest.java:29)(MainPageTest.java29): 1
DEBUG[2005-05-04 19:50:53,625] com.knowlist.list.main.MainPageTest.service(MainPageTest.java:34)(MainPageTest.java34): 2
Hibernate: select customobjf0_.id as id, customobjf0_.visibility as visibility7_, customobjf0_.versionId as versionId7_, customobjf0_.objType as objType7_, customobjf0_.versionOf as versionOf7_, customobjf0_.shortDesc as shortDesc7_, customobjf0_.longDesc as longDesc7_, customobjf0_.fieldType as fieldType7_ from know.customobjfieldmeta customobjf0_ where customobjf0_.objType=? and customobjf0_.fieldType=?
DEBUG[2005-05-04 19:50:53,703] com.knowlist.list.main.MainPageTest.service(MainPageTest.java:36)(MainPageTest.java36): 3
Hibernate: select customobjf0_.id as id0_, customobjf0_.keyName as keyName13_0_, customobjf0_.shortDesc as shortDesc13_0_, customobjf0_.longDesc as longDesc13_0_, customobjf0_.storageParam1 as storageP5_13_0_, customobjf0_.storageParam2 as storageP6_13_0_, customobjf0_.storageParam3 as storageP7_13_0_, customobjf0_.storageParam4 as storageP8_13_0_, customobjf0_.storageType as storageT9_13_0_ from know.customobjfieldtype customobjf0_ where customobjf0_.id=?
Hibernate: update know.customobjfieldmeta set visibility=?, versionId=?, objType=?, versionOf=?, shortDesc=?, longDesc=?, fieldType=? where id=?
Hibernate: select customobjf0_.id as id, customobjf0_.visibility as visibility7_, customobjf0_.versionId as versionId7_, customobjf0_.objType as objType7_, customobjf0_.versionOf as versionOf7_, customobjf0_.shortDesc as shortDesc7_, customobjf0_.longDesc as longDesc7_, customobjf0_.fieldType as fieldType7_ from know.customobjfieldmeta customobjf0_ where customobjf0_.objType=? and customobjf0_.fieldType=?
DEBUG[2005-05-04 19:50:53,750] com.knowlist.list.main.MainPageTest.service(MainPageTest.java:38)(MainPageTest.java38): 4
DEBUG[2005-05-04 19:51:03,046] com.knowlist.list.main.MainPageTest.service(MainPageTest.java:29)(MainPageTest.java29): 1
DEBUG[2005-05-04 19:51:03,046] com.knowlist.list.main.MainPageTest.service(MainPageTest.java:34)(MainPageTest.java34): 2
Hibernate: select customobjf0_.id as id, customobjf0_.visibility as visibility7_, customobjf0_.versionId as versionId7_, customobjf0_.objType as objType7_, customobjf0_.versionOf as versionOf7_, customobjf0_.shortDesc as shortDesc7_, customobjf0_.longDesc as longDesc7_, customobjf0_.fieldType as fieldType7_ from know.customobjfieldmeta customobjf0_ where customobjf0_.objType=? and customobjf0_.fieldType=?
DEBUG[2005-05-04 19:51:03,046] com.knowlist.list.main.MainPageTest.service(MainPageTest.java:36)(MainPageTest.java36): 3
Hibernate: update know.customobjfieldmeta set visibility=?, versionId=?, objType=?, versionOf=?, shortDesc=?, longDesc=?, fieldType=? where id=?
Hibernate: select customobjf0_.id as id, customobjf0_.visibility as visibility7_, customobjf0_.versionId as versionId7_, customobjf0_.objType as objType7_, customobjf0_.versionOf as versionOf7_, customobjf0_.shortDesc as shortDesc7_, customobjf0_.longDesc as longDesc7_, customobjf0_.fieldType as fieldType7_ from know.customobjfieldmeta customobjf0_ where customobjf0_.objType=? and customobjf0_.fieldType=?
DEBUG[2005-05-04 19:51:03,062] com.knowlist.list.main.MainPageTest.service(MainPageTest.java:38)(MainPageTest.java38): 4
DEBUG[2005-05-04 19:51:04,203] com.knowlist.list.main.MainPageTest.service(MainPageTest.java:29)(MainPageTest.java29): 1
DEBUG[2005-05-04 19:51:04,203] com.knowlist.list.main.MainPageTest.service(MainPageTest.java:34)(MainPageTest.java34): 2
Hibernate: select customobjf0_.id as id, customobjf0_.visibility as visibility7_, customobjf0_.versionId as versionId7_, customobjf0_.objType as objType7_, customobjf0_.versionOf as versionOf7_, customobjf0_.shortDesc as shortDesc7_, customobjf0_.longDesc as longDesc7_, customobjf0_.fieldType as fieldType7_ from know.customobjfieldmeta customobjf0_ where customobjf0_.objType=? and customobjf0_.fieldType=?
DEBUG[2005-05-04 19:51:04,218] com.knowlist.list.main.MainPageTest.service(MainPageTest.java:36)(MainPageTest.java36): 3
Hibernate: update know.customobjfieldmeta set visibility=?, versionId=?, objType=?, versionOf=?, shortDesc=?, longDesc=?, fieldType=? where id=?
Hibernate: select customobjf0_.id as id, customobjf0_.visibility as visibility7_, customobjf0_.versionId as versionId7_, customobjf0_.objType as objType7_, customobjf0_.versionOf as versionOf7_, customobjf0_.shortDesc as shortDesc7_, customobjf0_.longDesc as longDesc7_, customobjf0_.fieldType as fieldType7_ from know.customobjfieldmeta customobjf0_ where customobjf0_.objType=? and customobjf0_.fieldType=?
DEBUG[2005-05-04 19:51:04,234] com.knowlist.list.main.MainPageTest.service(MainPageTest.java:38)(MainPageTest.java38): 4