使用elastichsearch、spring数据和JPA索引域对象
我正在使用spring数据和JPA开发一个应用程序,以实现基于REST的服务。我想使用ElastSearch作为索引引擎。 我的域对象:使用elastichsearch、spring数据和JPA索引域对象,jpa,spring-data,
spring-data-elasticsearch,Jpa,Spring Data,
spring Data Elasticsearch,我正在使用spring数据和JPA开发一个应用程序,以实现基于REST的服务。我想使用ElastSearch作为索引引擎。 我的域对象: @Document(indexName="elastic",type="user_demo") @Entity @Table(name="USER_DEMO") public class UserDemo { @org.springframework.data.annotation.Id @Id @GeneratedValue(str
@Document(indexName="elastic",type="user_demo")
@Entity
@Table(name="USER_DEMO")
public class UserDemo {
@org.springframework.data.annotation.Id
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long userId;
private String emailAddress;
private String name;
private String login;
private String password;
...
}
执行时,我得到以下异常:org.springframework.data.mapping.PropertyReferenceException:找不到UserDemo类型的属性保存代码>
如果有人成功地实现了JPA,Spring Data和Spring Data Elasticsearch可以与同一个域对象共享一个示例 如上所述的独立存储库包
@Configuration
@EnableElasticsearchRepositories(basePackages = "demo.elasticrepository")
@EnableJpaRepositories(basePackages = "demo.repository")
public class RepoConfig {
}