Results 1 to 4 of 4

Thread: Example Spring

  1. #1
    Join Date
    Oct 2004
    Posts
    10

    Default Example Spring

    Hi,
    I have to write example EJB use Spring + Hibernate that can run on Application server as: Orion, WebSphere... and can run servlet container such as Tomcat. It's mean that example can run EJB or non EJB.
    Has anyone have example like that. Can you post it here.
    Thank for reading!

  2. #2
    Join Date
    Oct 2004
    Posts
    10

    Default Example Spring

    Has anyone have that example.
    Please help me soon!
    Thank for reading!

  3. #3
    Join Date
    Dec 2004
    Posts
    9

    Default

    <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryB ean">
    <property name="jndiName">
    <value>EmsDataSource</value>
    </property>
    </bean>
    <!-- Hibernate SessionFactory -->
    <bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSess ionFactoryBean">
    <property name="dataSource"><ref bean="dataSource"/></property>
    <property name="mappingResources">
    <list>
    <value>com/xxx/*.hbm.xml</value>
    </list>
    </property>
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">net.sf.hibernate.dialect.I nformixDialect</prop>
    <prop key="hibernate.show_sql">false</prop>
    <prop key="hibernate.cglib.use_reflection_optimizer">tru e</prop>
    <prop key="hibernate.cache.provider_class">net.sf.hibern ate.cache.HashtableCacheProvider</prop>
    <!--prop key="hibernate.hbm2ddl.auto">update</prop-->
    </props>
    </property>
    </bean>
    <!-- Spring Data Access Exception Translator Defintion -->
    <bean id="jdbcExceptionTranslator" class="org.springframework.jdbc.support.SQLErrorCo deSQLExceptionTranslator">
    <property name="dataSource"><ref bean="dataSource"/></property>
    </bean>

    <!-- Hibernate Template Defintion -->
    <bean id="hibernateTemplate" class="org.springframework.orm.hibernate.Hibernate Template">
    <property name="sessionFactory"><ref bean="sessionFactory"/></property>
    <property name="jdbcExceptionTranslator"><ref bean="jdbcExceptionTranslator"/></property>
    </bean>

    <!-- Hibernate Transaction Manager Definition -->
    <bean id="transactionManager" class="org.springframework.orm.hibernate.Hibernate TransactionManager">
    <property name="sessionFactory"><ref local="sessionFactory"/></property>
    </bean>
    <bean id="txProxyTemplate" abstract="true"
    class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean">
    <property name="transactionManager">
    <ref local="transactionManager"/>
    </property>
    <property name="transactionAttributes">
    <props>
    <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
    <prop key="create*">PROPAGATION_REQUIRED</prop>
    <prop key="update*">PROPAGATION_REQUIRED</prop>
    <prop key="remove*">PROPAGATION_REQUIRED</prop>
    </props>
    </property>
    </bean>

    <bean id="emsResourceService" parent="txProxyTemplate">
    <property name="target">
    <ref local="emsResourceServiceTarget"/>
    </property>
    </bean>
    <bean
    id="emsResourceServiceTarget"
    class="com.xxx.service.impl.EmsEquipmentServiceImp l">

    <property name="equipmentDao">
    <ref bean="equipmentDao"/>
    </property>
    </bean>

    <bean
    id="equipmentDao"
    class="com.xxx.dao.spring.hibernate.EquipmentDaoHi bernateImpl">
    <property name="hibernateTemplate">
    <ref bean="hibernateTemplate"/>
    </property>
    </bean>

    that configuration file is tested in Weblogic8.1

  4. #4
    Join Date
    Jan 2005
    Posts
    9

    Default Do I need applicationContext in my ejb ear file?

    I'm still puzzled by Spring configuration for a ear file. Do I need an applicationContext.xml file? Seems like the only xml file I need is beanRefContext.xml. Correct. By the way, where do I put the xml files in the ear file? under APP-INF/class? or META-INF/? If I need to set up logging inside the ear file, where do I put the log4j.properties or log4j.xml and can spring pick it up automatically?

    Thanks.

Similar Threads

  1. Spring MVC Web Framework versus Struts
    By biguniverse in forum Web Flow
    Replies: 27
    Last Post: Aug 29th, 2012, 03:57 AM
  2. Replies: 5
    Last Post: Aug 9th, 2008, 05:30 AM
  3. A Spring Class Loader?
    By azzoti in forum Architecture
    Replies: 8
    Last Post: May 7th, 2005, 04:02 AM
  4. Replies: 14
    Last Post: Feb 21st, 2005, 05:41 PM
  5. Replies: 2
    Last Post: Jan 21st, 2005, 04:17 AM

Posting Permissions

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