Joined: Sun Jul 23, 2006 2:03 pm Posts: 2 Location: Columbus,GA
|
I am getting following error when I try to update User object through UserDAO class. Application is setting also given below
Please let me know if any know the reason for this issue.
---------------
ERROR LOG
---------------
org.hibernate.HibernateException: No TransactionManagerLookup specified
at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:503)
at com.netopia.training.app.dao.UserDAO.updateUser(UserDAO.java:43)
at com.netopia.training.web.action.EditUserAction.updateUser(EditUserAction.java:77)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
-----------------------------
APPLICATION SETTING & JAVA CLASSES
-----------------------------
1)
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="c3p0.min_size">10</property>
<property name="c3p0.max_size">100</property>
<property name="c3p0.timeout">10</property>
<property name="c3p0.acquireRetryAttempts">30</property>
<property name="c3p0.acquireIncrement">5</property>
<property name="c3p0.idleConnectionTestPeriod">300</property>
<property name="c3p0.initialPoolSize">5</property>
<property name="c3p0.maxPoolSize">10</property>
<property name="c3p0.maxIdleTime">300</property>
<property name="c3p0.maxStatements">50</property>
<property name="c3p0.minPoolSize">5</property>
<property name="current_session_context_class">thread</property>
<property name="hibernate.current_session_context_class">thread</property>
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<property name="show_sql">true</property>
<class name="User" table="users">
<id name="id" column="user_id">
<generator class="native"></generator>
</id>
<property name="email" column="email" type="string" not-null="true"></property>
<property name="password" column="password" type="string" not-null="true"></property>
<property name="firstName" column="first_name" type="string" not-null="true"></property>
<property name="lastName" column="last_name" type="string" not-null="true"></property>
<property name="languagePref" column="language" type="string" not-null="true"></property>
<property name="admin" column="is_admin" type="boolean"></property>
<many-to-one name="profile" column="profile_id" class="Profile" not-null="true"></many-to-one>
<property name="passwordSent" column="password_sent" type="date"></property>
<set name="unitUses" inverse="true" cascade="save-update"
lazy="false">
<key column="user_id"/>
<one-to-many class="UnitUse"/>
</set>
</class>
HibernateUtil .java
public class HibernateUtil {
private static String CONFIG_FILE_LOCATION = "/com/netopia/training/app/xml/hibernate.cfg.xml";
/** The single instance of hibernate configuration */
private static final Configuration cfg = new Configuration();
/** The single instance of hibernate SessionFactory */
private static SessionFactory sessionFactory;
static {
try {
cfg.configure(CONFIG_FILE_LOCATION);
// Create the SessionFactory from hibernate.cfg.xml
sessionFactory = cfg.buildSessionFactory();
} catch (Throwable ex) {
// Make sure you log the exception, as it might be swallowed
System.err.println("Initial SessionFactory creation failed." + ex);
throw new ExceptionInInitializerError(ex);
}
}
public static SessionFactory getSessionFactory() {
return sessionFactory;
}
}
UserDAO.java
----------------
public void updateUser(User user) {
Transaction transaction = null;
SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
Session session = sessionFactory.getCurrentSession();
session.update(user);
}
|
|