This commit is contained in:
Redkale
2017-01-17 13:37:34 +08:00
parent da0ff24af6
commit 4071a5d165
5 changed files with 31 additions and 23 deletions

View File

@@ -1,4 +1,4 @@
/*******************************************************************************
/** *****************************************************************************
* Copyright (c) 2011 - 2013 Oracle Corporation. All rights reserved.
*
* This program and the accompanying materials are made available under the
@@ -11,7 +11,7 @@
* Contributors:
* Linda DeMichiel - Java Persistence 2.1
*
******************************************************************************/
***************************************************************************** */
package javax.persistence;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
@@ -24,23 +24,18 @@ import java.lang.annotation.Target;
* Note that it is not necessary to specify an index for a primary key,
* as the primary key index will be created automatically.
*
* <p>
* The syntax of the <code>columnList</code> element is a
* <p>
* The syntax of the <code>columnList</code> element is a
* <code>column_list</code>, as follows:
*
*
* <pre>
* column::= index_column [,index_column]*
* index_column::= column_name [ASC | DESC]
* </pre>
*
* <p> If <code>ASC</code> or <code>DESC</code> is not specified,
* <code>ASC</code> (ascending order) is assumed.
*
* @see Table
* @see SecondaryTable
* @see CollectionTable
* @see JoinTable
* @see TableGenerator
* <p>
* If <code>ASC</code> or <code>DESC</code> is not specified,
* <code>ASC</code> (ascending order) is assumed.
*
* @since Java Persistence 2.1
*
@@ -51,17 +46,23 @@ public @interface Index {
/**
* (Optional) The name of the index; defaults to a provider-generated name.
*
* @return String
*/
String name() default "";
/**
* (Required) The names of the columns to be included in the index,
* (Required) The names of the columns to be included in the index,
* in order.
*
* @return String
*/
String columnList();
/**
* (Optional) Whether the index is unique.
*
* @return boolean
*/
boolean unique() default false;

View File

@@ -67,6 +67,7 @@ public @interface Table {
* annotations and constraints entailed by primary key mappings.
* <p>
* Defaults to no additional constraints.
* @return UniqueConstraint[]
*/
UniqueConstraint[] uniqueConstraints() default {};
@@ -76,6 +77,7 @@ public @interface Table {
* to specify an index for a primary key, as the primary key
* index will be created automatically.
*
* @return indexes
* @since Java Persistence 2.1
*/
Index[] indexes() default {};

View File

@@ -1,4 +1,4 @@
/*******************************************************************************
/** *****************************************************************************
* Copyright (c) 2008 - 2013 Oracle Corporation. All rights reserved.
*
* This program and the accompanying materials are made available under the
@@ -12,7 +12,7 @@
* Linda DeMichiel - Java Persistence 2.1
* Linda DeMichiel - Java Persistence 2.0
*
******************************************************************************/
***************************************************************************** */
package javax.persistence;
import java.lang.annotation.Target;
@@ -27,7 +27,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
* Example:
* &#064;Entity
* &#064;Table(
* name="EMPLOYEE",
* name="EMPLOYEE",
* uniqueConstraints=
* &#064;UniqueConstraint(columnNames={"EMP_ID", "EMP_NAME"})
* )
@@ -36,17 +36,21 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
*
* @since Java Persistence 1.0
*/
@Target({})
@Target({})
@Retention(RUNTIME)
public @interface UniqueConstraint {
/** (Optional) Constraint name. A provider-chosen name will be chosen
/** (Optional) Constraint name. A provider-chosen name will be chosen
* if a name is not specified.
*
* @return String
* @since Java Persistence 2.0
*/
String name() default "";
/** (Required) An array of the column names that make up the constraint. */
/** (Required) An array of the column names that make up the constraint.
*
* @return String[]
*/
String[] columnNames();
}

View File

@@ -24,7 +24,7 @@ public interface DistributeTableStrategy<T> {
* @param table 模板表的表名
* @param primary 记录主键
*
* @return
* @return 带库名的全表名
*/
default String getTable(String table, Serializable primary) {
return null;
@@ -38,7 +38,7 @@ public interface DistributeTableStrategy<T> {
* @param table 模板表的表名
* @param node 过滤条件
*
* @return
* @return 带库名的全表名
*/
default String getTable(String table, FilterNode node) {
return null;
@@ -51,7 +51,7 @@ public interface DistributeTableStrategy<T> {
* @param table 模板表的表名
* @param bean 实体对象
*
* @return
* @return 带库名的全表名
*/
public String getTable(String table, T bean);
}

View File

@@ -175,6 +175,7 @@ public class FilterNode { //FilterNode 不能实现Serializable接口 否则
* @param func EntityInfo的加载器
* @param update 是否用于更新的JOIN
* @param joinTabalis 关联表集合
* @param haset 已拼接过的字段名
* @param info Entity类的EntityInfo
*
* @return SQL的join语句 不存在返回null