|
Hibernate version: 3.0.1 RC1
Mapping documents:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
<class name="com.xpedx.ecommerce.order.model.OrderDTO" table="orderstatustable" schema="public" lazy="false">
<id name="id" type="integer">
<column name="id" sql-type="serial" />
<generator class="native" />
</id>
<property name="orderId" type="string">
<column name="onlineorderno" length="29" />
</property>
<property name="orderTime" type="timestamp">
<column name="ordertime" length="29" />
</property>
<property name="customerId" type="string">
<column name="customerno" length="12" />
</property>
<property name="orderStatus" type="integer">
<column name="orderstatus" length="1" />
</property>
<property name="statusTime" type="timestamp">
<column name="statustime" length="29" />
</property>
<property name="batchId" type="string">
<column name="batchid" length="10" />
</property>
<property name="fullfillmentLocation" type="string">
<column name="fullfillment_location" length="3" />
</property>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
protected Session currentSession() throws DAOException {
Session s = (Session) sessionContext.get();
try {
s = getSessionFactory().openSession();
sessionContext.set(s);
} catch (Throwable e) {
logException("Exception in currentSession()", e);
throw new DAOException(e);
}
return s;
}
private static SessionFactory getSessionFactory() {
if (sf == null) {
try {
Context ctx = new InitialContext();
sf = (SessionFactory) ctx.lookup(HIBERNATE_FACTORY_JNDI);
} catch (NamingException e) {
log.fatal("Could not look up SessionFactory in JNDI: " + HIBERNATE_FACTORY_JNDI, e);
throw new RuntimeException(e);
}
}
return sf;
}
public List findByProperty1(String propertyName , String query) throws DAOException {
List myResult = null;
Session sess;
try {
sess = currentSession();
//String queryString = BaseDAO.retrieveBatch;
System.out.println("1" + propertyName);
//String queryString = getQuery(query);
Query myQuery = sess.createQuery(query);
System.out.println("2");
myQuery.setString("PARAM", propertyName.trim());
System.out.println("3");
myResult = myQuery.list();
System.out.println("4");
return myResult;
} catch (DAOException e) {
e.printStackTrace();
log.info("Problem in getting a session");
throw new DAOException(e);
}
}
Full stack trace of any exception that occurs:
2007-08-25 16:48:46,319 WARN [org.hibernate.impl.SessionFactoryObjectFactory] Not found: 2c98b291149efb2a01149efb2b990000
2007-08-25 16:48:46,319 WARN [org.hibernate.impl.SessionFactoryObjectFactory] Not found: 2c98b291149efb2a01149efb2b990000
2007-08-25 16:48:46,319 ERROR [com.xpedx.ecommerce.BaseDAO] Exception in currentSession()
java.lang.NullPointerException
at com.xpedx.ecommerce.BaseDAO.currentSession(BaseDAO.java:64)
Name and version of the database you are using:
Postgres 8.2.3
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
2007-08-25 17:00:00,300 DEBUG [DefaultQuartzScheduler_Worker-7] org.hibernate.jdbc.ConnectionManager - connection already null in cleanup : no action
2007-08-25 17:06:41,071 DEBUG [http-xpediate.ipaper.com%2F172.24.50.17-8080-2] org.hibernate.jdbc.JDBCContext - no active transaction, could not register Synchronization
2007-08-25 17:06:41,071 DEBUG [http-xpediate.ipaper.com%2F172.24.50.17-8080-2] org.hibernate.impl.SessionImpl - opened session at timestamp: 4866374045986816
2007-08-25 17:06:41,072 DEBUG [http-xpediate.ipaper.com%2F172.24.50.17-8080-2] org.hibernate.impl.SessionImpl - find: select batchId from com.xpedx.ecommerce.order.model.OrderDTO order where order.orderStatus = 1 and order.orderId = :PARAM
2007-08-25 17:06:41,072 DEBUG [http-xpediate.ipaper.com%2F172.24.50.17-8080-2] org.hibernate.engine.QueryParameters - named parameters: {PARAM=CART009}
2007-08-25 17:06:41,075 DEBUG [http-xpediate.ipaper.com%2F172.24.50.17-8080-2] org.hibernate.hql.ast.QueryTranslatorImpl - parse() - HQL: select batchId from com.xpedx.ecommerce.order.model.OrderDTO order where order.orderStatus = 1 and order.orderId = :PARAM
Problems with Session and transaction handling?
When deployed as HAR file ,log displayed the sessionfactory is bound.
My app runs on jboss 4.0.3 and used postgres 8.2.3.
Any help would be greatly appreciated.
Thanks
Sundar
|