转 appfuse

http://blog.csdn.net/java20100406/article/details/6049041
http://blog.csdn.net/bluishglc/article/details/6730773
http://www.cnblogs.com/QQParadise/articles/1441416.html
插件 svn checkout https://github.com/appfuse/appfuse/trunk/plugins/appfuse-maven-plugin appfuse-maven-plugin

compass http://blog.sina.com.cn/s/blog_90c4a900010123gf.html

新建模板工程
mvn archetype:generate -B -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-basic-struts-archetype -DarchetypeVersion=2.1.0 -DarchetypeRepository=http://oss.sonatype.org/content/repositories/appfuse -DgroupId=com.asxm -DartifactId=appfuse

获取appfuse代码
mvn appfuse:full-source

获取appfuse代码生成模板
mvn appfuse:copy-templates

update pom.xml  jdbc setting

applicationContext
           <entry key="compass.engine.connection" value="target/test-index" />
change to  <entry key="compass.engine.connection" value="ram://index" />

create entity class  add @Entity @Id annotation

代码生成/删除
mvn appfuse:gen -Dentity=Name 
mvn appfuse:remove -Dentity=Name

pom.xml中查找genericCore,大概在940行 找到 将属性true 改为false

根据数据库反向生成实体类
mvn appfuse:gen-model

hibernate.reveng 文件用于控制反向工程
其中可以配置表过滤,这样在生成pojo时就不会生成被过滤的表对应的类。

hibernate.reveng 的路径是src/test/resources。


<entry key="compass.engine.connection" value="target/test-index" />
可改为<entry key="compass.engine.connection" value="ram://test-index" />

运行项目
mvn jetty:run

eclipse 里运行时可能不会正确生成数据库,需要用命令方式

pom.xml配置中增加<skipTests>true</skipTests>跳过集成测试及相关数据库初始化操作

hibernate3-maven-plugin 数据库操作
dbunit-maven-plugin 数据操作

使用 mvn dbunit:export -Ddest=sample-data.xml 将数据库的数据导出来

发生native2ascii 相关错误 拷贝tools.jar 到jre/lib/ext 目录

displaytag 标签的国际化资源文件需要在pom中配置
另外需增加en结尾的文件 否则英文无法显示。

appfuse内属性文件编码部分为utf8 在pom中配置编码替换 而非用eclipse的属性文件编辑器及时变换。


连接池变更
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
        <property name="driverClass" value="${jdbc.driverClassName}"/>
        <property name="jdbcUrl" value="${jdbc.url}"/>
        <property name="user" value="${jdbc.username}"/>
        <property name="password" value="${jdbc.password}"/>
        <property name="minPoolSize" value="3"/>
        <property name="testConnectionOnCheckin" value="true"/>  <!-- 获取connnection时测试是否有效 -->
        <property name="idleConnectionTestPeriod" value="1800"/>
        <property name="maxIdleTime" value="2500"/>
        <property name="testConnectionOnCheckout" value="true"/>
    </bean>

    <dependency>  
                <groupId>org.hibernate</groupId>  
                <artifactId>hibernate-c3p0</artifactId>  
                <version>3.3.2.GA</version>  
            </dependency>  



当前action
ActionContext.getContext().getName();

类型转换器定义
xwork-conversion.properties

修改时间格式 属性文件内
date.format=yyyy-MM-dd

appfuse 默认用protetypeJS库
如果该用jquery 需注意 $() 调用的返回值不同

猜你喜欢

转载自c6404516.iteye.com/blog/1665304