[kune-commits] r1867 - in trunk: . src/main/java/cc/kune/core/server/content src/main/java/cc/kune/core/server/manager/impl src/main/java/cc/kune/domain src/main/resources/META-INF src/test/java/cc/kune/core/server src/test/java/cc/kune/core/server/manager
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Sun May 6 20:48:07 CEST 2012
Author: vjrj_
Date: 2012-05-06 20:48:06 +0200 (Sun, 06 May 2012)
New Revision: 1867
Modified:
trunk/.classpath
trunk/INSTALL
trunk/pom.xml
trunk/src/main/java/cc/kune/core/server/content/ContainerManagerDefault.java
trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java
trunk/src/main/java/cc/kune/core/server/manager/impl/DefaultManager.java
trunk/src/main/java/cc/kune/core/server/manager/impl/GroupManagerDefault.java
trunk/src/main/java/cc/kune/core/server/manager/impl/UserManagerDefault.java
trunk/src/main/java/cc/kune/domain/Group.java
trunk/src/main/java/cc/kune/domain/ToolConfiguration.java
trunk/src/main/java/cc/kune/domain/User.java
trunk/src/main/resources/META-INF/persistence.xml
trunk/src/test/java/cc/kune/core/server/TestConstants.java
trunk/src/test/java/cc/kune/core/server/manager/GroupManagerDefaultTest.java
trunk/src/test/java/cc/kune/core/server/manager/UserManagerDefaultTest.java
Log:
NEW - # 268: Hibernate 4 migration
http://kune.ourproject.org/issues/ticket/268
Modified: trunk/.classpath
===================================================================
--- trunk/.classpath 2012-05-06 02:14:43 UTC (rev 1866)
+++ trunk/.classpath 2012-05-06 18:48:06 UTC (rev 1867)
@@ -87,17 +87,17 @@
<classpathentry kind="var" path="M2_REPO/com/h2database/h2/1.0.20070617/h2-1.0.20070617.jar"/>
<classpathentry kind="var" path="M2_REPO/com/calclab/emite/hablar/r1697/hablar-r1697.jar"/>
<classpathentry kind="var" path="M2_REPO/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar" sourcepath="M2_REPO/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-c3p0/4.1.1.Final/hibernate-c3p0-4.1.1.Final.jar" sourcepath="M2_REPO/org/hibernate/hibernate-c3p0/4.1.1.Final/hibernate-c3p0-4.1.1.Final-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-c3p0/4.1.2.Final/hibernate-c3p0-4.1.2.Final.jar" sourcepath="M2_REPO/org/hibernate/hibernate-c3p0/4.1.2.Final/hibernate-c3p0-4.1.2.Final-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/hibernate/common/hibernate-commons-annotations/4.0.1.Final/hibernate-commons-annotations-4.0.1.Final.jar" sourcepath="M2_REPO/org/hibernate/common/hibernate-commons-annotations/4.0.1.Final/hibernate-commons-annotations-4.0.1.Final-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-core/4.1.1.Final/hibernate-core-4.1.1.Final.jar" sourcepath="M2_REPO/org/hibernate/hibernate-core/4.1.1.Final/hibernate-core-4.1.1.Final-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-entitymanager/4.1.1.Final/hibernate-entitymanager-4.1.1.Final.jar" sourcepath="M2_REPO/org/hibernate/hibernate-entitymanager/4.1.1.Final/hibernate-entitymanager-4.1.1.Final-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-core/4.1.2.Final/hibernate-core-4.1.2.Final.jar" sourcepath="M2_REPO/org/hibernate/hibernate-core/4.1.2.Final/hibernate-core-4.1.2.Final-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-entitymanager/4.1.2.Final/hibernate-entitymanager-4.1.2.Final.jar" sourcepath="M2_REPO/org/hibernate/hibernate-entitymanager/4.1.2.Final/hibernate-entitymanager-4.1.2.Final-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/hibernate/javax/persistence/hibernate-jpa-2.0-api/1.0.1.Final/hibernate-jpa-2.0-api-1.0.1.Final.jar" sourcepath="M2_REPO/org/hibernate/javax/persistence/hibernate-jpa-2.0-api/1.0.1.Final/hibernate-jpa-2.0-api-1.0.1.Final-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-search/4.1.0.Final/hibernate-search-4.1.0.Final.jar"/>
<classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-search-analyzers/4.1.0.Final/hibernate-search-analyzers-4.1.0.Final.jar" sourcepath="M2_REPO/org/hibernate/hibernate-search-analyzers/4.1.0.Final/hibernate-search-analyzers-4.1.0.Final-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-search-engine/4.1.0.Final/hibernate-search-engine-4.1.0.Final.jar" sourcepath="M2_REPO/org/hibernate/hibernate-search-engine/4.1.0.Final/hibernate-search-engine-4.1.0.Final-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-search-orm/4.1.0.Final/hibernate-search-orm-4.1.0.Final.jar" sourcepath="M2_REPO/org/hibernate/hibernate-search-orm/4.1.0.Final/hibernate-search-orm-4.1.0.Final-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-tools/3.2.4.GA/hibernate-tools-3.2.4.GA.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-validator/4.1.0.Final/hibernate-validator-4.1.0.Final.jar" sourcepath="M2_REPO/org/hibernate/hibernate-validator/4.1.0.Final/hibernate-validator-4.1.0.Final-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-validator/4.2.0.Final/hibernate-validator-4.2.0.Final.jar" sourcepath="M2_REPO/org/hibernate/hibernate-validator/4.2.0.Final/hibernate-validator-4.2.0.Final-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/net/sourceforge/htmlunit/htmlunit/2.9/htmlunit-2.9.jar" sourcepath="M2_REPO/net/sourceforge/htmlunit/htmlunit/2.9/htmlunit-2.9-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/net/sourceforge/htmlunit/htmlunit-core-js/2.9/htmlunit-core-js-2.9.jar" sourcepath="M2_REPO/net/sourceforge/htmlunit/htmlunit-core-js/2.9/htmlunit-core-js-2.9-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/httpcomponents/httpclient/4.1.2/httpclient-4.1.2.jar" sourcepath="M2_REPO/org/apache/httpcomponents/httpclient/4.1.2/httpclient-4.1.2-sources.jar"/>
@@ -241,7 +241,7 @@
<classpathentry kind="var" path="M2_REPO/org/waveprotocol/waveinabox-server-0.3/0.3.15/waveinabox-server-0.3-0.3.15.jar"/>
<classpathentry kind="var" path="M2_REPO/xalan/xalan/2.7.1/xalan-2.7.1.jar" sourcepath="M2_REPO/xalan/xalan/2.7.1/xalan-2.7.1-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar" sourcepath="M2_REPO/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/1.3.04/xml-apis-1.3.04.jar" sourcepath="M2_REPO/xml-apis/xml-apis/1.3.04/xml-apis-1.3.04-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/de/zeigermann/xml/xml-im-exporter/1.1/xml-im-exporter-1.1.jar"/>
<classpathentry kind="var" path="M2_REPO/xpp3/xpp3_min/1.1.3.4.O/xpp3_min-1.1.3.4.O.jar"/>
<classpathentry kind="var" path="M2_REPO/com/thoughtworks/xstream/xstream/1.2.2/xstream-1.2.2.jar" sourcepath="M2_REPO/com/thoughtworks/xstream/xstream/1.2.2/xstream-1.2.2-sources.jar"/>
Modified: trunk/INSTALL
===================================================================
--- trunk/INSTALL 2012-05-06 02:14:43 UTC (rev 1866)
+++ trunk/INSTALL 2012-05-06 18:48:06 UTC (rev 1867)
@@ -136,8 +136,12 @@
===Initialize the kune database===
-mysql -p -u kune < src/main/resources/db/kune_initialize.sql
+Choose the one you will use (the first for development or the last for production):
+mysql -p -u kune kune_test < src/main/resources/db/kune_initialize.sql
+mysql -p -u kune kune_dev < src/main/resources/db/kune_initialize.sql
+mysql -p -u kune kune_prod < src/main/resources/db/kune_initialize.sql
+
(Windows users can use Mysql Browser to execute this SQL: File > Open Script > Select "script\kune_initialize.sql" > Execute).
And if all goes ok, migrate the database:
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-05-06 02:14:43 UTC (rev 1866)
+++ trunk/pom.xml 2012-05-06 18:48:06 UTC (rev 1867)
@@ -315,25 +315,13 @@
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
- <version>4.1.1.Final</version>
+ <version>4.1.2.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
- <version>4.1.0.Final</version>
+ <version>4.2.0.Final</version>
</dependency>
- <!-- <dependency> -->
- <!-- <groupId>org.hibernate</groupId> -->
- <!-- <artifactId>hibernate-annotations</artifactId> -->
- <!-- <version>3.5.6-Final</version> -->
- <!-- </dependency> -->
- <!-- <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-commons-annotations</artifactId>
- <version>3.3.0.ga</version> -->
- <!-- http://stackoverflow.com/questions/882338/hibernate-preinsertevent-getsource-nosuchmethoderror -->
- <!-- <exclusions> <exclusion> <groupId>org.hibernate</groupId> <artifactId>hibernate</artifactId>
- </exclusion> </exclusions> </dependency> -->
- <!-- <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-ehcache</artifactId> -->
- <!-- <version>4.1.1.Final</version> </dependency> -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search</artifactId>
@@ -342,7 +330,7 @@
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
- <version>4.1.1.Final</version>
+ <version>4.1.2.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
@@ -352,7 +340,7 @@
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
- <version>4.1.1.Final</version>
+ <version>4.1.2.Final</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
Modified: trunk/src/main/java/cc/kune/core/server/content/ContainerManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/content/ContainerManagerDefault.java 2012-05-06 02:14:43 UTC (rev 1866)
+++ trunk/src/main/java/cc/kune/core/server/content/ContainerManagerDefault.java 2012-05-06 18:48:06 UTC (rev 1867)
@@ -26,6 +26,7 @@
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.queryParser.MultiFieldQueryParser;
import org.apache.lucene.queryParser.ParseException;
+import org.apache.lucene.queryParser.QueryParser;
import org.apache.lucene.search.Query;
import cc.kune.core.client.errors.AccessViolationException;
@@ -190,7 +191,7 @@
new String[] { "name" }, new StandardAnalyzer(LUCENE_VERSION));
Query query;
try {
- query = parser.parse(search);
+ query = parser.parse(QueryParser.escape(search));
} catch (final ParseException e) {
throw new ServerManagerException("Error parsing search");
}
Modified: trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java 2012-05-06 02:14:43 UTC (rev 1866)
+++ trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java 2012-05-06 18:48:06 UTC (rev 1867)
@@ -36,6 +36,7 @@
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.queryParser.MultiFieldQueryParser;
import org.apache.lucene.queryParser.ParseException;
+import org.apache.lucene.queryParser.QueryParser;
import org.apache.lucene.search.Query;
import org.waveprotocol.wave.model.waveref.InvalidWaveRefException;
import org.waveprotocol.wave.model.waveref.WaveRef;
@@ -449,7 +450,7 @@
final MultiFieldQueryParser parser = createMultiFieldParser();
Query query;
try {
- query = parser.parse(search);
+ query = parser.parse(QueryParser.escape(search));
} catch (final ParseException e) {
throw new ServerManagerException("Error parsing search");
}
Modified: trunk/src/main/java/cc/kune/core/server/manager/impl/DefaultManager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/impl/DefaultManager.java 2012-05-06 02:14:43 UTC (rev 1866)
+++ trunk/src/main/java/cc/kune/core/server/manager/impl/DefaultManager.java 2012-05-06 18:48:06 UTC (rev 1867)
@@ -40,6 +40,8 @@
import com.google.inject.Provider;
public abstract class DefaultManager<T, K> {
+ // FIXME: revise this
+ private static final int BATCH_SIZE = 50;
protected final static Version LUCENE_VERSION = Version.LUCENE_35;
private final Class<T> entityClass;
protected final Log log;
@@ -92,19 +94,38 @@
return persist(entity, entityClass);
}
- @SuppressWarnings("unchecked")
public void reIndex() {
- // Inject this?
- final FullTextEntityManager fullTextEm = Search.getFullTextEntityManager(getEntityManager());
- fullTextEm.purgeAll(entityClass);
- fullTextEm.getTransaction().commit();
- fullTextEm.getTransaction().begin();
- final List<T> entities = fullTextEm.createQuery(
- "SELECT e FROM " + entityClass.getSimpleName() + " AS e").getResultList();
- for (final T e : entities) {
- fullTextEm.index(e);
+ // http://docs.jboss.org/hibernate/search/4.1/reference/en-US/html_single/#search-batchindex
+ final FullTextEntityManager fullTextEm = Search.getFullTextEntityManager(getEntityManager().getEntityManagerFactory().createEntityManager());
+ try {
+ fullTextEm.createIndexer().startAndWait();
+ } catch (final InterruptedException e) {
+ throw new ServerManagerException("Error reindexing", e);
}
- fullTextEm.getSearchFactory().optimize(entityClass);
+
+ // final Session fullTextSession = (org.hibernate.Session)
+ // fullTextEm.getDelegate();
+ // fullTextSession.setFlushMode(FlushMode.AUTO);
+ // fullTextSession.setCacheMode(CacheMode.IGNORE);
+ // // final Transaction transaction = fullTextSession.beginTransaction();
+ // // Scrollable results will avoid loading too many objects in memory
+ // final ScrollableResults results =
+ // fullTextSession.createCriteria(entityClass).setFetchSize(
+ // BATCH_SIZE).scroll(ScrollMode.FORWARD_ONLY);
+ // int index = 0;
+ // while (results.next()) {
+ // index++;
+ //
+ // fullTextEm.index(results.get(0)); // index each element
+ // if (index % BATCH_SIZE == 0) {
+ // // fullTextSession.flushToIndexes(); //apply changes to indexes
+ // fullTextSession.flush(); // apply changes to indexes
+ // fullTextSession.clear(); // free memory since the queue is processed
+ // }
+ // }
+ // http://stackoverflow.com/questions/10248598/clearing-locks-between-junit-tests-in-hibernate-search-4-1
+ // transaction.commit();
+ fullTextEm.close();
}
public void remove(final T entity) {
@@ -117,13 +138,15 @@
@SuppressWarnings("unchecked")
public SearchResult<T> search(final Query query, final Integer firstResult, final Integer maxResults) {
- final FullTextQuery emQuery = Search.getFullTextEntityManager(getEntityManager()).createFullTextQuery(
- query, entityClass);
+ final FullTextEntityManager fullTextEm = Search.getFullTextEntityManager(getEntityManager().getEntityManagerFactory().createEntityManager());
+ final FullTextQuery emQuery = fullTextEm.createFullTextQuery(query, entityClass);
if (firstResult != null && maxResults != null) {
emQuery.setFirstResult(firstResult);
emQuery.setMaxResults(maxResults);
}
- return new SearchResult<T>(emQuery.getResultSize(), emQuery.getResultList());
+ final SearchResult<T> searchResult = new SearchResult<T>(emQuery.getResultSize(),
+ emQuery.getResultList());
+ return searchResult;
}
public SearchResult<T> search(final String query, final String[] fields,
Modified: trunk/src/main/java/cc/kune/core/server/manager/impl/GroupManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/impl/GroupManagerDefault.java 2012-05-06 02:14:43 UTC (rev 1866)
+++ trunk/src/main/java/cc/kune/core/server/manager/impl/GroupManagerDefault.java 2012-05-06 18:48:06 UTC (rev 1867)
@@ -29,6 +29,7 @@
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.queryParser.MultiFieldQueryParser;
import org.apache.lucene.queryParser.ParseException;
+import org.apache.lucene.queryParser.QueryParser;
import org.apache.lucene.search.Query;
import org.hibernate.exception.ConstraintViolationException;
@@ -306,7 +307,7 @@
"longName", "shortName", "publicDesc" }, new StandardAnalyzer(LUCENE_VERSION));
Query query;
try {
- query = parser.parse(search + SearcherConstants.WILDCARD);
+ query = parser.parse(QueryParser.escape(search) + SearcherConstants.WILDCARD);
} catch (final ParseException e) {
throw new ServerManagerException("Error parsing search");
}
Modified: trunk/src/main/java/cc/kune/core/server/manager/impl/UserManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/impl/UserManagerDefault.java 2012-05-06 02:14:43 UTC (rev 1866)
+++ trunk/src/main/java/cc/kune/core/server/manager/impl/UserManagerDefault.java 2012-05-06 18:48:06 UTC (rev 1867)
@@ -35,6 +35,7 @@
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.queryParser.MultiFieldQueryParser;
import org.apache.lucene.queryParser.ParseException;
+import org.apache.lucene.queryParser.QueryParser;
import org.apache.lucene.search.Query;
import org.waveprotocol.box.server.account.AccountData;
import org.waveprotocol.box.server.authentication.PasswordDigest;
@@ -427,7 +428,7 @@
"name", "shortName" }, new StandardAnalyzer(LUCENE_VERSION));
Query query;
try {
- query = parser.parse(search);
+ query = parser.parse(QueryParser.escape(search));
} catch (final ParseException e) {
throw new ServerManagerException("Error parsing search", e);
}
Modified: trunk/src/main/java/cc/kune/domain/Group.java
===================================================================
--- trunk/src/main/java/cc/kune/domain/Group.java 2012-05-06 02:14:43 UTC (rev 1866)
+++ trunk/src/main/java/cc/kune/domain/Group.java 2012-05-06 18:48:06 UTC (rev 1867)
@@ -32,6 +32,7 @@
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Lob;
+import javax.persistence.MapKeyColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
@@ -106,6 +107,7 @@
@OneToOne(cascade = CascadeType.ALL)
private SocialNetwork socialNetwork;
+ @MapKeyColumn(name = "mapkey")
@OneToMany
private final Map<String, ToolConfiguration> toolsConfig;
Modified: trunk/src/main/java/cc/kune/domain/ToolConfiguration.java
===================================================================
--- trunk/src/main/java/cc/kune/domain/ToolConfiguration.java 2012-05-06 02:14:43 UTC (rev 1866)
+++ trunk/src/main/java/cc/kune/domain/ToolConfiguration.java 2012-05-06 18:48:06 UTC (rev 1867)
@@ -30,41 +30,41 @@
@Table(name = "tool_configurations")
public class ToolConfiguration {
- @Id
- @GeneratedValue
- private Long id;
- private boolean enabled;
+ private boolean enabled;
+ @Id
+ @GeneratedValue
+ private Long id;
- @OneToOne(cascade = { CascadeType.MERGE, CascadeType.PERSIST })
- private Container root;
+ @OneToOne(cascade = { CascadeType.MERGE, CascadeType.PERSIST })
+ private Container root;
- public ToolConfiguration() {
- enabled = true;
- }
+ public ToolConfiguration() {
+ enabled = true;
+ }
- public Long getId() {
- return id;
- }
+ public Long getId() {
+ return id;
+ }
- public Container getRoot() {
- return root;
- }
+ public Container getRoot() {
+ return root;
+ }
- public boolean isEnabled() {
- return enabled;
- }
+ public boolean isEnabled() {
+ return enabled;
+ }
- public void setEnabled(final boolean enabled) {
- this.enabled = enabled;
- }
+ public void setEnabled(final boolean enabled) {
+ this.enabled = enabled;
+ }
- public void setId(final Long id) {
- this.id = id;
- }
+ public void setId(final Long id) {
+ this.id = id;
+ }
- public Container setRoot(final Container root) {
- this.root = root;
- return root;
- }
+ public Container setRoot(final Container root) {
+ this.root = root;
+ return root;
+ }
}
Modified: trunk/src/main/java/cc/kune/domain/User.java
===================================================================
--- trunk/src/main/java/cc/kune/domain/User.java 2012-05-06 02:14:43 UTC (rev 1866)
+++ trunk/src/main/java/cc/kune/domain/User.java 2012-05-06 18:48:06 UTC (rev 1867)
@@ -37,6 +37,7 @@
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
+import org.hibernate.search.annotations.Analyze;
import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Index;
@@ -109,7 +110,7 @@
@Basic
private Long lastLogin;
- @Field(index = Index.YES, store = Store.NO)
+ @Field(index = Index.YES, analyze = Analyze.YES, store = Store.NO)
@Column(nullable = false, unique = true)
@Length(min = 3, max = 50)
private String name;
@@ -119,7 +120,7 @@
@Column(nullable = false)
private byte[] salt;
- @Field(index = Index.YES, store = Store.NO)
+ @Field(index = Index.YES, analyze = Analyze.YES, store = Store.NO)
@Column(unique = true)
// http://www.hibernate.org/hib_docs/validator/reference/en/html/validator-defineconstraints.html
@Length(min = 3, max = 15)
Modified: trunk/src/main/resources/META-INF/persistence.xml
===================================================================
--- trunk/src/main/resources/META-INF/persistence.xml 2012-05-06 02:14:43 UTC (rev 1866)
+++ trunk/src/main/resources/META-INF/persistence.xml 2012-05-06 18:48:06 UTC (rev 1867)
@@ -66,6 +66,8 @@
value="filesystem"/>
<property name="hibernate.search.default.indexBase"
value="/var/lib/kune/lucene/kune_dev/indexes"/>
+ <property name="hibernate.search.default.exclusive_index_use"
+ value="false"/>
</properties>
</persistence-unit>
@@ -166,6 +168,8 @@
value="filesystem"/>
<property name="hibernate.search.default.indexBase"
value="kune-data/lucene/kune_dev/indexes"/>
+ <property name="hibernate.search.default.exclusive_index_use"
+ value="false"/>
</properties>
</persistence-unit>
@@ -211,7 +215,6 @@
<!-- Configured and overrided by kune.properties -->
<property name="hibernate.connection.password" value="db4kune"/>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
- <!-- <property name="hibernate.hbm2ddl.auto" value="create" /> -->
<property name="hibernate.connection.provider_class"
value="org.hibernate.connection.C3P0ConnectionProvider"/>
<property name="hibernate.c3p0.min_size" value="5"/>
@@ -224,6 +227,8 @@
value="filesystem"/>
<property name="hibernate.search.default.indexBase"
value="kune-data/lucene/kune_test/indexes"/>
+ <property name="hibernate.search.default.exclusive_index_use"
+ value="false"/>
</properties>
</persistence-unit>
@@ -258,16 +263,19 @@
<property name="hibernate.show_sql" value="false"/>
<property name="hibernate.format_sql" value="false"/>
<property name="use_sql_comments" value="false"/>
+ <!-- Workaround for errors "Table FOO not found." https://hibernate.onjira.com/browse/HHH-7002 -->
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
- <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+ <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.connection.driver_class" value="org.h2.Driver"/>
<property name="hibernate.connection.username" value="sa"/>
<property name="hibernate.connection.password" value=""/>
<property name="hibernate.connection.url" value="jdbc:h2:mem:testdb"/>
<property name="hibernate.search.default.directory_provider"
- value="filesystem"/> <!-- change to "ram" later -->
- <property name="hibernate.search.default.indexBase"
- value="kune-data/lucene/kune_test/indexes"/>
+ value="ram"/>
+ <!-- <property name="hibernate.search.default.indexBase" -->
+ <!-- value="kune-data/lucene/kune_test/indexes"/> -->
+ <property name="hibernate.search.default.exclusive_index_use"
+ value="false"/>
</properties>
</persistence-unit>
Modified: trunk/src/test/java/cc/kune/core/server/TestConstants.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/TestConstants.java 2012-05-06 02:14:43 UTC (rev 1866)
+++ trunk/src/test/java/cc/kune/core/server/TestConstants.java 2012-05-06 18:48:06 UTC (rev 1867)
@@ -24,6 +24,7 @@
// test: use memory
// test_db: use mysql
// public static final String PERSISTENCE_UNIT = "test_db";
+ // FIXME: for some reason with test_db now the database is not initialized
public static final String PERSISTENCE_UNIT = "test";
public static final String WAVE_TEST_PROPFILE = "wave-server-testing.properties";
Modified: trunk/src/test/java/cc/kune/core/server/manager/GroupManagerDefaultTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/manager/GroupManagerDefaultTest.java 2012-05-06 02:14:43 UTC (rev 1866)
+++ trunk/src/test/java/cc/kune/core/server/manager/GroupManagerDefaultTest.java 2012-05-06 18:48:06 UTC (rev 1867)
@@ -73,6 +73,7 @@
final Group group = new Group("ysei", "Yellow Submarine Environmental Initiative", defLicense,
GroupType.PROJECT);
groupManager.createGroup(group, user, PUBLIC_DESCRIP);
+ closeTransaction();
groupManager.reIndex();
final SearchResult<Group> result = groupManager.search("ysei");
assertEquals(1, result.getSize());
@@ -180,6 +181,7 @@
for (int i = 1; i < 10; i++) {
createTestGroup(i);
}
+ closeTransaction();
groupManager.reIndex();
final SearchResult<Group> result = groupManager.search("Yellow", 0, 5);
assertEquals(9, result.getSize());
Modified: trunk/src/test/java/cc/kune/core/server/manager/UserManagerDefaultTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/manager/UserManagerDefaultTest.java 2012-05-06 02:14:43 UTC (rev 1866)
+++ trunk/src/test/java/cc/kune/core/server/manager/UserManagerDefaultTest.java 2012-05-06 18:48:06 UTC (rev 1867)
@@ -110,6 +110,7 @@
@Test
public void userSearch() throws Exception, ParseException {
+ closeTransaction();
userManager.reIndex();
final SearchResult<User> result = userManager.search(USER_SHORT_NAME);
assertEquals(1, result.getSize());
More information about the kune-commits
mailing list