1. 建立表userinfo

列名 描述
UserID  主键、自增
UserName 用户名
Pwd 密码
CreateDate 创建日期

2. 在src/main/resources目录下增加文件hibernate.reveng.xml,并在pom.xml中配置build子标签

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering
SYSTEM "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" > <hibernate-reverse-engineering> <type-mapping>
<!-- jdbc-type is name fom java.sql.Types -->
<sql-type jdbc-type="VARCHAR" length='1' hibernate-type="yes_no"/>
<!-- length, scale and precision can be used to specify the mapping precisly -->
<sql-type jdbc-type="NUMERIC" precision='1' hibernate-type="boolean"/>
<!-- the type-mappings are ordered. This mapping will be consulted last,
thus overriden by the previous one if precision=1 for the column -->
<sql-type jdbc-type="BIGINT" hibernate-type="java.lang.Long"/>
<sql-type jdbc-type="INTEGER" hibernate-type="java.lang.Long"/>
<sql-type jdbc-type="NUMERIC" hibernate-type="java.lang.Long"/>
</type-mapping> <table-filter match-name="*" exclude="true"/>
<table-filter match-name="userinfo" exclude="false"/>
</hibernate-reverse-engineering>

hibernate.reveng.xml

 <plugin>
<groupId>org.appfuse.plugins</groupId>
<artifactId>appfuse-maven-plugin</artifactId>
<version>${project.parent.version}</version>
<configuration>
<componentProperties>
<revengfile>src/main/resources/hibernate.reveng.xml</revengfile>
</componentProperties>
<genericCore>${amp.genericCore}</genericCore>
<fullSource>${amp.fullSource}</fullSource>
</configuration>
<dependencies>
<dependency>
<groupId>${jdbc.groupId}</groupId>
<artifactId>${jdbc.artifactId}</artifactId>
<version>${jdbc.version}</version>
</dependency>
</dependencies>
</plugin>

pom的配置

3. 打开命令行,输入mvn appfuse:gen-model 生成实体类userinfo.java

package com.zcmp.disappearwind.model;

import com.zcmp.disappearwind.model.BaseObject;

import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.IndexedEmbedded; import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.xml.bind.annotation.XmlRootElement; import java.io.Serializable; @Entity
@Table(name="userinfot",catalog="disappearwind")
@Indexed
@XmlRootElement
public class Userinfo extends BaseObject implements Serializable {
private Long userId;
private Date createDate;
private String pwd;
private String userName; @Id @GeneratedValue(strategy=IDENTITY) @DocumentId
public Long getUserId() {
return this.userId;
} public void setUserId(Long userId) {
this.userId = userId;
}
@Temporal(TemporalType.TIMESTAMP)
@Column(name="CreateDate", length=19)
@Field
public Date getCreateDate() {
return this.createDate;
} public void setCreateDate(Date createDate) {
this.createDate = createDate;
} @Column(name="Pwd", length=128)
@Field
public String getPwd() {
return this.pwd;
} public void setPwd(String pwd) {
this.pwd = pwd;
} @Column(name="UserName", length=128)
@Field
public String getUserName() {
return this.userName;
} public void setUserName(String userName) {
this.userName = userName;
} public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false; Userinfo pojo = (Userinfo) o; if (createDate != null ? !createDate.equals(pojo.createDate) : pojo.createDate != null) return false;
if (pwd != null ? !pwd.equals(pojo.pwd) : pojo.pwd != null) return false;
if (userName != null ? !userName.equals(pojo.userName) : pojo.userName != null) return false; return true;
} public int hashCode() {
int result = 0;
result = (createDate != null ? createDate.hashCode() : 0);
result = 31 * result + (pwd != null ? pwd.hashCode() : 0);
result = 31 * result + (userName != null ? userName.hashCode() : 0); return result;
} public String toString() {
StringBuffer sb = new StringBuffer(getClass().getSimpleName()); sb.append(" [");
sb.append("userId").append("='").append(getUserId()).append("', ");
sb.append("createDate").append("='").append(getCreateDate()).append("', ");
sb.append("pwd").append("='").append(getPwd()).append("', ");
sb.append("userName").append("='").append(getUserName()).append("'");
sb.append("]"); return sb.toString();
} }

Userinfo

4. 在命令号运行mvn appfuse:gen生成页面、Controller、menu配置等文件,注意提示输入实体名的时候大小写一定要和第三步生成的类名保持一致

5. 打开ApplicationResources_zh.properties文件,汉化各字段的名称以及各种标题和提示信息

6. 重新部署即可

Appfuse:第一张表维护的更多相关文章

  1. mysql连表查空,查询第二张表中没有第一张表中的数据

    select consumer_id,user_name,mobile,invite_code from csr_consumer where invite_count<(select coun ...

  2. 级联两个bootstrap-table。一张表显示相关的数据,通过点击这张表的某一行,传过去对应的ID,刷新另外一张表。

    二张表的代码(我用的插件,大家可以去网上直接下载http://issues.wenzhixin.net.cn/bootstrap-table/): <div class="contai ...

  3. sql语句左链接left join--3张表关联

    表A---------------------------------关联第一张表B-----------------------关联第二张表c select * fomr 表名A left join ...

  4. 【第十五篇】easyui datagrid的列编辑,同时插入两张表的数据进去

    看图说话. 需求:插入两张表,上面的表单是第一张表的内容,下面的两个表格是第二张详情表的内容,跟第一张表的id关联 第二张表有一个列是需要用户手动填写添加的. 国际惯例,上代码 <div id= ...

  5. 利用pymysql同时修改两张表的数据

    使用pymysql操作数据库中相关联的两张表需求:两张表中分别有一个字段是json格式,需要往json中再插入一个属性值’container_cloud’=’fasle’. import pymysq ...

  6. Ajax案例:三级联动查询员工的信息(三张表进行内连接)

    需求分析: 通过数据库连接池,可以查询到数据库中员工的各种信息,通过点击下拉框的方式实现三级联动,即:没有点击city下拉框,后面两个下拉框中没有值,这样,点击city下拉框,department下拉 ...

  7. 多对多第三张表的创建方式 和 forms组件的使用

    目录 一.多对多第三张表的创建 1. 全自动方式 (1)实现代码 (2)优点和不足 2. 纯手撸方式(了解) (1)实现代码 (2)优点和不足 3. 半自动方式(推荐使用) (1)实现代码 (2)优点 ...

  8. sql 查出一张表中重复的所有记录数据

    1.在面试的时候碰到一个 问题,就是让写一张表中有id和name 两个字段,查询出name重复的所有数据,现在列下: select * from xi a where (a.username) in ...

  9. SQLSERVER中如何快速比较两张表的不一样

    SQLSERVER中如何快速比较两张表的不一样 不知不觉要写2014年的最后一篇博文了~ 一般来说,如何检测两张表的内容是否一致,体现在复制的时候发布端和订阅端的两端的数据上面 我这里罗列了一些如何从 ...

随机推荐

  1. 快速web开发中的前后端框架选型最佳实践

    这个最佳实践是我目前人在做的一个站点,主要功能: oauth登录 发布文章(我称为"片段"),片段可以自定义一些和内容有关的指标,如“文中人物:12”.支持自定义排版.插图.建立相 ...

  2. 如何扩展 Visual Studio 编辑器

    在 Visual Studio 2010 的时代,扩展 Visual Studio 的途径有很多,开发者可以选择宏.Add-in.MEF 和 VSPackages 进行自定义的扩展.但是宏在 Visu ...

  3. Oracle数据库自动备份SQL文本:Procedure存储过程,View视图,Function函数,Trigger触发器,Sequence序列号等

    功能:备份存储过程,视图,函数触发器,Sequence序列号等准备工作:--1.创建文件夹 :'E:/OracleBackUp/ProcBack';--文本存放的路径--2.执行:create or ...

  4. 在 CSS 预编译器之后:PostCSS

    提到css预编译器(css preprocessor),你可能想到Sass.Less以及Stylus.而本文要介绍的PostCSS,正是一个这样的工具:css预编译器可以做到的事,它同样可以做到. “ ...

  5. 基于DotNetOpenAuth的OAuth实现示例代码: 获取access token

    1. 场景 根据OAuth 2.0规范,该场景发生于下面的流程图中的(D)(E)节点,根据已经得到的authorization code获取access token. 2. 实现环境 DotNetOp ...

  6. ASP.NET Core中的project.json何去何从?

    Shawn Wildermuth (https://wildermuth.com/2016/05/12/The-Future-of-project-json-in-ASP-NET-Core) If y ...

  7. Set容器--HashSet集合

    Set容器特点: ①   Set容器是一个不包含重复元素的Collection,并且最多包含一个null元素,它和List容器相反,Set容器不能保证其元素的顺序; ②   最常用的两个Set接口的实 ...

  8. Hibernate(5)—— 联合主键 、一对一关联关系映射(xml和注解) 和 领域驱动设计

    俗话说,自己写的代码,6个月后也是别人的代码……复习!复习!复习!涉及的知识点总结如下: One to One 映射关系 一对一单向外键(XML/Annotation) 一对一双向外键关联(XML/A ...

  9. 使用ETag进行session的降级

    回顾 在web后台开发中我们经常需要存储一些变量到session中进行暂存,最为特殊的就是"购物车",由于http的无状态特性,因此我们需要在客户端打上一个标记,唯一的标示客户端并 ...

  10. HTML基本元素(四)

    1.HTML框架 框架的作用就是把浏览器窗口划分成多个子窗口,而且每个子窗口都可以载入各自的HTML文档. *注意:html框架集与body同级,因此不能同时出现! 框架结构标签:<frames ...