Page 2 of 2 FirstFirst 12
Results 11 to 19 of 19

Thread: it Hangs

  1. #11
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    I already told you 2 times...

    Quote Originally Posted by mdeinum
    2) Don't use 'thread' as the current session mechanism, this overrides the spring one and screws up proper transaction management
    3) Don't (re)configure your datasource inside the hibernate properties, you already have a datasource configured in your spring configuration.

    Code:
    <?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.dialect">org.hibernate.dialect.Ora cleDialect</property>
    	<property name="hibernate.connection.driver_class">oracle.jd bc.driver.OracleDriver</property>
    	<property name="hibernate.connection.url">___</property>
    	<property name="hibernate.connection.username">___</property>
    	<property name="hibernate.connection.password">___</property>
    	<property name="current_session_context_class">thread</property>
    	<property name="hibernate.connection.pool_size">1</property>
    	<property name="hibernate.c3p0.max_size">50</property>
    	<property name="hibernate.c3p0.min_size">2</property>
    	<property name="hibernate.c3p0.timeout">5000</property>
    	<property name="hibernate.c3p0.max_statements">100</property>
    	<property name="hibernate.c3p0.idle_test_period">3000</property>
    	<property name="hibernate.c3p0.acquire_increment">2</property>
    	<property name="hibernate.c3p0.validate">false</property>
    	<mapping class="xxx.PaditJiModel.City"/>
    	<mapping class="xxx.PaditJiModel.Country"/>
    	<mapping class="xxx.PaditJiModel.Person"/>
    	<mapping class="xxx.PaditJiModel.State"/>
    </session-factory>
    </hibernate-configuration>
    Remove everything red and blue.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  2. #12

    Default if i remove then following exception comes

    Caused by: org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
    at org.springframework.orm.hibernate3.SpringSessionCo ntext.currentSession(SpringSessionContext.java:63)
    at org.hibernate.impl.SessionFactoryImpl.getCurrentSe ssion(SessionFactoryImpl.java:544)
    at org.argus.webpanditji.panditJiDAO.hibernate.BaseAb stractDao.get(BaseAbstractDao.java:72)
    at org.argus.webpanditji.panditJiDAO.hibernate.CityIm pl.getAllCities(CityImpl.java:27)
    at org.argus.panditji.PanditjiServices.Services.getAl lCities(Services.java:78)
    at org.argus.webpanditji.beans.CityBean.getListCity(C ityBean.java:96)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at javax.el.BeanELResolver.getValue(BeanELResolver.ja va:261)
    at javax.el.CompositeELResolver.getValue(CompositeELR esolver.java:143)
    at com.sun.faces.el.FacesCompositeELResolver.getValue (FacesCompositeELResolver.java:72)
    at com.sun.el.parser.AstValue.getValue(AstValue.java: 138)
    at com.sun.el.ValueExpressionImpl.getValue(ValueExpre ssionImpl.java:206)
    at com.sun.facelets.el.TagValueExpression.getValue(Ta gValueExpression.java:71)
    ... 70 more

  3. #13
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    Which means your transaction configuration is wrong.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  4. #14

    Default

    this is DAOContext.xml file...


    Code:
    <?xml version="1.0" encoding="UTF-8"?>
     
    
    <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context"
           xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"
           xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
           http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
           http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
    
    
        <bean class="org.apache.commons.dbcp.BasicDataSource" id="dataSource" destroy-method="close" >
            <property name="driverClassName">
                <value>oracle.jdbc.driver.OracleDriver</value>
            </property>
           
            <property name="url">
                <value>---</value>
            </property>
            <property name="username">
                <value>---</value>
            </property>
           
            <property name="password">
                <value>---</value>
            </property>
            <property name="maxActive" value="100"/>
            <property name="maxWait" value="30000"/>
           
     
           
            
        </bean>
    
    
      
    
        <bean id="lobHandler" class="org.springframework.jdbc.support.lob.OracleLobHandler" />
    
        <bean
    class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean" id="sessionFactory">
            <property name="dataSource">
                <ref bean="dataSource"/>
            </property>
            <property name="lobHandler">
                <ref bean="lobHandler"/>
            </property>
            <property name="configLocation">
    
                <value>classpath:/hibernate.cfg.xml</value>
    
            </property>
    
            <property name="annotatedClasses">
                <list>
                    <value>
                          xx.PaditJiModel.Country
                    </value>
                    <value>
                          xx.PaditJiModel.State
                    </value>
                    <value>
                          xx.PaditJiModel.City
                    </value>
                    <value>
                          xx.PaditJiModel.Person
                    </value>
                </list>
    
            </property>
    
    
        </bean>
        <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager" p:sessionFactory-ref="sessionFactory" />
    
        <bean  class="org.springframework.orm.hibernate3.HibernateTemplate" id="hibernateTemplate">
            <property name="sessionFactory">
                <ref bean="sessionFactory"/>
            </property>
    
     
        </bean>
    
       <!-- <bean id="transactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor">
            <property name="transactionManager">
                <ref bean="transactionManager" />
            </property>
            <property name="transactionAttributeSource">
                <value>  xx.panditJiDAO.hibernate.*=PROPAGATION_REQUIRED</value>
            </property>
        </bean> -->
    
        <bean id="hibernateInterceptor" class="org.springframework.orm.hibernate3.HibernateInterceptor">
            <property name="sessionFactory" ref="sessionFactory" />
        </bean>
    
        <bean id="CountryImpl"  class="  xx.panditJiDAO.hibernate.CountryImpl">
            <property name="sessionFactory" ref="sessionFactory" />
        </bean>
    
        <bean id="CityImpl"  class="  xx.panditJiDAO.hibernate.CityImpl">
            <property name="sessionFactory" ref="sessionFactory" />
        </bean>
    
        <bean id="StateImpl"  class="  xx.panditJiDAO.hibernate.StateImpl">
            <property name="sessionFactory" ref="sessionFactory" />
        </bean>
    
        <bean id="PersonImpl"  class="  xx.panditJiDAO.hibernate.PersonImpl">
            <property name="sessionFactory" ref="sessionFactory" />
    
        </bean>
     
     
     
    </beans>
    Last edited by void_void; Apr 14th, 2009 at 03:44 AM.

  5. #15

    Default hibernate conf. file

    Code:
    <?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.dialect">org.hibernate.dialect.OracleDialect</property>
      
            <mapping class=xxx.PaditJiModel.City"/>
            <mapping class="xxx.PaditJiModel.Country"/>
            <mapping class="xxx.PaditJiModel.Person"/>
            <mapping class="xxx.PaditJiModel.State"/>
     
            
        </session-factory>
    </hibernate-configuration>

  6. #16

    Default !

    now what should i do . .. . ???

  7. #17
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    Well fix it.

    There is no transaction management in your configuration only a transaction manager.

    Again I suggest read chapter 9 of the reference guide and get a grip for what hibernate does and how it works.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  8. #18

    Default need help

    yes sir,
    But how can i configure Transaction mngr ?
    and how can i make it run perfectly . .?
    thats what i am asking..

  9. #19
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    That is what is explained in chapter 9 of the reference guide!!!
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •