简体   繁体   English

如何在hibernate3中建立索引

[英]How to do indexing in hibernate3

I am newbie to hibernate framework.To increase the performance of searching in my project i want to do index for some tables columns.As per my research,hibernate automatically indexes when performing crud operations via criteria.so is their any way to tune my search faster in hibernate and also creating index externally increase the performance of my search? 我是休眠框架的新手。为了提高项目搜索的性能,我想为一些表列做索引。根据我的研究,休眠通过标准执行crud操作时会自动进行索引。因此它们是调整我的搜索的任何方式更快进入休眠状态并在外部创建索引可提高搜索性能?

Any Idea will be greatly appreciated!!! 任何想法将不胜感激!!!

URL: 网址:

http://hibernate.org/search/documentation/getting-started/#define-which-entities-need-to-be-indexed http://hibernate.org/search/documentation/getting-started/#define-which-entities-need-to-be-indexed

Can give you details on indexing n hibernate. 可以为您提供有关索引n休眠的详细信息。

Below is some snippet from the link. 以下是链接中的一些代码片段。 For furter reading, please refer the link. 如需进一步阅读,请参阅链接。

The annotation @Indexed marks Book as an entity which needs to be indexed by Hibernate Search. 注释@Indexed将Book标记为需要由Hibernate Search进行索引的实体。

package example;
...
@Entity
@Indexed
public class Book {

  @Id
  @GeneratedValue
  private Integer id;

  @Field(index=Index.YES, analyze=Analyze.YES, store=Store.NO)
  private String title;

  @Field(index=Index.YES, analyze=Analyze.YES, store=Store.NO)
  private String subtitle;

  @Field(index=Index.YES, analyze=Analyze.NO, store=Store.YES)
  @DateBridge(resolution=Resolution.DAY)
  private Date publicationDate;

  @IndexedEmbedded
  @ManyToMany
  private Set<Author> authors = new HashSet<Author>();
  public Book() {
  }

  // standard getters/setters follow here
  ...
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM