首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

HibernateSearch学习三

2012-08-30 
HibernateSearch学习3Embedded and associated objectsUsing @IndexedEmbedded to index associations@Ent

HibernateSearch学习3
Embedded and associated objects
Using @IndexedEmbedded to index associations

@Entity@Indexedpublic class Place {@Id@GeneratedValue@DocumentIdprivate Long id;@Field( index = Index.TOKENIZED )private String name;@OneToOne( cascade = { CascadeType.PERSIST, CascadeType.REMOVE } )@IndexedEmbeddedprivate Address address;....}@Entitypublic class Address {@Id@GeneratedValueprivate Long id;@Field(index=Index.TOKENIZED)private String street;@Field(index=Index.TOKENIZED)private String city;@IndexedEmbedded(depth = 1, prefix = "ownedBy_")private Owner ownedBy;@ContainedIn@OneToMany(mappedBy="address")private Set<Place> places;...}@Embeddablepublic class Owner {@Field(index = Index.TOKENIZED)private String name;...}

.。。。。。。。。。。。

热点排行