Commits

Juan Carlos Picado Herrera committed b09176a

Fixed ENCUESTAME-129 Hibernate 3.6

Comments (0)

Files changed (9)

encuestame-business/pom.xml

         </dependency>
         <dependency>
             <groupId>org.hibernate</groupId>
-            <artifactId>hibernate-annotations</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.hibernate</groupId>
             <artifactId>hibernate-core</artifactId>
         </dependency>
         <dependency>

encuestame-business/src/main/java/org/encuestame/business/service/SearchService.java

     public List<Poll> searchPolls(String searchString, String path, String fieldName,
             int results) throws IOException, ParseException {
         List<Poll> pollList = new ArrayList<Poll>();
-        IndexReader reader = IndexReader.open(path, true);
-        Searcher searcher = new IndexSearcher(reader);
+        //IndexReader reader = IndexReader.open(path, true);
+        //IndexReader reader = IndexReader.open(path);
+        //Searcher searcher = new IndexSearcher(reader);
+        Searcher searcher = null;
         QueryParser qp = new QueryParser(Version.LUCENE_29, fieldName,
                 new StandardAnalyzer(Version.LUCENE_29));
         Query query = qp.parse(searchString);
             throws IOException, ParseException {
         Map<String, Object> map = new HashMap<String, Object>();
         List<Poll> articles = new ArrayList<Poll>();
-        Searcher searcher = new IndexSearcher(IndexReader.open(path));
+        //Searcher searcher = new IndexSearcher(IndexReader.open(path));
+        //IndexReader reader = IndexReader.open(path);
+        //Searcher searcher = new IndexSearcher(reader);
+        Searcher searcher = null;
         QueryParser qp = new QueryParser(Version.LUCENE_29, fieldName,
                 new StandardAnalyzer(Version.LUCENE_29));
         Query query = qp.parse(searchString);
     public List<Poll> searchArticle(String searchString, String path, String fieldName,
             int results) throws IOException, ParseException {
         List<Poll> articles = new ArrayList<Poll>();
-        IndexReader reader = IndexReader.open(path);
-        Searcher searcher = new IndexSearcher(reader);
+        //IndexReader reader = IndexReader.open(path);
+        //Searcher searcher = new IndexSearcher(reader);
+        Searcher searcher = null;
         QueryParser qp = new QueryParser(Version.LUCENE_29, fieldName,
                 new StandardAnalyzer(Version.LUCENE_29));
         Query query = qp.parse(searchString);

encuestame-core/pom.xml

         </dependency>
         <dependency>
             <groupId>org.hibernate</groupId>
-            <artifactId>hibernate-annotations</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.hibernate</groupId>
             <artifactId>hibernate-core</artifactId>
         </dependency>
         <dependency>

encuestame-mvc/pom.xml

         </dependency>
         <dependency>
             <groupId>org.hibernate</groupId>
-            <artifactId>hibernate-annotations</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.hibernate</groupId>
             <artifactId>hibernate-core</artifactId>
         </dependency>
         <dependency>

encuestame-persistence/pom.xml

         </dependency>
         <dependency>
             <groupId>org.hibernate</groupId>
-            <artifactId>hibernate-annotations</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.hibernate</groupId>
             <artifactId>hibernate-core</artifactId>
         </dependency>
         <dependency>

encuestame-persistence/src/main/java/org/encuestame/persistence/dao/imp/HashTagDao.java

 import org.apache.lucene.analysis.SimpleAnalyzer;
 import org.apache.lucene.queryParser.MultiFieldQueryParser;
 import org.apache.lucene.queryParser.ParseException;
+import org.apache.lucene.util.Version;
 import org.encuestame.persistence.dao.IHashTagDao;
 import org.encuestame.persistence.domain.HashTag;
 import org.hibernate.HibernateException;
 @Repository("hashTagDao")
 public class HashTagDao extends AbstractHibernateDaoSupport implements IHashTagDao {
 
-	
-	@Autowired
-	public HashTagDao(SessionFactory sessionFactory) {
-	 		setSessionFactory(sessionFactory);
+
+    @Autowired
+    public HashTagDao(SessionFactory sessionFactory) {
+             setSessionFactory(sessionFactory);
     }
-	
+
     /**
      * Create Hash TAg.
      * @param hashTag
                         try {
                             final FullTextSession fullTextSession = Search.getFullTextSession(session);
                             //fullTextSession.flushToIndexes();
-                            final MultiFieldQueryParser parser = new MultiFieldQueryParser(
+                            final MultiFieldQueryParser parser = new MultiFieldQueryParser(Version.LUCENE_30,
                                                   new String[]{"hashTag"},
                                                   new SimpleAnalyzer());
                             final org.apache.lucene.search.Query query = parser.parse(keyword);

encuestame-persistence/src/main/java/org/encuestame/persistence/dao/imp/QuestionDaoImp.java

 import org.apache.lucene.analysis.SimpleAnalyzer;
 import org.apache.lucene.queryParser.MultiFieldQueryParser;
 import org.apache.lucene.queryParser.ParseException;
+import org.apache.lucene.util.Version;
 import org.encuestame.persistence.dao.IQuestionDao;
 import org.encuestame.persistence.domain.Question;
 import org.encuestame.persistence.domain.survey.QuestionPattern;
                     public Object doInHibernate(org.hibernate.Session session) {
                         try {
                             final FullTextSession fullTextSession = Search.getFullTextSession(session);
-                            //fullTextSession.flushToIndexes();
-                            final MultiFieldQueryParser parser = new MultiFieldQueryParser(
-                                                  new String[]{"question"},
-                                                  new SimpleAnalyzer());
+                            final MultiFieldQueryParser parser = new MultiFieldQueryParser(Version.LUCENE_30,
+                                    new String[]{"question"},
+                                    new SimpleAnalyzer());
                             final org.apache.lucene.search.Query query = parser.parse(keyword);
                             final FullTextQuery hibernateQuery = fullTextSession.createFullTextQuery(query, Question.class);
                             final Criteria criteria = session.createCriteria(Question.class);

encuestame-war/pom.xml

                 </dependency>
             </dependencies>
                 <configuration>
+                 <systemProperties>
+                      <systemProperty>
+                         <name>encuestame.custom.config</name>
+                         <value>${project.build.directory}/test-classes/encuestame-config-custom.properties</value>
+                     </systemProperty>
+                  </systemProperties>
                     <connectors>
                         <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
                              <port>${jetty.default.port}</port>
         </dependency>
         <dependency>
             <groupId>org.hibernate</groupId>
-            <artifactId>hibernate-annotations</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.hibernate</groupId>
             <artifactId>hibernate-core</artifactId>
         </dependency>
         <dependency>
         <org.slf4j-version>1.6.1</org.slf4j-version>
 
         <!-- Hibernate Version -->
-        <hibernate.version>3.5.6-Final</hibernate.version>
+        <hibernate.version>3.6.0.Final</hibernate.version>
         <hibernate.commons.annotations.version>3.2.0.Final</hibernate.commons.annotations.version>
-        <hibernate.search.version>3.2.1.Final</hibernate.search.version>
-        <lucene.version>2.9.3</lucene.version>
+        <hibernate.search.version>3.3.0.Final</hibernate.search.version>
+	<hibernate.validator>4.0.2.GA</hibernate.validator>
+
+        <!-- Lucene Version -->
+	<lucene.version>3.0.3</lucene.version>
 
         <!-- Twitter4J Version -->
         <twitter4j.version>2.1.9</twitter4j.version>
             <url>https://maven2-repository.dev.java.net/nonav/repository</url>
         </repository>
         <repository>
-            <id>ibiblio</id>
-            <url>http://www.ibiblio.org/maven2</url>
-        </repository>
-        <repository>
             <id>taneshanet</id>
             <url>http://tanesha.net/maven2</url>
         </repository>
             </dependency>
             <dependency>
                 <groupId>org.hibernate</groupId>
-                <artifactId>hibernate-annotations</artifactId>
-                <version>3.5.6-Final</version>
-                <exclusions>
-                    <exclusion>
-                        <artifactId>hibernate</artifactId>
-                        <groupId>org.hibernate</groupId>
-                    </exclusion>
-                </exclusions>
-            </dependency>
-            <dependency>
-                <groupId>org.hibernate</groupId>
                 <artifactId>hibernate-entitymanager</artifactId>
                 <version>${hibernate.version}</version>
             </dependency>
             <dependency>
                 <groupId>org.hibernate</groupId>
                 <artifactId>hibernate-validator</artifactId>
-                <version>4.0.2.GA</version>
+                <version>${hibernate.validator}</version>
                 <exclusions>
                     <exclusion>
                         <groupId>com.sun.xml.bind</groupId>