Appfuse:第一张表维护
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:第一张表维护的更多相关文章
- mysql连表查空,查询第二张表中没有第一张表中的数据
select consumer_id,user_name,mobile,invite_code from csr_consumer where invite_count<(select coun ...
- 级联两个bootstrap-table。一张表显示相关的数据,通过点击这张表的某一行,传过去对应的ID,刷新另外一张表。
二张表的代码(我用的插件,大家可以去网上直接下载http://issues.wenzhixin.net.cn/bootstrap-table/): <div class="contai ...
- sql语句左链接left join--3张表关联
表A---------------------------------关联第一张表B-----------------------关联第二张表c select * fomr 表名A left join ...
- 【第十五篇】easyui datagrid的列编辑,同时插入两张表的数据进去
看图说话. 需求:插入两张表,上面的表单是第一张表的内容,下面的两个表格是第二张详情表的内容,跟第一张表的id关联 第二张表有一个列是需要用户手动填写添加的. 国际惯例,上代码 <div id= ...
- 利用pymysql同时修改两张表的数据
使用pymysql操作数据库中相关联的两张表需求:两张表中分别有一个字段是json格式,需要往json中再插入一个属性值’container_cloud’=’fasle’. import pymysq ...
- Ajax案例:三级联动查询员工的信息(三张表进行内连接)
需求分析: 通过数据库连接池,可以查询到数据库中员工的各种信息,通过点击下拉框的方式实现三级联动,即:没有点击city下拉框,后面两个下拉框中没有值,这样,点击city下拉框,department下拉 ...
- 多对多第三张表的创建方式 和 forms组件的使用
目录 一.多对多第三张表的创建 1. 全自动方式 (1)实现代码 (2)优点和不足 2. 纯手撸方式(了解) (1)实现代码 (2)优点和不足 3. 半自动方式(推荐使用) (1)实现代码 (2)优点 ...
- sql 查出一张表中重复的所有记录数据
1.在面试的时候碰到一个 问题,就是让写一张表中有id和name 两个字段,查询出name重复的所有数据,现在列下: select * from xi a where (a.username) in ...
- SQLSERVER中如何快速比较两张表的不一样
SQLSERVER中如何快速比较两张表的不一样 不知不觉要写2014年的最后一篇博文了~ 一般来说,如何检测两张表的内容是否一致,体现在复制的时候发布端和订阅端的两端的数据上面 我这里罗列了一些如何从 ...
随机推荐
- iOS开发系列--音频播放、录音、视频播放、拍照、视频录制
--iOS多媒体 概览 随着移动互联网的发展,如今的手机早已不是打电话.发短信那么简单了,播放音乐.视频.录音.拍照等都是很常用的功能.在iOS中对于多媒体的支持是非常强大的,无论是音视频播放.录制, ...
- The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files.
参照 http://stackoverflow.com/questions/24301986/the-type-java-lang-charsequence-cannot-be-resolved-in ...
- Atitit java onvif 开源类库 getProfiles getStreamUri
Atitit java onvif 开源类库 getProfiles getStreamUri 1. ONVIF Java Library by Milgo1 1.1. https://github. ...
- JavaScript权威设计--事件冒泡,捕获,事件句柄,事件源,事件对象(简要学习笔记十八)
1.事件冒泡与事件捕获 2.事件与事件句柄 3.事件委托:利用事件的冒泡技术.子元素的事件最终会冒泡到父元素直到跟节点.事件监听会分析从子元素冒泡上来的事件. 事件委托的好处: 1.每个函 ...
- ASP.NET Core 1.0中实现文件上传的两种方式(提交表单和采用AJAX)
Bipin Joshi (http://www.binaryintellect.net/articles/f1cee257-378a-42c1-9f2f-075a3aed1d98.aspx) Uplo ...
- EntityFramework 7 Migrations 迁移命令
示例代码: using Microsoft.Data.Entity; using System.Collections.Generic; namespace ClassLibrary1 { publi ...
- ASP.NET MVC Html.BeginForm 设置 timeout
示例代码: @using (Html.BeginForm("PublishSubmit", "Blog", FormMethod.Post, new { id ...
- 计算机网络学习笔记--网络层之IP地址与子网
IPv4地址: 我们知道在网络层(TCP/IP体系结构的网际互联层),最重要的一个协议就是IP协议,现在正处于IPv4和IPv6的过渡时期,但目前来说,IPv4仍为主流,所以主要讲Ipv4. IP地址 ...
- php中会话保持 session 与cooker
会话保持 1.session Session:在计算机中,尤其是在网络应用中,称为"会话控制".Session 对象存储特定用户会话所需的属性及配置信息.这样,当用户在应用程序的 ...
- TCP初始化序列号ISN
TCP初始化序列号ISN TCP初始化序列号不能设置为一个固定值,因为这样容易被攻击者猜出后续序列号,从而遭到攻击. RFC1948中提出了一个较好的初始化序列号ISN随机生成算法. ISN = M ...