-->
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.  [ 4 posts ] 
Author Message
 Post subject: Wie configuriert man Websphere 5.0 mit Hibernate/Datasource
PostPosted: Fri Jun 24, 2005 8:48 am 
Beginner
Beginner

Joined: Fri Jul 16, 2004 3:21 am
Posts: 40
Hibernate version:
3.0.3
Mapping documents:
<?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.jndi.class">com.ibm.websphere.naming.WsnInitialContextFactory</property>
<property name="hibernate.jndi.url">iiop://localhost:2809/</property>
<property name="hibernate.connection.datasource">jdbc/dbname</property>
<property name="hibernate.cglib.use_reflection_optimizer">true</property>
<property name="hibernate.dialect">org.hibernate.dialect.DB2Dialect</property>
<property name="hibernate.show_sql">false</property>
<mapping resource="Images.hbm.xml"/>
</session-factory>
</hibernate-configuration>

Code between sessionFactory.openSession() and session.close():
ublic class HibernateUtil {

private static final SessionFactory sessionFactory;

static {
try {
// Create the SessionFactory
sessionFactory = new Configuration().configure().buildSessionFactory();
} catch (Throwable ex) {
// Make sure you log the exception, as it might be swallowed
logger.error("Initial Hibernate SessionFactory creation failed.", ex);
throw new ExceptionInInitializerError(ex);
}
}

public static final ThreadLocal session = new ThreadLocal();

public static Session currentSession() {
Session s = (Session) session.get();
// Open a new Session, if this Thread has none yet
if (s == null) {
logger.info("reopen session");
s = sessionFactory.openSession();
session.set(s);
}
return s;
}

public static void closeSession() {
Session s = (Session) session.get();
if (s != null)
s.close();
session.set(null);
}
}

Full stack trace of any exception that occurs:

Name and version of the database you are using:
DB2 8
The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

Was muss man im Websphere configurieren damit man Hibernate über den Datasource laufen lassen kann.

Den Datasource (v5) habe ich eingerichtet und via dem TestConnection verifiziert.

gruss pfenn


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 19, 2005 10:06 am 
Beginner
Beginner

Joined: Fri Jul 16, 2004 3:21 am
Posts: 40
Das Hibernate Config File war wohl falsch:
Einfach einen DS 5 machen und via connection.datasource den Namen angeben:

Code:
<hibernate-configuration>
    <session-factory>
   <property name="hibernate.connection.datasource">jdbc/dbname</property>
        <property name="hibernate.cglib.use_reflection_optimizer">true</property>
        <property name="hibernate.dialect">org.hibernate.dialect.DB2Dialect</property>
        <property name="hibernate.show_sql">false</property>
      <mapping resource=".....hbm.xml"/>
                                .......
         
    </session-factory>
</hibernate-configuration>


Das wars, dann läuft es auch unter WAS 5.0.x

gruss pfenn


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 19, 2005 10:35 am 
Beginner
Beginner

Joined: Tue Jul 19, 2005 5:08 am
Posts: 26
Location: Germany
....ich hoffe, du hast nicht die ganzen 4 monate damit verbracht, dieses problem zu lösen. *fg


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 19, 2005 10:41 am 
Beginner
Beginner

Joined: Fri Jul 16, 2004 3:21 am
Posts: 40
smile nein, aber ich hatte meine alten postings angeschaut und dachte mir vielleicht interessiert es auch noch jemanden ausser mir :-)

gruss pfenn


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.