<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    編程生活

       :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
      113 隨筆 :: 0 文章 :: 18 評(píng)論 :: 0 Trackbacks

    Spring的版本號(hào)為2.0.6
    openJPA的版本為0.9.7(其實(shí)1.0.0也是一樣)
    照下面如此,客戶端不用裝應(yīng)用服務(wù)器開發(fā)了.
    但如果你的客戶端是Eclipse的RCP則和這個(gè)配置有一些不同


     

    1.項(xiàng)目的Classpath的列表

        <classpathentry kind="lib" path="main/lib/commons-beanutils.jar"/>
        
    <classpathentry kind="lib" path="main/lib/commons-beanutils-bean-collections.jar"/>
        
    <classpathentry kind="lib" path="main/lib/commons-beanutils-core.jar"/>
        
    <classpathentry kind="lib" path="main/lib/commons-collections-3.2.jar"/>
        
    <classpathentry kind="lib" path="main/lib/commons-lang.jar"/>
        
    <classpathentry kind="lib" path="main/lib/commons-logging.jar"/>
        
    <classpathentry kind="lib" path="main/lib/javaee.jar"/>
        
    <classpathentry kind="lib" path="main/lib/log4j-1.2.14.jar"/>
        
    <classpathentry kind="lib" path="main/lib/openjpa-0.9.7-incubating.jar"/>
        
    <classpathentry kind="lib" path="main/lib/serp-1.11.0.jar"/>
        
    <classpathentry kind="lib" path="test/lib/aspectjrt.jar"/>
        
    <classpathentry kind="lib" path="test/lib/aspectjweaver.jar"/>
        
    <classpathentry kind="lib" path="test/lib/cglib-nodep-2.1_3.jar"/>
        
    <classpathentry kind="lib" path="test/lib/dbunit-2.2.jar"/>
        
    <classpathentry kind="lib" path="test/lib/ojdbc14.jar"/>
        
    <classpathentry kind="lib" path="test/lib/postgresql-8.2-506.jdbc3.jar"/>
        
    <classpathentry kind="lib" path="test/lib/spring.jar"/>


    2.BEANS.XML的配置

     

    <?xml version="1.0" encoding="UTF-8"?>
    <beans default-lazy-init="true"
        xmlns
    ="http://www.springframework.org/schema/beans"
        xmlns:xsi
    ="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:aop
    ="http://www.springframework.org/schema/aop"
        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.0.xsd
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd"
    >
          
        
    <bean id="propertyConfigurer"
            class
    ="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
            lazy-init
    ="false">
            
    <property name="locations">
                
    <list>
                    
    <value>jpa.properties</value>
                
    </list>
            
    </property>
        
    </bean>

        
    <!-- Pitchfork configuration -->
    <!--    <bean-->
    <!--        class="org.springframework.jee.ejb.config.JeeEjbBeanFactoryPostProcessor" />-->

        
    <bean
            
    class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />

        
    <bean id="persistenceUnitManager"
            class
    ="org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager">
            <property name="loadTimeWeaver">
                
    <bean
                    
    class="org.springframework.instrument.classloading.SimpleLoadTimeWeaver" />
            
    </property>
        
    </bean>


        
    <bean id="entityManagerFactory"
            class
    ="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
            
    <property name="persistenceUnitManager"
                ref
    ="persistenceUnitManager" />
            
    <property name="persistenceUnitName" value="${persistence.unit.name}" />

            
    <property name="jpaVendorAdapter">
                
    <bean
                    
    class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter" />
            
    </property>
        
    </bean>

        
    <bean id="transactionManager"
            class
    ="org.springframework.orm.jpa.JpaTransactionManager">
            
    <property name="entityManagerFactory"
                ref
    ="entityManagerFactory" />
        
    </bean>

        
    <tx:advice id="methodTransactionAdvice"
            transaction-manager
    ="transactionManager">
            
    <tx:attributes>
                
    <tx:method name="*" />
            
    </tx:attributes>
        
    </tx:advice>
        
    <aop:config proxy-target-class="true">
            
    <aop:pointcut id="serviceMethods"
                expression
    ="execution(public * com.wilesun.test..*Service.*(..))" />
            
    <aop:advisor pointcut-ref="serviceMethods"
                advice-ref
    ="methodTransactionAdvice" />
        
    </aop:config>

        
    <!-- ================================================ -->
        
    <bean id="com.wilesun.test.IHelloService"
            class
    ="com.wilesun.test.HelloService" />    
     
                                 
    </beans>


    3.persistence_1_0.xsd和orm_1_0.xsd

    將這兩個(gè)文件放到項(xiàng)目的classpath的根位置

    4.做測(cè)試程序

    public class HelloService implements IHelloServiceLocal, IHelloServiceRemote {
       @PersistenceContext
       private EntityManager em;
       
       @Resource
       private SessionContext ctx;
    }
    將代碼實(shí)現(xiàn)完,就可以測(cè)試了
    posted on 2007-11-08 09:19 wilesun 閱讀(1486) 評(píng)論(0)  編輯  收藏 所屬分類: 個(gè)人經(jīng)驗(yàn)
    主站蜘蛛池模板: 免费国产精品视频| 亚洲一区二区三区影院| 一级毛片在线完整免费观看| 亚洲理论电影在线观看| 免费观看激色视频网站bd| 国产精品亚洲五月天高清| 久久国产亚洲精品麻豆| 毛片视频免费观看| 国产免费高清69式视频在线观看| 亚洲特级aaaaaa毛片| 国产自产拍精品视频免费看| 免费观看久久精彩视频| 亚洲精品日韩一区二区小说| 久久亚洲精品成人| 免费国产人做人视频在线观看| 99视频在线精品免费| 深夜A级毛片视频免费| 亚洲精品综合久久中文字幕| 婷婷综合缴情亚洲狠狠尤物| 6080午夜一级毛片免费看| 性生大片视频免费观看一级| 亚洲免费视频网址| 国产亚洲免费的视频看| 国产免费av一区二区三区| 1000部禁片黄的免费看| 在线视频网址免费播放| 亚洲欧洲无码AV不卡在线| 亚洲国产美国国产综合一区二区 | 日本免费在线中文字幕| 亚洲高清乱码午夜电影网| 亚洲一区二区三区高清| 亚洲线精品一区二区三区影音先锋| 女性自慰aⅴ片高清免费| 99久久国产免费中文无字幕| 国产99久久久国产精免费| 亚洲第一成年免费网站| 亚洲一区二区三区在线| 内射干少妇亚洲69XXX| 久久精品国产精品亚洲精品 | 亚洲视频在线播放| 国内精品99亚洲免费高清|