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

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

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

    編程生活

       :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
      113 隨筆 :: 0 文章 :: 18 評論 :: 0 Trackbacks

    Spring的版本號為2.0.6
    openJPA的版本為0.9.7(其實1.0.0也是一樣)
    照下面如此,客戶端不用裝應用服務器開發了.
    但如果你的客戶端是Eclipse的RCP則和這個配置有一些不同


     

    1.項目的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

    將這兩個文件放到項目的classpath的根位置

    4.做測試程序

    public class HelloService implements IHelloServiceLocal, IHelloServiceRemote {
       @PersistenceContext
       private EntityManager em;
       
       @Resource
       private SessionContext ctx;
    }
    將代碼實現完,就可以測試了
    posted on 2007-11-08 09:19 wilesun 閱讀(1486) 評論(0)  編輯  收藏 所屬分類: 個人經驗
    主站蜘蛛池模板: 欧美在线看片A免费观看| 国产精品亚洲а∨无码播放麻豆 | 久久久久国色AV免费观看性色| 亚洲国产区男人本色在线观看| 亚洲国产精品日韩专区AV| 久久国产乱子伦精品免费看| 亚洲AV日韩AV永久无码色欲| 亚洲日本精品一区二区| 亚洲午夜精品第一区二区8050| 久久WWW色情成人免费观看| 免费无码VA一区二区三区| 无套内谢孕妇毛片免费看看 | 99久久久国产精品免费牛牛 | 亚洲嫩草影院久久精品| 亚洲国产精品碰碰| 免费一级黄色毛片| 日韩精品视频免费网址| 韩国18福利视频免费观看| 成年女人午夜毛片免费视频| 男女超爽刺激视频免费播放| 98精品全国免费观看视频| 99久热只有精品视频免费看| 日韩精品极品视频在线观看免费| 一区二区视频在线免费观看| av午夜福利一片免费看久久| 国产高清视频免费在线观看 | 亚洲第一视频网站| 亚洲一区二区三区久久| 亚洲日韩AV无码一区二区三区人| 亚洲精品色播一区二区 | 亚洲一区精品无码| 亚洲最大的成网4438| 中文字幕在线观看亚洲日韩| 国产精品亚洲二区在线| 一个人免费视频在线观看www| 免费国产成人午夜在线观看| 成人免费无码大片A毛片抽搐色欲| 四虎成人精品在永久免费| 亚洲AV无码日韩AV无码导航| 亚洲综合偷自成人网第页色| 无遮挡a级毛片免费看|