赞
踩
请移步:http://blog.csdn.net/fly910905/article/details/78140411
@org.hibernate.annotations.Table(appliesTo = "TableName",comment="表注释")
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.annotations;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* Complementary information to a table either primary or secondary.
*
* @author Emmanuel Bernard
*/
@Target({TYPE})
@Retention(RUNTIME)
public @interface Table {
/**
* name of the targeted table.
*/
String appliesTo();
/**
* Indexes.
*/
Index[] indexes() default {};
/**
* define a table comment.
*/
String comment() default "";
/**
* Defines the Foreign Key name of a secondary table pointing back to the primary table.
*/
ForeignKey foreignKey() default @ForeignKey( name="" );
/**
* If set to JOIN, the default, Hibernate will use an inner join to retrieve a
* secondary table defined by a class or its superclasses and an outer join for a
* secondary table defined by a subclass.
* If set to select then Hibernate will use a
* sequential select for a secondary table defined on a subclass, which will be issued only if a row
* turns out to represent an instance of the subclass. Inner joins will still be used to retrieve a
* secondary defined by the class and its superclasses.
*
* <b>Only applies to secondary tables</b>
*/
FetchMode fetch() default FetchMode.JOIN;
/**
* If true, Hibernate will not try to insert or update the properties defined by this join.
*
* <b>Only applies to secondary tables</b>
*/
boolean inverse() default false;
/**
* If enabled, Hibernate will insert a row only if the properties defined by this join are non-null
* and will always use an outer join to retrieve the properties.
*
* <b>Only applies to secondary tables</b>
*/
boolean optional() default true;
/**
* Defines a custom SQL insert statement.
*
* <b>Only applies to secondary tables</b>
*/
SQLInsert sqlInsert() default @SQLInsert(sql="");
/**
* Defines a custom SQL update statement.
*
* <b>Only applies to secondary tables</b>
*/
SQLUpdate sqlUpdate() default @SQLUpdate(sql="");
/**
* Defines a custom SQL delete statement.
*
* <b>Only applies to secondary tables</b>
*/
SQLDelete sqlDelete() default @SQLDelete(sql="");
}
@Column(name="columnComment",columnDefinition="varchar(200) COMMENT '字段注释'")
/*
* Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution. The Eclipse Public License is available
* at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License
* is available at http://www.eclipse.org/org/documents/edl-v10.php.
*/
package javax.persistence;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* Is used to specify the mapped column for a persistent property or field.
* If no <code>Column</code> annotation is specified, the default values apply.
*
* <blockquote><pre>
* Example 1:
*
* @Column(name="DESC", nullable=false, length=512)
* public String getDescription() { return description; }
*
* Example 2:
*
* @Column(name="DESC",
* columnDefinition="CLOB NOT NULL",
* table="EMP_DETAIL")
* @Lob
* public String getDescription() { return description; }
*
* Example 3:
*
* @Column(name="ORDER_COST", updatable=false, precision=12, scale=2)
* public BigDecimal getCost() { return cost; }
*
* </pre></blockquote>
*
*
* @since Java Persistence 1.0
*/
@Target({METHOD, FIELD})
@Retention(RUNTIME)
public @interface Column {
/**
* (Optional) The name of the column. Defaults to
* the property or field name.
*/
String name() default "";
/**
* (Optional) Whether the column is a unique key. This is a
* shortcut for the <code>UniqueConstraint</code> annotation at the table
* level and is useful for when the unique key constraint
* corresponds to only a single column. This constraint applies
* in addition to any constraint entailed by primary key mapping and
* to constraints specified at the table level.
*/
boolean unique() default false;
/**
* (Optional) Whether the database column is nullable.
*/
boolean nullable() default true;
/**
* (Optional) Whether the column is included in SQL INSERT
* statements generated by the persistence provider.
*/
boolean insertable() default true;
/**
* (Optional) Whether the column is included in SQL UPDATE
* statements generated by the persistence provider.
*/
boolean updatable() default true;
/**
* (Optional) The SQL fragment that is used when
* generating the DDL for the column.
* <p> Defaults to the generated SQL to create a
* column of the inferred type.
*/
String columnDefinition() default "";
/**
* (Optional) The name of the table that contains the column.
* If absent the column is assumed to be in the primary table.
*/
String table() default "";
/**
* (Optional) The column length. (Applies only if a
* string-valued column is used.)
*/
int length() default 255;
/**
* (Optional) The precision for a decimal (exact numeric)
* column. (Applies only if a decimal column is used.)
* Value must be set by developer if used when generating
* the DDL for the column.
*/
int precision() default 0;
/**
* (Optional) The scale for a decimal (exact numeric) column.
* (Applies only if a decimal column is used.)
*/
int scale() default 0;
}
package com.newcapec.dao.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import java.util.Date;
import static javax.persistence.GenerationType.AUTO;
/**
* @Title: 用户报名缴费信息实体
* @ClassName: com.newcapec.dao.domain.UserEnrollPay.java
* @Description: 位于校内的报名系统--中间库上
*
* @Copyright 2016-2017 新开普 - Powered By 研发中心
* @author: 王延飞
* @date: 2017-12-13 15:31
* @version V1.0
*/
@Entity
@org.hibernate.annotations.Table(appliesTo = "user_enroll_pay",comment="用户报名缴费信息")
@ApiModel("Person(用户报名缴费信息)")
public class UserEnrollPay {
@Id
@GeneratedValue(strategy = AUTO)
@Column(name = "id", unique = true, nullable = false,columnDefinition="bigint(20) COMMENT '主键id'")
@ApiModelProperty("主键id")
private Long id;
/**
* 证件号
*/
@Column(columnDefinition="varchar(20) COMMENT '证件号'")
@ApiModelProperty("证件号")
private String idserial;
/**
* 订单金额
*/
@Column(columnDefinition = "Decimal(10,2) COMMENT '订单金额'", scale = 2 ,precision=10)
@ApiModelProperty("订单金额")
private double orderamt;
/**
* 支付时间
*/
@Column(columnDefinition="datetime COMMENT '支付时间'")
@ApiModelProperty("支付时间")
private Date paytime;
/**
* 支付标志
* 0-未支付
* 1-支付中
* 2-支付成功
* 3-支付失败
* 4-已过期
* 5-已取消
*/
@Column(columnDefinition="int(2) COMMENT '支付标志 0-未支付 1-支付中 2-支付成功 3-支付失败 4-已过期 5-已取消'")
@ApiModelProperty("支付标志 0-未支付 1-支付中 2-支付成功 3-支付失败 4-已过期 5-已取消")
private Integer payflag;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getIdserial() {
return idserial;
}
public void setIdserial(String idserial) {
this.idserial = idserial;
}
public double getOrderamt() {
return orderamt;
}
public void setOrderamt(double orderamt) {
this.orderamt = orderamt;
}
public Date getPaytime() {
return paytime;
}
public void setPaytime(Date paytime) {
this.paytime = paytime;
}
public Integer getPayflag() {
return payflag;
}
public void setPayflag(Integer payflag) {
this.payflag = payflag;
}
@Override
public String toString() {
return "UserEnrollPay{" +
"id=" + id +
", idserial='" + idserial + '\'' +
", orderamt=" + orderamt +
", paytime=" + paytime +
", payflag=" + payflag +
'}';
}
}
CREATE TABLE `user_enroll_pay` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键id',
`idserial` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '证件号',
`orderamt` decimal(10,2) DEFAULT NULL COMMENT '订单金额',
`payflag` int(2) DEFAULT NULL COMMENT '支付标志 0-未支付 1-支付中 2-支付成功 3-支付失败 4-已过期 5-已取消',
`paytime` datetime DEFAULT NULL COMMENT '支付时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='用户报名缴费信息';
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。