把工程从spring1.1/Hibernate2迁移到spring1.2-rc1/Hibernate3.0

1、下载spring1.2-rc1,里面的lib目录包含了Hibernate3

2、修改源代码:

替换net.sf.hibernate 为 org.hibernate

替换org.springframework.orm.hibernate 为 org.springframework.orm.hibernate3

由 于spring1.2-rc1“deprecated HibernateTemplate's "createQuery", "getNamedQuery" and "createCriteria" methods (in favor of Session proxy)”,替换getHibernateTemplate().getNamedQuery为getSession(). getNamedQuery

由于spring1.2-rc1 deprecated Hibernate "findByNamedQuery" methods for named parameters in favor of "findByNamedQueryAndNamedParam",去掉findByNamedQuery的第3个参数Type[]

3、修改workflow_service_context.xml

替换org.springframework.orm.hibernate 为 org.springframework.orm.hibernate3

替换net.sf.hibernate.cache.OSCacheProvider为org.hibernate.cache.OSCacheProvider

4、修改build.xml的target name="hibernate"

<hibernate version="3.0">改为[hibernatedoclet
            destdir="./src"
            excludedtags="@version,@author,@todo,@see"
            addedtags="@xdoclet-generated at ${TODAY},@copyright The XDoclet Team,@author XDoclet,@version ${version}"
            force="false"
            verbose="true"]
            [fileset dir="./src"]
                [include name="com/norteksoft/panshi/model/*.java"/]
            [fileset>
            [hibernate version="3.0"/]
        [/hibernatedoclet]<hibernatedoclet>
</hibernatedoclet></hibernate>

5、下载xdoclet-hibernate-module-1[1].2.2.h3.for142.jar,替换原来的,以支持hibernate3

6、由于hibernate3默认支持“属性延迟加载”,所以需要修改所有dao里的测试,增加语句super.setUp();和super.tearDown();进行session绑定

ant test由个测试报错:违反唯一约束条件 (WORKFLOW.SYS_C00329901);

ant test-reports又出现BUILD FAILED
D:\spring-projects\Spring_Workflow\build.xml:125: Could not find xalan2 nor xalan1 in the classpath. Check http://xml.apache.org/xalan-j google了一下,下载了xalan-j-current-bin.zip包,把里面的jar包放到ANT_HOME/lib下面就好了.



你可能感兴趣的:(spring,Hibernate,ant,orm,workflow)