下面列出了怎么用org.hibernate.annotations.Index的API类实例代码及写法,或者点击链接到github查看源代码。
public static void addIndexes(Table hibTable, Index[] indexes, MetadataBuildingContext buildingContext) {
for (Index index : indexes) {
//no need to handle inSecondPass here since it is only called from EntityBinder
buildingContext.getMetadataCollector().addSecondPass(
new IndexOrUniqueKeySecondPass( hibTable, index.name(), index.columnNames(), buildingContext )
);
}
}
public static List<JPAIndexHolder> buildJpaIndexHolder(javax.persistence.Index[] indexes){
List<JPAIndexHolder> holders = new ArrayList<JPAIndexHolder>( indexes.length );
for(javax.persistence.Index index : indexes){
holders.add( new JPAIndexHolder( index ) );
}
return holders;
}
/**
* Returns the username associated with this user account;
*
* @return the username associated with this user account;
*/
@Basic(optional = false)
@Column(length = 100)
@Index(name = "idx_users_username")
public String getUsername() {
return username;
}
public void setJpaIndex(javax.persistence.Index[] jpaIndex){
this.jpaIndexHolders = buildJpaIndexHolder( jpaIndex );
}
public static void addIndexes(Table hibTable, javax.persistence.Index[] indexes, MetadataBuildingContext buildingContext) {
buildingContext.getMetadataCollector().addJpaIndexHolders( hibTable, buildJpaIndexHolder( indexes ) );
}
public void addIndex(Index index, boolean inSecondPass) {
if ( index == null ) return;
String indexName = index.name();
addIndex( indexName, inSecondPass );
}
@Basic(optional = false)
@Index(name = "idx_users_email")
public String getEmail() {
return email;
}
@Basic(optional = false)
@Column(length = 100)
@Index(name = "idx_roles_name")
public String getName() {
return name;
}
/**
* @return the clusterId
*/
@JsonIgnore
@Index(name = "service_cluster_index")
public Long getClusterId() {
return clusterId;
}
/**
* @return the node
*/
@Index(name = "service_node_index")
public String getNode() {
return node;
}
/**
* @return the component
*/
@Index(name = "service_component_index")
public String getComponent() {
return component;
}
/**
* @return the service
*/
@Index(name = "service_service_index")
public String getService() {
return service;
}
/**
* Gets the cluster id.
*
* @return the clusterId
*/
@JsonIgnore
@Index(name = "event_cluster_index")
public Long getClusterId() {
return clusterId;
}
/**
* @return the category
*/
@Index(name = "event_category_index")
public String getCategory() {
return category;
}
/**
* @return the clusterId
*/
@Index(name = "haservice_cluster_index")
public Long getClusterId() {
return clusterId;
}
/**
* @return the component
*/
@Index(name = "haservice_component_index")
public String getComponent() {
return component;
}
/**
* @return the service
*/
@Index(name = "haservice_service_index")
public String getService() {
return service;
}
/**
* Gets the host.
*
* @return the host
*/
@JsonIgnore
@Index(name = "log_host_index")
public String getHost() {
return host;
}
/**
* Gets the name.
*
* @return the name
*/
@Index(name = "event_name_index")
public String getName() {
return name;
}
/**
* Gets the type.
*
* @return the type
*/
@Index(name = "event_type_index")
public Type getType() {
return type;
}
/**
* Gets the severity.
*
* @return the severity
*/
@Index(name = "event_severity_index")
public Severity getSeverity() {
return severity;
}
/**
* Gets the host.
*
* @return the host
*/
@Index(name = "event_host_index")
public String getHost() {
return host;
}