Please, isn't there anyone who can help with this?
It's seriously annoying to have to restart the jboss server every time you
redeploy your application.
I've looked for a soloution for over a week now, but the problem still persists.
some more info:
This is how i use the sessionfactory:
| package session;
|
|
| import org.hibernate.HibernateException;
| import org.hibernate.Session;
| import org.hibernate.SessionFactory;
| import org.hibernate.cfg.Configuration;
| /**
| * Configures and provides access to Hibernate sessions, tied to the
| * current thread of execution. Follows the Thread Local Session
| */
| public class HibernateSessionFactory {
|
| /** Holds a single instance of Session */
| private static final ThreadLocal threadLocal = new ThreadLocal();
|
| /** The single instance of hibernate configuration */
| private static final Configuration cfg = new Configuration();
|
| /** The single instance of hibernate SessionFactory */
| private static SessionFactory sessionFactory;
|
| /**
| * Returns the ThreadLocal Session instance. Lazy initialize
| * the <code>SessionFactory</code> if needed.
| *
| * @return Session
| * @throws HibernateException
| */
| @SuppressWarnings("unchecked")
| public static Session currentSession() throws HibernateException {
| Session session = (Session) threadLocal.get();
|
| if (session == null) {
| if(sessionFactory == null) {
| try {
| sessionFactory =
cfg.configure().buildSessionFactory();
| }
| catch (Exception e) {
| System.err.println("%%%% Error building
SessionFactory%%%%");
| e.printStackTrace();
| }
| }
| try {
| session = sessionFactory.openSession();
| threadLocal.set(session);
| }
| catch (Exception e) {
| System.err.println("%%%% Error opening
SessionFactory%%%%");
| e.printStackTrace();
| }
|
| }
|
| /*if(!session.isConnected()) {
| session.reconnect();
| }*/
| return session;
| }
|
| /**
| * Close the single hibernate session instance.
| *
| * @throws HibernateException
| */
| public static void closeSession() throws HibernateException {
| Session session = (Session) threadLocal.get();
| threadLocal.set(null);
| //System.out.println("Closing the session in sessionfactory");
| if (session != null) {
| session.close();
| }
| }
|
| /**
| * Default constructor.
| */
| private HibernateSessionFactory() {
| }
|
| }
|
and this is my hibernate config:
| <?xml version="1.0" encoding="UTF-8"?>
| <!DOCTYPE hibernate-configuration PUBLIC
| "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
|
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
| <hibernate-configuration>
| <session-factory>
| <property
name="hibernate.connection.driver_class">org.postgresql.Driver</property>
| <property name="hibernate.connection.password">123456</property>
| <property
name="hibernate.connection.url">jdbc:postgresql://localhost:5432/TRIM</property>
| <property name="hibernate.connection.username">admin</property>
| <property
name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
|
| <!-- mapping files -->
|
| <mapping resource="hibernate_xml/Users.hbm.xml" />
| <mapping resource="hibernate_xml/Module.hbm.xml" />
| <mapping resource="hibernate_xml/ModuleAccess.hbm.xml" />
| <mapping resource="hibernate_xml/UserGroup.hbm.xml" />
| <mapping resource="hibernate_xml/SystemDefault.hbm.xml" />
| <mapping resource="hibernate_xml/RelationType.hbm.xml" />
| <mapping resource="hibernate_xml/Relation.hbm.xml" />
| <mapping resource="hibernate_xml/Resource.hbm.xml" />
| <mapping resource="hibernate_xml/Contact.hbm.xml" />
| <mapping resource="hibernate_xml/ResourceType.hbm.xml" />
| <mapping resource="hibernate_xml/Unit.hbm.xml" />
| <mapping resource="hibernate_xml/ResourceCategory.hbm.xml" />
| <mapping resource="hibernate_xml/Activity.hbm.xml" />
| <mapping resource="hibernate_xml/ActivityLine.hbm.xml" />
| <mapping resource="hibernate_xml/ActivityType.hbm.xml" />
| <mapping resource="hibernate_xml/Status.hbm.xml" />
|
| </session-factory>
| </hibernate-configuration>
|
I'm using jboss 4.0.4GA and eclipse with jbossIDE to deploy/redeploy. I'm also
using the latest 1.6GA release of the JbossIDE plugin.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3949278#3949278
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3949278
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user