Results 1 to 10 of 10

Thread: Spring + Hibernate Injection

  1. #1

    Default Spring + Hibernate Injection

    I need to inject Generics hibernate DAO into Spring Beans...
    how to do it??

  2. #2

    Default ...

    architecture is like i have to create one jar project of generics DAO..
    and need to add this jar project into Spring project as dependency using maven...
    so i need to know how to inject hibernate into spring????

  3. #3

    Default bean creation exception

    [PHP]<?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="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 id="medConfigProperties" class="org.springframework.beans.factory.config.Pr opertyPlaceholderConfigurer">
    <property name="location">
    <value>classpath:med.database.properties</value>
    </property>
    <property name="ignoreUnresolvablePlaceholders" value="true" />
    </bean>

    <bean id="hibernateConfigProperties" class="org.springframework.beans.factory.config.Pr opertiesFactoryBean">
    <property name="location">
    <value>classpath:hibernate.properties</value>
    </property>
    </bean>


    <bean id="dataSource" class="oracle.jdbc.pool.OracleDataSource" destroy-method="close"
    p:driverType="${med.connection.driverClassName}" p:URL="${med.connection.url}"
    p:user="${med.connection.username}" password="${med.connection.password}"/>


    <bean id="lobHandler" class="org.springframework.jdbc.support.lob.Oracle LobHandler" />

    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotati on.AnnotationSessionFactoryBean"
    p:dataSource-ref="dataSource" p:lobHandler-ref="lobHandler">
    <property name="annotatedClasses">
    <list>
    <value> org.argus.webpanditji.GenericDAO.Employee</value>
    </list>

    </property>
    <property name="schemaUpdate">
    <value>false</value>
    </property>
    <property name="hibernateProperties" ref="hibernateConfigProperties" />
    </bean>



    <!--
    Instruct Spring to perform automatic transaction management on annotated classes.
    The SimpleJdbcClinic implementation declares @Transactional annotations.
    "proxy-target-class" is set because of SimpleJdbcClinic's @ManagedOperation usage.
    -->
    <tx:annotation-driven transaction-manager="transactionManager" />

    <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.Hibernat eTemplate">
    <constructor-arg>
    <ref bean="sessionFactory"/>
    </constructor-arg>
    </bean>

    <!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) -->
    <bean id="transactionManager" class="org.springframework.orm.hibernate3.Hibernat eTransactionManager" p:sessionFactory-ref="sessionFactory">

    </bean>













    <bean id="EI" class="org.argus.webpanditji.GenericDAO.EmployeeIm pl">
    <property name="sessionFactory" ref="sessionFactory" />
    </bean>


    <bean id="hw" class="org.argus.webpanditji.GenericDAO.HelloWorld "></bean>







    <!--
    Instruct Spring to perform automatic transaction management on annotated classes.
    The SimpleJdbcClinic implementation declares @Transactional annotations.
    "proxy-target-class" is set because of SimpleJdbcClinic's @ManagedOperation usage.
    -->

    </beans>


    this is my DAOContext.xml file

  4. #4

    Default Exception

    i am getting following exception
    WARNING: JSF1058: The resource referred to by to-view-id, 'success.jsp', for navigation from '/index.jsp', does not start with '/'. This will be added for you, but it should be corrected.
    WARNING: JSF1058: The resource referred to by to-view-id, 'fail.jsp', for navigation from '/index.jsp', does not start with '/'. This will be added for you, but it should be corrected.
    INFO: PWC1412: WebModule[/JSFSpring] ServletContext.log():Initializing Spring root WebApplicationContext
    SEVERE: log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
    SEVERE: log4j:WARN Please initialize the log4j system properly.
    SEVERE: WebModule[/JSFSpring]PWC1275: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListe ner
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.transaction.interceptor.Trans actionAttributeSourceAdvisor': Cannot create inner bean '(inner bean)' of type [org.springframework.transaction.interceptor.Transa ctionInterceptor] while setting bean property 'transactionInterceptor'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name '(inner bean)': Cannot resolve reference to bean 'transactionManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'transactionManager' defined in class path resource [DAOContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'sessionFactory' defined in class path resource [DAOContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javassist/util/proxy/MethodFilter
    Caused by: org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name '(inner bean)': Cannot resolve reference to bean 'transactionManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'transactionManager' defined in class path resource [DAOContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'sessionFactory' defined in class path resource [DAOContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javassist/util/proxy/MethodFilter
    Caused by: org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'transactionManager' defined in class path resource [DAOContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'sessionFactory' defined in class path resource [DAOContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javassist/util/proxy/MethodFilter
    Caused by: org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'sessionFactory' defined in class path resource [DAOContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javassist/util/proxy/MethodFilter
    Caused by: java.lang.NoClassDefFoundError: javassist/util/proxy/MethodFilte

  5. #5

    Default

    Code:
    Caused by: java.lang.NoClassDefFoundError: javassist/util/proxy/MethodFilte
    This is the clue, no javassist lib in path (or wrong version)

  6. #6

    Default new EXCEPTION

    includind jar solved the problem bt now if i try the same configuration but with diff. table it shows table or view doesn't exist. .

  7. #7

    Default new EXCEPTION

    the particular table exists and this time my entity(mapped class)is in another project which is mapped properly even using annotation.

  8. #8

    Default new EXCEPTION

    the particular table exists and this time my entity(mapped class)is in another project which is mapped properly even using annotation.

  9. #9

    Default That exception has solved but now new exceprion

    Exception
    [PHP]SEVERE: org.springframework.orm.hibernate3.HibernateSystem Exception: Unknown entity: org.argus.webpanditji.PaditJiModel.Country; nested exception is org.hibernate.MappingException: Unknown entity: org.argus.webpanditji.PaditJiModel.Country
    javax.faces.el.EvaluationException: org.springframework.orm.hibernate3.HibernateSystem Exception: Unknown entity: org.argus.webpanditji.PaditJiModel.Country; nested exception is org.hibernate.MappingException: Unknown entity: org.argus.webpanditji.PaditJiModel.Country
    at javax.faces.component.MethodBindingMethodExpressio nAdapter.invoke(MethodBindingMethodExpressionAdapt er.java:102)
    at com.sun.faces.application.ActionListenerImpl.proce ssAction(ActionListenerImpl.java:102)
    at javax.faces.component.UICommand.broadcast(UIComman d.java:387)
    at javax.faces.component.UIViewRoot.broadcastEvents(U IViewRoot.java:475)
    at javax.faces.component.UIViewRoot.processApplicatio n(UIViewRoot.java:756)
    at com.sun.faces.lifecycle.InvokeApplicationPhase.exe cute(InvokeApplicationPhase.java:82)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:1 00)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(Life cycleImpl.java:118)
    at javax.faces.webapp.FacesServlet.service(FacesServl et.java:265)
    at org.apache.catalina.core.ApplicationFilterChain.se rvletService(ApplicationFilterChain.java:431)
    at org.apache.catalina.core.StandardWrapperValve.preI nvoke(StandardWrapperValve.java:462)
    at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:139)
    at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:186)
    at org.apache.catalina.core.StandardPipeline.doInvoke (StandardPipeline.java:719)
    at org.apache.catalina.core.StandardPipeline.doInvoke (StandardPipeline.java:657)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipel ine.java:96)
    at com.sun.enterprise.web.PESessionLockingStandardPip eline.invoke(PESessionLockingStandardPipeline.java :98)
    at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:187)
    at org.apache.catalina.core.StandardPipeline.doInvoke (StandardPipeline.java:719)
    at org.apache.catalina.core.StandardPipeline.doInvoke (StandardPipeline.java:657)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:651)
    at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:1030)
    at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:142)
    at org.apache.catalina.core.StandardPipeline.doInvoke (StandardPipeline.java:719)
    at org.apache.catalina.core.StandardPipeline.doInvoke (StandardPipeline.java:657)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:651)
    at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:1030)
    at org.apache.catalina.connector.CoyoteAdapter.doServ ice(CoyoteAdapter.java:325)
    at org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:242)
    at com.sun.enterprise.v3.services.impl.ContainerMappe r.service(ContainerMapper.java:180)
    at com.sun.grizzly.http.DefaultProcessorTask.invokeAd apter(DefaultProcessorTask.java:633)
    at com.sun.grizzly.http.DefaultProcessorTask.doProces s(DefaultProcessorTask.java:570)
    at com.sun.grizzly.http.DefaultProcessorTask.process( DefaultProcessorTask.java:827)
    at com.sun.grizzly.http.DefaultProtocolFilter.execute (DefaultProtocolFilter.java:152)
    at com.sun.enterprise.v3.services.impl.GlassfishProto colChain.executeProtocolFilter(GlassfishProtocolCh ain.java:71)
    at com.sun.grizzly.DefaultProtocolChain.execute(Defau ltProtocolChain.java:103)
    at com.sun.grizzly.DefaultProtocolChain.execute(Defau ltProtocolChain.java:89)
    at com.sun.grizzly.http.HttpProtocolChain.execute(Htt pProtocolChain.java:76)
    at com.sun.grizzly.ProtocolChainContextTask.doCall(Pr otocolChainContextTask.java:67)
    at com.sun.grizzly.SelectionKeyContextTask.call(Selec tionKeyContextTask.java:56)
    at com.sun.grizzly.util.WorkerThreadImpl.processTask( WorkerThreadImpl.java:325)
    at com.sun.grizzly.util.WorkerThreadImpl.run(WorkerTh readImpl.java:184)
    Caused by: org.springframework.orm.hibernate3.HibernateSystem Exception: Unknown entity: org.argus.webpanditji.PaditJiModel.Country; nested exception is org.hibernate.MappingException: Unknown entity: org.argus.webpanditji.PaditJiModel.Country
    at org.springframework.orm.hibernate3.SessionFactoryU tils.convertHibernateAccessException(SessionFactor yUtils.java:659)
    at org.springframework.orm.hibernate3.HibernateAccess or.convertHibernateAccessException(HibernateAccess or.java:412)
    at org.springframework.orm.hibernate3.HibernateTempla te.execute(HibernateTemplate.java:377)
    at org.springframework.orm.hibernate3.HibernateTempla te.save(HibernateTemplate.java:632)
    at org.argus.webpanditji.panditJiDAO.hibernate.BaseAb stractDao.addCountry(BaseAbstractDao.java:38)
    at org.argus.webpanditji.panditJiDAO.hibernate.Countr yImpl.addCountry(CountryImpl.java:22)
    at com.mycompany.SpringExample.Validate.isValid(Valid ate.java:43)
    at Service.validate(Service.java:35)
    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 com.sun.el.parser.AstValue.invoke(AstValue.java:18 7)
    at com.sun.el.MethodExpressionImpl.invoke(MethodExpre ssionImpl.java:297)
    at javax.faces.component.MethodBindingMethodExpressio nAdapter.invoke(MethodBindingMethodExpressionAdapt er.java:88)
    ... 41 more
    Caused by: org.hibernate.MappingException: Unknown entity: org.argus.webpanditji.PaditJiModel.Country
    at org.hibernate.impl.SessionFactoryImpl.getEntityPer sister(SessionFactoryImpl.java:580)
    at org.hibernate.impl.SessionImpl.getEntityPersister( SessionImpl.java:1365)
    at org.hibernate.event.def.AbstractSaveEventListener. saveWithGeneratedId(AbstractSaveEventListener.java :121)
    at org.hibernate.event.def.DefaultSaveOrUpdateEventLi stener.saveWithGeneratedOrRequestedId(DefaultSaveO rUpdateEventListener.java:210)
    at org.hibernate.event.def.DefaultSaveEventListener.s aveWithGeneratedOrRequestedId(DefaultSaveEventList ener.java:56)
    at org.hibernate.event.def.DefaultSaveOrUpdateEventLi stener.entityIsTransient(DefaultSaveOrUpdateEventL istener.java:195)
    at org.hibernate.event.def.DefaultSaveEventListener.p erformSaveOrUpdate(DefaultSaveEventListener.java:5 0)
    at org.hibernate.event.def.DefaultSaveOrUpdateEventLi stener.onSaveOrUpdate(DefaultSaveOrUpdateEventList ener.java:93)
    at org.hibernate.impl.SessionImpl.fireSave(SessionImp l.java:562)
    at org.hibernate.impl.SessionImpl.save(SessionImpl.ja va:550)
    at org.hibernate.impl.SessionImpl.save(SessionImpl.ja va:546)
    at org.springframework.orm.hibernate3.HibernateTempla te$12.doInHibernate(HibernateTemplate.java:635)
    at org.springframework.orm.hibernate3.HibernateTempla te.execute(HibernateTemplate.java:372)
    ... 53 more
    WARNING: #{Service.validate}: org.springframework.orm.hibernate3.HibernateSystem Exception: Unknown entity: org.argus.webpanditji.PaditJiModel.Country; nested exception is org.hibernate.MappingException: Unknown entity: org.argus.webpanditji.PaditJiModel.Country
    javax.faces.FacesException: #{Service.validate}: org.springframework.orm.hibernate3.HibernateSystem Exception: Unknown entity: org.argus.webpanditji.PaditJiModel.Country; nested exception is org.hibernate.MappingException: Unknown entity: org.argus.webpanditji.PaditJiModel.Country
    at

  10. #10

    Smile need help in mapping

    that exception has sloved. . .
    now i want to know that..

    to which class i should map the TIMESTAMP type of ORACLE i also want to store
    TIMEZONE in TIMESTAMP typed FIELD ...????


    Thanks 4 help..

Posting Permissions

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