[jboss-user] [JNDI and Naming] - Binding a SessionFactory

Lulseged Zerfu do-not-reply at jboss.com
Tue Apr 13 03:13:33 EDT 2010


Lulseged Zerfu [http://community.jboss.org/people/lulseged] replied to the discussion

"Binding a SessionFactory"

To view the discussion, visit: http://community.jboss.org/message/537067#537067

--------------------------------------------------------------
Hi

 I have added session factory name. It needs hibernate.jndi.class in hibernate.properties.

<?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 http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
    <session-factory *name="java:comp/env/jdbc/resource-list"*>

        <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="hibernate.connection.password">ddbuser</property>
        <property name="hibernate.connection.url">jdbc:mysql://127.0.0.1:3306/ddb</property>
        <property name="hibernate.connection.username">ddbuser</property>
        <property name="hibernate.default_schema">ddb</property>
        <property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>

        <property name="hibernate.format_sql">true</property>
        <property name="hibernate.show_sql">true</property>
        <property name="current_session_context_class">thread</property>
        <property name="hibernate.max_fetch_depth">3</property>
        <property name="hibernate.generate_statistics">true</property>
        <property name="hibernate.connection.pool_size">10</property>


        <mapping resource="hbm/ResourceListUser.hbm.xml" />
        <mapping resource="hbm/ResourceList.hbm.xml" />
        <mapping resource="hbm/ResourceListType.hbm.xml" />
        <mapping resource="hbm/ResourceListEntry.hbm.xml" />
        <mapping resource="hbm/ResourceListEntryReference.hbm.xml" />
        <mapping resource="hbm/ResourceListExternal.hbm.xml" />
        <mapping resource="hbm/Subscription.hbm.xml" />

    </session-factory>
</hibernate-configuration>

#hibernate.properties

hibernate.generate_statistics=true
hibernate.cache.use_query_cache=true
hibernate.cache.use_structured_entries=true
hibernate.cache.provider_class=net.sf.ehcache.hibernate.SingletonEhCacheProvider
hibernate.use_sql_comments=true
hibernate.cache.use_second_level_cache=true

hibernate.c3p0.min_size=5
hibernate.c3p0.max_size=20
hibernate.c3p0.timeout=1800
hibernate.c3p0.max_statements=50

hibernate.jndi.class=com.ericsson.ims.pag.xdms.resource.list.session.SessionFactoryContext


package com.ericsson.ims.pag.xdms.resource.list.session;

import java.util.Hashtable;

import javax.naming.Context;
import javax.naming.NamingException;
import javax.naming.spi.InitialContextFactory;

public class SessionFactoryContext implements InitialContextFactory
{

    public Context getInitialContext(Hashtable<?, ?> environment) throws NamingException
    {
        return new InitialContext(environment);
    }
}


Lulseged

--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/537067#537067]

Start a new discussion in JNDI and Naming at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2083]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100413/4760d879/attachment.html 


More information about the jboss-user mailing list