Skip to content
Snippets Groups Projects
Commit 2e271eae authored by ginquin's avatar ginquin
Browse files

Comentado hibernate search

parent dc1a9e23
Branches
No related tags found
No related merge requests found
Showing with 18 additions and 35 deletions
......@@ -137,11 +137,12 @@
<artifactId>hibernate-core</artifactId>
<version>5.2.10.Final</version>
</dependency>
<!--
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search-orm</artifactId>
<version>5.8.2.Final</version>
</dependency>
</dependency> -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
......
......@@ -15,11 +15,6 @@ import javax.persistence.OneToMany;
import javax.persistence.PrePersist;
import javax.persistence.SequenceGenerator;
import org.hibernate.search.annotations.Analyze;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.Store;
import org.zkoss.lang.Strings;
......@@ -28,7 +23,7 @@ import org.zkoss.lang.Strings;
*
*/
@Entity
@Indexed
//@Indexed
@NamedQuery(name="Author.findAll", query="SELECT a FROM Author a")
public class Author implements Serializable {
private static final long serialVersionUID = 1L;
......@@ -49,7 +44,7 @@ public class Author implements Serializable {
@Column(name="name",nullable=false)
private String name;
@Field(index = Index.YES, analyze = Analyze.YES, store = Store.NO)
//@Field(index = Index.YES, analyze = Analyze.YES, store = Store.NO)
@Column(name="surname",nullable=false)
private String surname;
......
......@@ -16,11 +16,6 @@ import javax.persistence.OneToMany;
import javax.persistence.PrePersist;
import javax.persistence.SequenceGenerator;
import org.hibernate.search.annotations.Analyze;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.Store;
import org.zkoss.lang.Strings;
import org.zkoss.util.resource.Labels;
......@@ -30,7 +25,7 @@ import org.zkoss.util.resource.Labels;
*
*/
@Entity
@Indexed
//@Indexed
@NamedQuery(name="Institution.findAll", query="SELECT i FROM Institution i")
public class Institution implements Serializable {
private static final long serialVersionUID = 1L;
......@@ -45,7 +40,7 @@ public class Institution implements Serializable {
@Column(name="institution_id")
private Integer institutionId;
@Field(index = Index.YES, analyze = Analyze.YES, store = Store.NO)
//@Field(index = Index.YES, analyze = Analyze.YES, store = Store.NO)
@Column(name="acronym")
private String acronym;
......
......@@ -18,19 +18,20 @@ public interface AuthorService {
*/
Author getAuthorById(Integer author_id);
/**
* Permite obtener authors por surname.
* @param keyWord palabra con la se hace la búsqueda.
* @return lista con los resultados de la búsqueda.
*/
List<Author> getAuthorsBySurname(String keyWord);
//List<Author> getAuthorsBySurname(String keyWord);
/**
* Permite obtener authors por nombre.
* @param keyWord palabra con la se hace la búsqueda.
* @return lista con los resultados de la búsqueda.
*/
List<Author> getAuthorsByName(String keyWord);
//List<Author> getAuthorsByName(String keyWord);
/**
* Permite guardar un author en la bd secundaria.
......
......@@ -28,7 +28,7 @@ public interface InstitutionService {
* @param keyWord palabra con la se hace la búsqueda.
* @return lista con los resultados de la búsqueda.
*/
List<Institution> getInstitutionsByAcronym(String keyWord);
//List<Institution> getInstitutionsByAcronym(String keyWord);
/**
* Permite guardar una Institution en la bd secundaria.
......
......@@ -6,11 +6,6 @@ import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;
import org.apache.lucene.search.Query;
import org.hibernate.search.jpa.FullTextEntityManager;
import org.hibernate.search.jpa.FullTextQuery;
import org.hibernate.search.jpa.Search;
import org.hibernate.search.query.dsl.QueryBuilder;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
......@@ -35,7 +30,7 @@ public class AuthorDao {
public Author getAuthorByID(Integer author_id) {
return em.find(Author.class, author_id);
}
/*
@Transactional(value="transactionManager",readOnly=true)
public List<Author> getAuthorsBySurname(String keyWord) {
FullTextEntityManager fullTextEntityManager = org.hibernate.search.jpa.Search.getFullTextEntityManager(em);
......@@ -89,7 +84,7 @@ public class AuthorDao {
return fullTextEntityManager.getSearchFactory().buildQueryBuilder().forEntity(Author.class).get();
}
*/
@PersistenceContext(unitName="jpaDataCopy")
@Qualifier(value="entityManagerFactoryCopy")
private EntityManager emCopy;
......
......@@ -27,6 +27,7 @@ public class AuthorServiceImpl implements AuthorService {
return dao.getAuthorByID(author_id);
}
/*
@Override
public List<Author> getAuthorsBySurname(String surname) {
return dao.getAuthorsBySurname(surname);
......@@ -36,7 +37,7 @@ public class AuthorServiceImpl implements AuthorService {
public List<Author> getAuthorsByName(String keyWord) {
return dao.getAuthorsByName(keyWord);
}
*/
@Override
public Author saveAuthor(Author author) {
dao.saveAuthor(author);
......
......@@ -6,11 +6,6 @@ import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;
import org.apache.lucene.search.Query;
import org.hibernate.search.jpa.FullTextEntityManager;
import org.hibernate.search.jpa.FullTextQuery;
import org.hibernate.search.jpa.Search;
import org.hibernate.search.query.dsl.QueryBuilder;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
......@@ -36,7 +31,7 @@ public class InstitutionDao {
public Institution getInstitutionByID(Integer institution_id) {
return em.find(Institution.class, institution_id);
}
/*
@Transactional(value="transactionManager",readOnly=true)
public List<Institution> getInstitutionsByAcronym(String keyWord) {
FullTextEntityManager fullTextEntityManager = org.hibernate.search.jpa.Search.getFullTextEntityManager(em);
......@@ -69,7 +64,7 @@ public class InstitutionDao {
FullTextEntityManager fullTextEntityManager = Search.getFullTextEntityManager(em);
return fullTextEntityManager.getSearchFactory().buildQueryBuilder().forEntity(Institution.class).get();
}
}*/
@PersistenceContext(unitName="jpaDataCopy")
@Qualifier(value="entityManagerFactoryCopy")
......
......@@ -27,12 +27,12 @@ public class InstitutionServiceImpl implements InstitutionService {
public Institution getInstitutionById(Integer institution_id) {
return dao.getInstitutionByID(institution_id);
}
/*
@Override
public List<Institution> getInstitutionsByAcronym(String keyWord) {
return dao.getInstitutionsByAcronym(keyWord);
}
*/
@Override
public Institution saveInstitution(Institution institution) {
dao.saveInstitution(institution);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment