-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: No TransactionManagerLookup specified (Tomcat 4.0, MySQL )
PostPosted: Sun Jul 23, 2006 2:50 pm 
Newbie

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);
}


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 24, 2006 1:06 am 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
I believe that if you specify hibernate.current_session_context_class then hibernate.transaction.manager_lookup_class becomes non-optional. Include the correct configuration for that and it should work.

_________________
Code tags are your friend. Know them and use them.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.