Hibernate SVN: r11644 - in trunk/Hibernate3/code: core/src/main/java/org/hibernate/event/def and 3 other directories.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2007-06-06 17:33:10 -0400 (Wed, 06 Jun 2007)
New Revision: 11644
Added:
trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/NaturalIdSuite.java
trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/immutable/
trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/immutable/ImmutableNaturalIdTest.java
trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/immutable/User.hbm.xml
trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/immutable/User.java
trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/mutable/
trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/mutable/MutableNaturalIdTest.java
trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/mutable/User.hbm.xml
trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/mutable/User.java
Removed:
trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/User.hbm.xml
trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/User.java
Modified:
trunk/Hibernate3/code/core/src/main/java/org/hibernate/engine/PersistenceContext.java
trunk/Hibernate3/code/core/src/main/java/org/hibernate/event/def/DefaultFlushEntityEventListener.java
Log:
HHH-1569 : natural-id checks
Modified: trunk/Hibernate3/code/core/src/main/java/org/hibernate/engine/PersistenceContext.java
===================================================================
--- trunk/Hibernate3/code/core/src/main/java/org/hibernate/engine/PersistenceContext.java 2007-06-06 19:59:19 UTC (rev 11643)
+++ trunk/Hibernate3/code/core/src/main/java/org/hibernate/engine/PersistenceContext.java 2007-06-06 21:33:10 UTC (rev 11644)
@@ -83,8 +83,13 @@
public Object[] getCachedDatabaseSnapshot(EntityKey key);
+ /**
+ * Get the values of the natural id fields as known to the underlying
+ * database, or null if the entity has no natural id or there is no
+ * corresponding row.
+ */
public Object[] getNaturalIdSnapshot(Serializable id, EntityPersister persister)
- throws HibernateException;
+ throws HibernateException;
/**
* Add a canonical mapping from entity key to entity instance
@@ -437,4 +442,4 @@
public void setReadOnly(Object entity, boolean readOnly);
void replaceDelayedEntityIdentityInsertKeys(EntityKey oldKey, Serializable generatedId);
-}
\ No newline at end of file
+}
Modified: trunk/Hibernate3/code/core/src/main/java/org/hibernate/event/def/DefaultFlushEntityEventListener.java
===================================================================
--- trunk/Hibernate3/code/core/src/main/java/org/hibernate/event/def/DefaultFlushEntityEventListener.java 2007-06-06 19:59:19 UTC (rev 11643)
+++ trunk/Hibernate3/code/core/src/main/java/org/hibernate/event/def/DefaultFlushEntityEventListener.java 2007-06-06 21:33:10 UTC (rev 11644)
@@ -74,16 +74,23 @@
EntityMode entityMode,
SessionImplementor session) {
if ( persister.hasNaturalIdentifier() ) {
- if ( loaded == null ) {
- loaded = session.getPersistenceContext().getNaturalIdSnapshot( identifier, persister );
- }
+ Object[] snapshot = null;
Type[] types = persister.getPropertyTypes();
int[] props = persister.getNaturalIdentifierProperties();
boolean[] updateable = persister.getPropertyUpdateability();
for ( int i=0; i<props.length; i++ ) {
int prop = props[i];
if ( !updateable[prop] ) {
- if ( !types[prop].isEqual( current[prop], loaded[prop], entityMode ) ) {
+ Object loadedVal;
+ if ( loaded == null ) {
+ if ( snapshot == null) {
+ snapshot = session.getPersistenceContext().getNaturalIdSnapshot( identifier, persister );
+ }
+ loadedVal = snapshot[i];
+ } else {
+ loadedVal = loaded[prop];
+ }
+ if ( !types[prop].isEqual( current[prop], loadedVal, entityMode ) ) {
throw new HibernateException(
"immutable natural identifier of an instance of " +
persister.getEntityName() +
Added: trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/NaturalIdSuite.java
===================================================================
--- trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/NaturalIdSuite.java (rev 0)
+++ trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/NaturalIdSuite.java 2007-06-06 21:33:10 UTC (rev 11644)
@@ -0,0 +1,21 @@
+package org.hibernate.test.naturalid;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.hibernate.test.naturalid.immutable.ImmutableNaturalIdTest;
+import org.hibernate.test.naturalid.mutable.MutableNaturalIdTest;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public class NaturalIdSuite {
+ public static Test suite() {
+ TestSuite suite = new TestSuite( "natural ids" );
+ suite.addTest( MutableNaturalIdTest.suite() );
+ suite.addTest( ImmutableNaturalIdTest.suite() );
+ return suite;
+ }
+}
Deleted: trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/User.hbm.xml
===================================================================
--- trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/User.hbm.xml 2007-06-06 19:59:19 UTC (rev 11643)
+++ trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/User.hbm.xml 2007-06-06 21:33:10 UTC (rev 11644)
@@ -1,27 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-
-<!--
-
- This mapping illustrates use of <natural-id>.
-
--->
-
-<hibernate-mapping
- package="org.hibernate.test.naturalid"
- default-access="field">
-
- <class name="User" table="SystemUserInfo">
- <id name="id">
- <generator class="increment"/>
- </id>
- <natural-id>
- <property name="name"/>
- <property name="org"/>
- </natural-id>
- <property name="password"/>
- </class>
-
-</hibernate-mapping>
\ No newline at end of file
Deleted: trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/User.java
===================================================================
--- trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/User.java 2007-06-06 19:59:19 UTC (rev 11643)
+++ trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/User.java 2007-06-06 21:33:10 UTC (rev 11644)
@@ -1,34 +0,0 @@
-//$Id: User.java 6900 2005-05-25 01:24:22Z oneovthafew $
-package org.hibernate.test.naturalid;
-
-/**
- * @author Gavin King
- */
-public class User {
-
- private Long id;
- private String name;
- private String org;
- private String password;
-
- User() {}
-
- public User(String name, String org, String password) {
- this.name = name;
- this.org = org;
- this.password = password;
- }
-
- public String getName() {
- return name;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
- public String getOrg() {
- return org;
- }
-
-}
Added: trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/immutable/ImmutableNaturalIdTest.java
===================================================================
--- trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/immutable/ImmutableNaturalIdTest.java (rev 0)
+++ trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/immutable/ImmutableNaturalIdTest.java 2007-06-06 21:33:10 UTC (rev 11644)
@@ -0,0 +1,57 @@
+package org.hibernate.test.naturalid.immutable;
+
+import junit.framework.Test;
+
+import org.hibernate.Session;
+import org.hibernate.junit.functional.FunctionalTestCase;
+import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public class ImmutableNaturalIdTest extends FunctionalTestCase {
+ public ImmutableNaturalIdTest(String string) {
+ super( string );
+ }
+
+ public String[] getMappings() {
+ return new String[] { "naturalid/immutable/User.hbm.xml" };
+ }
+
+ public static Test suite() {
+ return new FunctionalTestClassTestSuite( ImmutableNaturalIdTest.class );
+ }
+
+ public void testUpdate() {
+ // prepare some test data...
+ Session session = openSession();
+ session.beginTransaction();
+ User user = new User();
+ user.setUserName( "steve" );
+ user.setEmail( "steve(a)hibernate.org" );
+ user.setFirstName( "Steve" );
+ user.setInitial( null);
+ user.setLastName( "Ebersole" );
+ user.setPassword( "brewhaha" );
+ session.save( user );
+ session.getTransaction().commit();
+ session.close();
+
+ // 'user' is now a detached entity, so lets change a property and reattch...
+ user.setPassword( "homebrew" );
+ session = openSession();
+ session.beginTransaction();
+ session.update( user );
+ session.getTransaction().commit();
+ session.close();
+
+ // clean up
+ session = openSession();
+ session.beginTransaction();
+ session.delete( user );
+ session.getTransaction().commit();
+ session.close();
+ }
+}
Added: trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/immutable/User.hbm.xml
===================================================================
--- trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/immutable/User.hbm.xml (rev 0)
+++ trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/immutable/User.hbm.xml 2007-06-06 21:33:10 UTC (rev 11644)
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="org.hibernate.test.naturalid.immutable">
+
+ <class name="User" table="IMM_NAT_ID_USER" lazy="true">
+ <comment>Users may bid for or sell auction items.</comment>
+ <id name="myUserId" type="java.lang.Integer">
+ <generator class="increment"/>
+ </id>
+ <natural-id mutable="false">
+ <property name="userName" length="10"/>
+ </natural-id>
+ <version name="version"/>
+ <property name="password" not-null="true" length="15" column="`password`"/>
+ <property name="email"/>
+ <property name="firstName" length="50" not-null="true"/>
+ <property name="initial" column="`initial`"/>
+ <property name="lastName" length="50" not-null="true"/>
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Added: trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/immutable/User.java
===================================================================
--- trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/immutable/User.java (rev 0)
+++ trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/immutable/User.java 2007-06-06 21:33:10 UTC (rev 11644)
@@ -0,0 +1,86 @@
+package org.hibernate.test.naturalid.immutable;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public class User implements java.io.Serializable {
+
+ private Integer myUserId;
+ private Integer version;
+ private String userName;
+ private String password;
+ private String email;
+ private String firstName;
+ private Character initial;
+ private String lastName;
+
+ public User() {
+ }
+
+ public Integer getMyUserId() {
+ return this.myUserId;
+ }
+
+ public void setMyUserId(Integer myUserId) {
+ this.myUserId = myUserId;
+ }
+
+ public String getUserName() {
+ return this.userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ public String getPassword() {
+ return this.password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public String getEmail() {
+ return this.email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public String getFirstName() {
+ return this.firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public Character getInitial() {
+ return this.initial;
+ }
+
+ public void setInitial(Character initial) {
+ this.initial = initial;
+ }
+
+ public String getLastName() {
+ return this.lastName;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ public Integer getVersion() {
+ return this.version;
+ }
+
+ public void setVersion(Integer version) {
+ this.version = version;
+ }
+
+}
Copied: trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/mutable/MutableNaturalIdTest.java (from rev 11592, trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/NaturalIdTest.java)
===================================================================
--- trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/mutable/MutableNaturalIdTest.java (rev 0)
+++ trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/mutable/MutableNaturalIdTest.java 2007-06-06 21:33:10 UTC (rev 11644)
@@ -0,0 +1,249 @@
+//$Id: MutableNaturalIdTest.java 10977 2006-12-12 23:28:04Z steve.ebersole(a)jboss.com $
+package org.hibernate.test.naturalid.mutable;
+
+import java.lang.reflect.Field;
+
+import junit.framework.Test;
+
+import org.hibernate.HibernateException;
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+import org.hibernate.test.naturalid.mutable.User;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Environment;
+import org.hibernate.criterion.Restrictions;
+import org.hibernate.junit.functional.FunctionalTestCase;
+import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
+
+/**
+ * @author Gavin King
+ */
+public class MutableNaturalIdTest extends FunctionalTestCase {
+
+ public MutableNaturalIdTest(String str) {
+ super(str);
+ }
+
+ public String[] getMappings() {
+ return new String[] { "naturalid/mutable/User.hbm.xml" };
+ }
+
+ public void configure(Configuration cfg) {
+ cfg.setProperty(Environment.USE_SECOND_LEVEL_CACHE, "true");
+ cfg.setProperty(Environment.USE_QUERY_CACHE, "true");
+ cfg.setProperty(Environment.GENERATE_STATISTICS, "true");
+ }
+
+ public static Test suite() {
+ return new FunctionalTestClassTestSuite( MutableNaturalIdTest.class );
+ }
+
+ public void testNaturalIdCheck() throws Exception {
+ Session s = openSession();
+ Transaction t = s.beginTransaction();
+
+ User u = new User("gavin", "hb", "secret");
+ s.persist(u);
+ Field name = u.getClass().getDeclaredField("name");
+ name.setAccessible(true);
+ name.set(u, "Gavin");
+ try {
+ s.flush();
+ fail();
+ }
+ catch (HibernateException he) {}
+ name.set(u, "gavin");
+ s.delete(u);
+ t.commit();
+ s.close();
+ }
+
+ public void testNonexistentNaturalIdCache() {
+ getSessions().getStatistics().clear();
+
+ Session s = openSession();
+ Transaction t = s.beginTransaction();
+
+ Object nullUser = s.createCriteria(User.class)
+ .add( Restrictions.naturalId()
+ .set("name", "gavin")
+ .set("org", "hb")
+ )
+ .setCacheable(true)
+ .uniqueResult();
+
+ assertNull(nullUser);
+
+ t.commit();
+ s.close();
+
+ assertEquals( getSessions().getStatistics().getQueryExecutionCount(), 1 );
+ assertEquals( getSessions().getStatistics().getQueryCacheHitCount(), 0 );
+ assertEquals( getSessions().getStatistics().getQueryCachePutCount(), 0 );
+
+ s = openSession();
+ t = s.beginTransaction();
+
+ User u = new User("gavin", "hb", "secret");
+ s.persist(u);
+
+ t.commit();
+ s.close();
+
+ getSessions().getStatistics().clear();
+
+ s = openSession();
+ t = s.beginTransaction();
+
+ u = (User) s.createCriteria(User.class)
+ .add( Restrictions.naturalId()
+ .set("name", "gavin")
+ .set("org", "hb")
+ )
+ .setCacheable(true)
+ .uniqueResult();
+
+ assertNotNull(u);
+
+ t.commit();
+ s.close();
+
+ assertEquals( getSessions().getStatistics().getQueryExecutionCount(), 1 );
+ assertEquals( getSessions().getStatistics().getQueryCacheHitCount(), 0 );
+ assertEquals( getSessions().getStatistics().getQueryCachePutCount(), 1 );
+
+ getSessions().getStatistics().clear();
+
+ s = openSession();
+ t = s.beginTransaction();
+
+ u = (User) s.createCriteria(User.class)
+ .add( Restrictions.naturalId()
+ .set("name", "gavin")
+ .set("org", "hb")
+ ).setCacheable(true)
+ .uniqueResult();
+
+ s.delete(u);
+
+ t.commit();
+ s.close();
+
+ assertEquals( getSessions().getStatistics().getQueryExecutionCount(), 0 );
+ assertEquals( getSessions().getStatistics().getQueryCacheHitCount(), 1 );
+
+ getSessions().getStatistics().clear();
+
+ s = openSession();
+ t = s.beginTransaction();
+
+ nullUser = s.createCriteria(User.class)
+ .add( Restrictions.naturalId()
+ .set("name", "gavin")
+ .set("org", "hb")
+ )
+ .setCacheable(true)
+ .uniqueResult();
+
+ assertNull(nullUser);
+
+ t.commit();
+ s.close();
+
+ assertEquals( getSessions().getStatistics().getQueryExecutionCount(), 1 );
+ assertEquals( getSessions().getStatistics().getQueryCacheHitCount(), 0 );
+ assertEquals( getSessions().getStatistics().getQueryCachePutCount(), 0 );
+
+ }
+
+ public void testNaturalIdCache() {
+ Session s = openSession();
+ Transaction t = s.beginTransaction();
+
+ User u = new User("gavin", "hb", "secret");
+ s.persist(u);
+
+ t.commit();
+ s.close();
+
+ getSessions().getStatistics().clear();
+
+ s = openSession();
+ t = s.beginTransaction();
+
+ u = (User) s.createCriteria(User.class)
+ .add( Restrictions.naturalId()
+ .set("name", "gavin")
+ .set("org", "hb")
+ )
+ .setCacheable(true)
+ .uniqueResult();
+
+ assertNotNull(u);
+
+ t.commit();
+ s.close();
+
+ assertEquals( getSessions().getStatistics().getQueryExecutionCount(), 1 );
+ assertEquals( getSessions().getStatistics().getQueryCacheHitCount(), 0 );
+ assertEquals( getSessions().getStatistics().getQueryCachePutCount(), 1 );
+
+ s = openSession();
+ t = s.beginTransaction();
+
+ User v = new User("xam", "hb", "foobar");
+ s.persist(v);
+
+ t.commit();
+ s.close();
+
+ getSessions().getStatistics().clear();
+
+ s = openSession();
+ t = s.beginTransaction();
+
+ u = (User) s.createCriteria(User.class)
+ .add( Restrictions.naturalId()
+ .set("name", "gavin")
+ .set("org", "hb")
+ ).setCacheable(true)
+ .uniqueResult();
+
+ assertNotNull(u);
+
+ t.commit();
+ s.close();
+
+ assertEquals( getSessions().getStatistics().getQueryExecutionCount(), 0 );
+ assertEquals( getSessions().getStatistics().getQueryCacheHitCount(), 1 );
+
+ s = openSession();
+ t = s.beginTransaction();
+ s.createQuery("delete User").executeUpdate();
+ t.commit();
+ s.close();
+ }
+
+ public void testQuerying() throws Exception {
+ Session s = openSession();
+ Transaction t = s.beginTransaction();
+
+ User u = new User("emmanuel", "hb", "bh");
+ s.persist(u);
+
+ t.commit();
+ s.close();
+
+ s = openSession();
+ t = s.beginTransaction();
+
+ u = (User) s.createQuery( "from User u where u.name = :name" )
+ .setParameter( "name", "emmanuel" ).uniqueResult();
+ assertEquals( "emmanuel", u.getName() );
+ s.delete( u );
+
+ t.commit();
+ s.close();
+ }
+}
+
Property changes on: trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/mutable/MutableNaturalIdTest.java
___________________________________________________________________
Name: svn:executable
+ *
Copied: trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/mutable/User.hbm.xml (from rev 11592, trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/User.hbm.xml)
===================================================================
--- trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/mutable/User.hbm.xml (rev 0)
+++ trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/mutable/User.hbm.xml 2007-06-06 21:33:10 UTC (rev 11644)
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+
+ This mapping illustrates use of <natural-id>.
+
+-->
+
+<hibernate-mapping
+ package="org.hibernate.test.naturalid"
+ default-access="field">
+
+ <class name="org.hibernate.test.naturalid.mutable.User" table="SystemUserInfo">
+ <id name="id">
+ <generator class="increment"/>
+ </id>
+ <natural-id>
+ <property name="name"/>
+ <property name="org"/>
+ </natural-id>
+ <property name="password"/>
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Property changes on: trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/mutable/User.hbm.xml
___________________________________________________________________
Name: svn:executable
+ *
Copied: trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/mutable/User.java (from rev 11592, trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/User.java)
===================================================================
--- trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/mutable/User.java (rev 0)
+++ trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/mutable/User.java 2007-06-06 21:33:10 UTC (rev 11644)
@@ -0,0 +1,34 @@
+//$Id: User.java 6900 2005-05-25 01:24:22Z oneovthafew $
+package org.hibernate.test.naturalid.mutable;
+
+/**
+ * @author Gavin King
+ */
+public class User {
+
+ private Long id;
+ private String name;
+ private String org;
+ private String password;
+
+ User() {}
+
+ public User(String name, String org, String password) {
+ this.name = name;
+ this.org = org;
+ this.password = password;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public String getOrg() {
+ return org;
+ }
+
+}
Property changes on: trunk/Hibernate3/code/testsuite/src/test/java/org/hibernate/test/naturalid/mutable/User.java
___________________________________________________________________
Name: svn:executable
+ *
18 years, 10 months
Hibernate SVN: r11643 - tags/search_3_0_0_Beta3.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2007-06-06 15:59:19 -0400 (Wed, 06 Jun 2007)
New Revision: 11643
Added:
tags/search_3_0_0_Beta3/HibernateExt/
Log:
tag Search 3.0.0.Beta3
Copied: tags/search_3_0_0_Beta3/HibernateExt (from rev 11642, trunk/HibernateExt)
18 years, 10 months
Hibernate SVN: r11642 - tags.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2007-06-06 15:58:17 -0400 (Wed, 06 Jun 2007)
New Revision: 11642
Added:
tags/search_3_0_0_Beta3/
Log:
create tag for Search 3.0.0.Beta3
18 years, 10 months
Hibernate SVN: r11641 - trunk/Hibernate3/code/eg.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2007-06-06 13:47:49 -0400 (Wed, 06 Jun 2007)
New Revision: 11641
Modified:
trunk/Hibernate3/code/eg/pom.xml
Log:
comment
Modified: trunk/Hibernate3/code/eg/pom.xml
===================================================================
--- trunk/Hibernate3/code/eg/pom.xml 2007-06-06 14:25:29 UTC (rev 11640)
+++ trunk/Hibernate3/code/eg/pom.xml 2007-06-06 17:47:49 UTC (rev 11641)
@@ -1,29 +1,31 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-code</artifactId>
- <version>3.3.0.beta1</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-eg</artifactId>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <!-- todo : this module should eventually make its way over to documentation/tutorial -->
+
+ <parent>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-code</artifactId>
+ <version>3.3.0.beta1</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-eg</artifactId>
<packaging>jar</packaging>
-
- <name>Hibernate Example</name>
- <description>A simple example of Hibernate functionality</description>
-
- <dependencies>
- <dependency>
- <groupId>${groupId}</groupId>
+
+ <name>Hibernate Example</name>
+ <description>A simple example of Hibernate functionality</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>${groupId}</groupId>
<artifactId>hibernate-core</artifactId>
- <version>${hibernate.core.version}</version>
- </dependency>
- </dependencies>
-
+ <version>${hibernate.core.version}</version>
+ </dependency>
+ </dependencies>
+
</project>
18 years, 10 months
Hibernate SVN: r11640 - trunk/HibernateExt/annotations/src/test/org/hibernate/test/annotations/cid.
by hibernate-commits@lists.jboss.org
Author: anthonyHib
Date: 2007-06-06 10:25:29 -0400 (Wed, 06 Jun 2007)
New Revision: 11640
Added:
trunk/HibernateExt/annotations/src/test/org/hibernate/test/annotations/cid/LittleGenius.java
Modified:
trunk/HibernateExt/annotations/src/test/org/hibernate/test/annotations/cid/Child.java
trunk/HibernateExt/annotations/src/test/org/hibernate/test/annotations/cid/CompositeIdTest.java
Log:
new unit test, goal is to test a hierarchy with cid containing a many to one
Modified: trunk/HibernateExt/annotations/src/test/org/hibernate/test/annotations/cid/Child.java
===================================================================
--- trunk/HibernateExt/annotations/src/test/org/hibernate/test/annotations/cid/Child.java 2007-06-06 00:45:49 UTC (rev 11639)
+++ trunk/HibernateExt/annotations/src/test/org/hibernate/test/annotations/cid/Child.java 2007-06-06 14:25:29 UTC (rev 11640)
@@ -5,6 +5,8 @@
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
/**
* Entity having a many to one in its pk
@@ -12,6 +14,7 @@
* @author Emmanuel Bernard
*/
@Entity
+@Inheritance(strategy = InheritanceType.JOINED)
public class Child {
@EmbeddedId
@AttributeOverride(name = "nthChild", column = @Column(name = "nth"))
Modified: trunk/HibernateExt/annotations/src/test/org/hibernate/test/annotations/cid/CompositeIdTest.java
===================================================================
--- trunk/HibernateExt/annotations/src/test/org/hibernate/test/annotations/cid/CompositeIdTest.java 2007-06-06 00:45:49 UTC (rev 11639)
+++ trunk/HibernateExt/annotations/src/test/org/hibernate/test/annotations/cid/CompositeIdTest.java 2007-06-06 14:25:29 UTC (rev 11640)
@@ -24,10 +24,50 @@
}
/**
+ * This feature is not supported by the EJB3
+ * this is an hibernate extension
+ */
+ public void testManyToOneInCompositePk() throws Exception {
+ Session s;
+ Transaction tx;
+ s = openSession();
+ tx = s.beginTransaction();
+ ParentPk ppk = new ParentPk();
+ ppk.setFirstName( "Emmanuel" );
+ ppk.setLastName( "Bernard" );
+ Parent p = new Parent();
+ p.id = ppk;
+ s.persist( p );
+ ChildPk cpk = new ChildPk();
+ cpk.parent = p;
+ cpk.nthChild = 1;
+ Child c = new Child();
+ c.id = cpk;
+ s.persist( c );
+ tx.commit();
+ s.close();
+
+ s = openSession();
+ tx = s.beginTransaction();
+ Query q = s.createQuery( "select c from Child c where c.id.nthChild = :nth" );
+ q.setInteger( "nth", 1 );
+ List results = q.list();
+ assertEquals( 1, results.size() );
+ c = (Child) results.get( 0 );
+ assertNotNull( c );
+ assertNotNull( c.id.parent );
+ //FIXME mke it work in unambigious cases
+ // assertNotNull(c.id.parent.id);
+ // assertEquals(p.id.getFirstName(), c.id.parent.id.getFirstName());
+ tx.commit();
+ s.close();
+ }
+
+ /**
* This feature is not supported by the EJB3
* this is an hibernate extension
*/
- public void testManyToOneInCompositePk() throws Exception {
+ public void testManyToOneInCompositePkAndSubclass() throws Exception {
Session s;
Transaction tx;
s = openSession();
@@ -41,7 +81,8 @@
ChildPk cpk = new ChildPk();
cpk.parent = p;
cpk.nthChild = 1;
- Child c = new Child();
+ LittleGenius c = new LittleGenius();
+ c.particularSkill = "Human Annotation parser";
c.id = cpk;
s.persist( c );
tx.commit();
@@ -53,7 +94,7 @@
q.setInteger( "nth", 1 );
List results = q.list();
assertEquals( 1, results.size() );
- c = (Child) results.get( 0 );
+ c = (LittleGenius) results.get( 0 );
assertNotNull( c );
assertNotNull( c.id.parent );
//FIXME mke it work in unambigious cases
@@ -133,7 +174,8 @@
Order.class,
Product.class,
OrderLine.class,
- OrderLinePk.class
+ OrderLinePk.class,
+ LittleGenius.class
};
}
}
Added: trunk/HibernateExt/annotations/src/test/org/hibernate/test/annotations/cid/LittleGenius.java
===================================================================
--- trunk/HibernateExt/annotations/src/test/org/hibernate/test/annotations/cid/LittleGenius.java (rev 0)
+++ trunk/HibernateExt/annotations/src/test/org/hibernate/test/annotations/cid/LittleGenius.java 2007-06-06 14:25:29 UTC (rev 11640)
@@ -0,0 +1,19 @@
+package org.hibernate.test.annotations.cid;
+
+import javax.persistence.Entity;
+import javax.persistence.PrimaryKeyJoinColumn;
+import javax.persistence.PrimaryKeyJoinColumns;
+
+/**
+ * Hierarchy with cid + many to one
+ * @author Anthony
+ *
+ */
+@Entity
+@PrimaryKeyJoinColumns({
+@PrimaryKeyJoinColumn(name = "nthChild"),
+@PrimaryKeyJoinColumn(name = "parentLastName"),
+@PrimaryKeyJoinColumn(name = "parentFirstName")})
+public class LittleGenius extends Child {
+ public String particularSkill;
+}
18 years, 10 months
Hibernate SVN: r11639 - trunk/HibernateExt/search/doc/reference/en/modules.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2007-06-05 20:45:49 -0400 (Tue, 05 Jun 2007)
New Revision: 11639
Added:
trunk/HibernateExt/search/doc/reference/en/modules/lucene-native.xml
trunk/HibernateExt/search/doc/reference/en/modules/optimize.xml
Log:
some more doc
Added: trunk/HibernateExt/search/doc/reference/en/modules/lucene-native.xml
===================================================================
--- trunk/HibernateExt/search/doc/reference/en/modules/lucene-native.xml (rev 0)
+++ trunk/HibernateExt/search/doc/reference/en/modules/lucene-native.xml 2007-06-06 00:45:49 UTC (rev 11639)
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<chapter id="search-lucene-native">
+ <title>Accessing Lucene natively</title>
+
+ <section>
+ <title>SearchFactory</title>
+
+ <para>The <classname>SearchFactory</classname> object keeps track of the
+ underlying Lucene resources for Hibernate Search, it's also a convenient
+ way to access Lucene natively. The <classname>SearchFactory</classname>
+ can be accessed from a <classname>FullTextSession</classname>:</para>
+
+ <programlisting>FullTextSession fullTextSession = Search.createFullTextSession(regularSession);
+SearchFactory searchFactory = fullTextSession.getSearchFactory();</programlisting>
+ </section>
+
+ <section>
+ <title>Accessing a Lucene Directory</title>
+
+ <para>You can always access the Lucene directories through plain Lucene,
+ the Directory structure is in no way different with or without Hibernate
+ Search. However there are some more convenient ways to access a given
+ Directory. The <classname>SearchFactory</classname> keeps track of a
+ <classname>DirectoryProvider</classname> per indexed class (one directory
+ provider can be shared amongst several indexed classes if the classes
+ share the same underlying index directory).</para>
+
+ <programlisting>DirectoryProvider provider = searchFactory.getDirectoryProvider(Order.class);
+org.apache.lucene.store.Directory directory = provider.getDirectory();</programlisting>
+
+ <para>In this example, directory points to the lucene index storing
+ <classname>Order</classname>s information. Note that the obtained Lucene
+ directory must not be closed (this is Hibernate Search
+ responsibility).</para>
+ </section>
+
+ <section>
+ <title>Using an IndexReader</title>
+
+ <para>Queries in Lucene are executed on an <literal>IndexReader</literal>.
+ Hibernate Search caches such index readers to maximize performances. Your
+ code can access such cached / shared resources. You will just have to
+ follow some "good citizen" rules.</para>
+
+ <programlisting>DirectoryProvider orderProvider = searchFactory.getDirectoryProvider(Order.class);
+DirectoryProvider clientProvider = searchFactory.getDirectoryProvider(Client.class);
+
+ReaderProvider readerProvider = searchFactory.getReaderProvider();
+IndexReader reader = readerProvider.openReader(orderProvider, clientProvider);
+
+try {
+ //do read-only operations on the reader
+}
+finally {
+ readerProvider.closeReader(reader);
+}</programlisting>
+
+ <para>The ReaderProvider (described in <xref
+ linkend="search-architecture-readerstrategy" />), will open an IndexReader
+ on top of the index(es) referenced by the directory providers. This
+ IndexReader being shared amongst several clients, you must adhere to the
+ following rules:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>Never call indexReader.close(), but always call
+ readerProvider.closeReader(reader); (a finally block is the best
+ area).</para>
+ </listitem>
+
+ <listitem>
+ <para>This indexReader must not be used for modification operations
+ (especially delete), if you want to use an read/write index reader,
+ open one from the Lucene Directory object.</para>
+ </listitem>
+ </itemizedlist>
+
+ <para>Aside from those rules, you can use the IndexReader freely,
+ especially to do native queries. Using the shared
+ <literal>IndexReader</literal>s will make most queries more
+ efficient.</para>
+ </section>
+</chapter>
\ No newline at end of file
Added: trunk/HibernateExt/search/doc/reference/en/modules/optimize.xml
===================================================================
--- trunk/HibernateExt/search/doc/reference/en/modules/optimize.xml (rev 0)
+++ trunk/HibernateExt/search/doc/reference/en/modules/optimize.xml 2007-06-06 00:45:49 UTC (rev 11639)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<chapter id="search-optimize">
+ <title>Index Optimization</title>
+
+ <para>From time to time, the Lucene index needs to be optimize. The process
+ is essentially a defragmentation: until the optimization occurs, deleted
+ documents are just marked as such, no physical deletion is applied, the
+ optimization can also adjust the number of files in the Lucene
+ Directory.</para>
+
+ <para>You can programmatically optimize (defragment) a Lucene index from
+ Hibernate Search through the <classname>SearchFactory</classname></para>
+
+ <programlisting>searchFactory.optimize(Order.class);
+
+searchFactory.optimize();
+</programlisting>
+
+ <para>The first example reindex the Lucene index holding
+ <classname>Order</classname>s, the second, optimize all indexes.</para>
+
+ <para>The optimization speeds up searches but in no way speeds up indexation
+ (update). During an optimization, searches can be performed (but will most
+ likely be slowed down), and all index updates will be stopped. Prefer
+ optimizing:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>on an idle system or when the searches are less frequent</para>
+ </listitem>
+
+ <listitem>
+ <para>after a lot of index modifications (doing so before will not speed
+ up the indexation process)</para>
+ </listitem>
+ </itemizedlist>
+
+ <para>The <classname>SearchFactory</classname> can be accessed from a
+ <classname>FullTextSession</classname>:</para>
+
+ <programlisting>FullTextSession fullTextSession = Search.createFullTextSession(regularSession);
+SearchFactory searchFactory = fullTextSession.getSearchFactory();</programlisting>
+
+ <para>Note that <literal>searchFactory.optimize()</literal> has no effect on
+ a JMS backend. You must apply the optimize operation on the Master
+ node.</para>
+
+ <para></para>
+</chapter>
\ No newline at end of file
18 years, 10 months
Hibernate SVN: r11638 - trunk/HibernateExt/search.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2007-06-05 20:41:38 -0400 (Tue, 05 Jun 2007)
New Revision: 11638
Modified:
trunk/HibernateExt/search/build.xml
trunk/HibernateExt/search/changelog.txt
trunk/HibernateExt/search/readme.txt
Log:
release
Modified: trunk/HibernateExt/search/build.xml
===================================================================
--- trunk/HibernateExt/search/build.xml 2007-06-06 00:39:00 UTC (rev 11637)
+++ trunk/HibernateExt/search/build.xml 2007-06-06 00:41:38 UTC (rev 11638)
@@ -16,7 +16,7 @@
<!-- Name of project and version, used to create filenames -->
<property name="Name" value="Hibernate Search"/>
<property name="name" value="hibernate-search"/>
- <property name="version" value="3.0.0.Beta2"/>
+ <property name="version" value="3.0.0.Beta3"/>
<property name="javadoc.packagenames" value="org.hibernate.search.*"/>
<property name="copy.test" value="true"/>
<property name="javac.source" value="1.5"/>
Modified: trunk/HibernateExt/search/changelog.txt
===================================================================
--- trunk/HibernateExt/search/changelog.txt 2007-06-06 00:39:00 UTC (rev 11637)
+++ trunk/HibernateExt/search/changelog.txt 2007-06-06 00:41:38 UTC (rev 11638)
@@ -1,6 +1,26 @@
Hibernate Search Changelog
==========================
+3.0.0.Beta3 (6-06-2007)
+------------------------
+
+** Bug
+ * [HSEARCH-64] - Exception Thrown If Index Directory Does Not Exist
+ * [HSEARCH-66] - Some results not returned in some circumstances (Brandon Munroe)
+
+
+** Improvement
+ * [HSEARCH-60] - Introduce SearchFactory / SearchFactoryImpl
+ * [HSEARCH-68] - Set index copy threads as daemon
+ * [HSEARCH-70] - Create the index base directory if it does not exists
+
+** New Feature
+ * [HSEARCH-11] - Provide access to IndexWriter.optimize()
+ * [HSEARCH-33] - hibernate.search.worker.batch_size to prevent OutOfMemoryException while inserting many objects
+ * [HSEARCH-71] - Provide fullTextSession.getSearchFactory()
+ * [HSEARCH-72] - searchFactory.optimize() and searchFactory.optimize(Class) (Andrew Hahn)
+
+
3.0.0.Beta2 (31-05-2007)
------------------------
Modified: trunk/HibernateExt/search/readme.txt
===================================================================
--- trunk/HibernateExt/search/readme.txt 2007-06-06 00:39:00 UTC (rev 11637)
+++ trunk/HibernateExt/search/readme.txt 2007-06-06 00:41:38 UTC (rev 11638)
@@ -1,6 +1,6 @@
Hibernate Search
==================================================
-Version: 3.0.0.Beta2, 31.05.2007
+Version: 3.0.0.Beta3, 6.06.2007
Description
-----------
18 years, 10 months
Hibernate SVN: r11637 - in trunk/HibernateExt/search: doc/reference/en/modules and 1 other directories.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2007-06-05 20:39:00 -0400 (Tue, 05 Jun 2007)
New Revision: 11637
Modified:
trunk/HibernateExt/search/doc/reference/en/master.xml
trunk/HibernateExt/search/doc/reference/en/modules/batchindex.xml
trunk/HibernateExt/search/doc/reference/en/modules/configuration.xml
trunk/HibernateExt/search/doc/reference/en/modules/query.xml
trunk/HibernateExt/search/src/java/org/hibernate/search/Version.java
Log:
Documentation before the release
Modified: trunk/HibernateExt/search/doc/reference/en/master.xml
===================================================================
--- trunk/HibernateExt/search/doc/reference/en/master.xml 2007-06-06 00:08:57 UTC (rev 11636)
+++ trunk/HibernateExt/search/doc/reference/en/master.xml 2007-06-06 00:39:00 UTC (rev 11637)
@@ -6,6 +6,8 @@
<!ENTITY mapping SYSTEM "modules/mapping.xml">
<!ENTITY query SYSTEM "modules/query.xml">
<!ENTITY batchindex SYSTEM "modules/batchindex.xml">
+<!ENTITY optimize SYSTEM "modules/optimize.xml">
+<!ENTITY lucene-native SYSTEM "modules/lucene-native.xml">
]>
<book lang="en">
<bookinfo>
@@ -15,7 +17,7 @@
<subtitle>Reference Guide</subtitle>
- <releaseinfo>3.0.0.Beta2</releaseinfo>
+ <releaseinfo>3.0.0.Beta3</releaseinfo>
<mediaobject>
<imageobject>
@@ -54,4 +56,8 @@
&query;
&batchindex;
+
+ &optimize;
+
+ &lucene-native;
</book>
\ No newline at end of file
Modified: trunk/HibernateExt/search/doc/reference/en/modules/batchindex.xml
===================================================================
--- trunk/HibernateExt/search/doc/reference/en/modules/batchindex.xml 2007-06-06 00:08:57 UTC (rev 11636)
+++ trunk/HibernateExt/search/doc/reference/en/modules/batchindex.xml 2007-06-06 00:39:00 UTC (rev 11637)
@@ -18,4 +18,38 @@
and execute them at commit time (Note: you don't need to use
<classname>org.hibernate.Transaction</classname> in a JTA
environment).</para>
+
+ <para>If you expect to index a lot of data, you need to be careful about
+ memory consumption: since all documents are kept in a queue until the
+ transaction commit, you can potentially face an OutOfMemoryException.</para>
+
+ <para>To avoid that, you can set up the
+ <literal>hibernate.search.worker.batch_size</literal> property to a
+ sensitive value: all index operations are queued until
+ <literal>batch_size</literal> is reached. Every time
+ <literal>batch_size</literal> is reached (or if the transaction is
+ committed), the queue is processed (freeing memory) and emptied. Be aware
+ that the changes cannot be rollbacked if the number of index elements goes
+ beyond <literal>batch_size</literal>. Be also aware that the queue limits is
+ also applied on regular transparent indexing (and not only when
+ <literal>session.index()</literal> is used). That's why a sensitive
+ <literal>batch_size</literal> value is expected.</para>
+
+ <para>Here is an especially efficient way to index a given class (useful for
+ index (re)initialization):</para>
+
+ <programlisting>transaction = fullTextSession.beginTransaction();
+//Scrollable results will avoid loading too many objects in memory
+ScrollableResults results = fullTextSession.createCriteria( Email.class ).scroll( ScrollMode.FORWARD_ONLY );
+int index = 0;
+while( results.next() ) {
+ index++;
+ fullTextSession.index( results.get(0) ); //index each element
+ if (index % batchSize == 0) s.clear(); //clear every batchSize since the queue is processed
+}
+transaction.commit();</programlisting>
+
+ <para>It is critical that <literal>batchSize</literal> in the previous
+ example matches the <literal>batch_size</literal> value described
+ previously.</para>
</chapter>
\ No newline at end of file
Modified: trunk/HibernateExt/search/doc/reference/en/modules/configuration.xml
===================================================================
--- trunk/HibernateExt/search/doc/reference/en/modules/configuration.xml 2007-06-06 00:08:57 UTC (rev 11636)
+++ trunk/HibernateExt/search/doc/reference/en/modules/configuration.xml 2007-06-06 00:39:00 UTC (rev 11637)
@@ -234,6 +234,16 @@
lookup the JMS queue from. The queue will be used to post work
messages.</entry>
</row>
+
+ <row>
+ <entry><literal>
+ org.hibernate.worker.batch_size</literal></entry>
+
+ <entry>Defines the maximum number of elements indexed before
+ flushing the transaction-bound queue. Default to 0 (ie no
+ limit). See <xref linkend="search-batchindex" /> for more
+ information.</entry>
+ </row>
</tbody>
</tgroup>
</table>
Modified: trunk/HibernateExt/search/doc/reference/en/modules/query.xml
===================================================================
--- trunk/HibernateExt/search/doc/reference/en/modules/query.xml 2007-06-06 00:08:57 UTC (rev 11636)
+++ trunk/HibernateExt/search/doc/reference/en/modules/query.xml 2007-06-06 00:39:00 UTC (rev 11637)
@@ -289,4 +289,12 @@
</listitem>
</itemizedlist>
</section>
+
+ <section>
+ <title>Native Lucene Queries</title>
+
+ <para>If you wish to use some specific features of Lucene, you can always
+ run Lucene specific queries. Check <xref linkend="search-lucene-native" />
+ for more informations.</para>
+ </section>
</chapter>
\ No newline at end of file
Modified: trunk/HibernateExt/search/src/java/org/hibernate/search/Version.java
===================================================================
--- trunk/HibernateExt/search/src/java/org/hibernate/search/Version.java 2007-06-06 00:08:57 UTC (rev 11636)
+++ trunk/HibernateExt/search/src/java/org/hibernate/search/Version.java 2007-06-06 00:39:00 UTC (rev 11637)
@@ -10,7 +10,7 @@
* @author Emmanuel Bernard
*/
public class Version {
- public static final String VERSION = "3.0.0.Beta3SNAPSHOT" + new Date();
+ public static final String VERSION = "3.0.0.Beta3"; //SNAPSHOT" + new Date();
private static Log log = LogFactory.getLog( Version.class );
static {
18 years, 10 months
Hibernate SVN: r11636 - trunk/HibernateExt/search/src/java/org/hibernate/search/reader.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2007-06-05 20:08:57 -0400 (Tue, 05 Jun 2007)
New Revision: 11636
Modified:
trunk/HibernateExt/search/src/java/org/hibernate/search/reader/ReaderProvider.java
Log:
minor, use varargs rather than an array
Modified: trunk/HibernateExt/search/src/java/org/hibernate/search/reader/ReaderProvider.java
===================================================================
--- trunk/HibernateExt/search/src/java/org/hibernate/search/reader/ReaderProvider.java 2007-06-05 23:13:23 UTC (rev 11635)
+++ trunk/HibernateExt/search/src/java/org/hibernate/search/reader/ReaderProvider.java 2007-06-06 00:08:57 UTC (rev 11636)
@@ -22,7 +22,7 @@
* the opened reader has to be closed through #closeReader()
* The opening can be virtual
*/
- IndexReader openReader(DirectoryProvider[] directoryProviders);
+ IndexReader openReader(DirectoryProvider... directoryProviders);
/**
* close a reader previously opened by #openReader
18 years, 10 months
Hibernate SVN: r11635 - in trunk/HibernateExt/search/src/test/org/hibernate/search/test: reader and 2 other directories.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2007-06-05 19:13:23 -0400 (Tue, 05 Jun 2007)
New Revision: 11635
Modified:
trunk/HibernateExt/search/src/test/org/hibernate/search/test/FSDirectoryTest.java
trunk/HibernateExt/search/src/test/org/hibernate/search/test/reader/NotSharedReaderPerfTest.java
trunk/HibernateExt/search/src/test/org/hibernate/search/test/reader/ReaderPerfTestCase.java
trunk/HibernateExt/search/src/test/org/hibernate/search/test/reader/SharedReaderPerfTest.java
trunk/HibernateExt/search/src/test/org/hibernate/search/test/session/OptimizeTest.java
trunk/HibernateExt/search/src/test/org/hibernate/search/test/worker/AsyncWorkerTest.java
trunk/HibernateExt/search/src/test/org/hibernate/search/test/worker/SyncWorkerTest.java
trunk/HibernateExt/search/src/test/org/hibernate/search/test/worker/WorkerTestCase.java
Log:
Fix some test issues
Modified: trunk/HibernateExt/search/src/test/org/hibernate/search/test/FSDirectoryTest.java
===================================================================
--- trunk/HibernateExt/search/src/test/org/hibernate/search/test/FSDirectoryTest.java 2007-06-05 23:12:44 UTC (rev 11634)
+++ trunk/HibernateExt/search/src/test/org/hibernate/search/test/FSDirectoryTest.java 2007-06-05 23:13:23 UTC (rev 11635)
@@ -181,9 +181,10 @@
}
protected void configure(org.hibernate.cfg.Configuration cfg) {
+ super.configure( cfg );
File sub = getBaseIndexDir();
cfg.setProperty( "hibernate.search.default.indexBase", sub.getAbsolutePath() );
- cfg.setProperty( "hibernate.search.Clock.directory_provider", FSDirectoryProvider.class.getName() );
+ cfg.setProperty( "hibernate.search.default.directory_provider", FSDirectoryProvider.class.getName() );
cfg.setProperty( Environment.ANALYZER_CLASS, StopAnalyzer.class.getName() );
FullTextIndexEventListener del = new FullTextIndexEventListener();
cfg.getEventListeners().setPostDeleteEventListeners( new PostDeleteEventListener[]{del} );
Modified: trunk/HibernateExt/search/src/test/org/hibernate/search/test/reader/NotSharedReaderPerfTest.java
===================================================================
--- trunk/HibernateExt/search/src/test/org/hibernate/search/test/reader/NotSharedReaderPerfTest.java 2007-06-05 23:12:44 UTC (rev 11634)
+++ trunk/HibernateExt/search/src/test/org/hibernate/search/test/reader/NotSharedReaderPerfTest.java 2007-06-05 23:13:23 UTC (rev 11635)
@@ -11,6 +11,7 @@
*/
public class NotSharedReaderPerfTest extends ReaderPerfTestCase {
protected void configure(Configuration cfg) {
+ super.configure( cfg );
cfg.setProperty( "hibernate.search.default.directory_provider", FSDirectoryProvider.class.getName() );
cfg.setProperty( "hibernate.search.default.indexBase", "./indextemp" );
cfg.setProperty( Environment.ANALYZER_CLASS, StopAnalyzer.class.getName() );
Modified: trunk/HibernateExt/search/src/test/org/hibernate/search/test/reader/ReaderPerfTestCase.java
===================================================================
--- trunk/HibernateExt/search/src/test/org/hibernate/search/test/reader/ReaderPerfTestCase.java 2007-06-05 23:12:44 UTC (rev 11634)
+++ trunk/HibernateExt/search/src/test/org/hibernate/search/test/reader/ReaderPerfTestCase.java 2007-06-05 23:13:23 UTC (rev 11635)
@@ -234,6 +234,7 @@
}
protected void configure(org.hibernate.cfg.Configuration cfg) {
+ super.configure( cfg );
File sub = getBaseIndexDir();
cfg.setProperty( "hibernate.search.default.indexBase", sub.getAbsolutePath() );
cfg.setProperty( "hibernate.search.Clock.directory_provider", FSDirectoryProvider.class.getName() );
Modified: trunk/HibernateExt/search/src/test/org/hibernate/search/test/reader/SharedReaderPerfTest.java
===================================================================
--- trunk/HibernateExt/search/src/test/org/hibernate/search/test/reader/SharedReaderPerfTest.java 2007-06-05 23:12:44 UTC (rev 11634)
+++ trunk/HibernateExt/search/src/test/org/hibernate/search/test/reader/SharedReaderPerfTest.java 2007-06-05 23:13:23 UTC (rev 11635)
@@ -12,6 +12,7 @@
*/
public class SharedReaderPerfTest extends ReaderPerfTestCase {
protected void configure(Configuration cfg) {
+ super.configure( cfg );
cfg.setProperty( "hibernate.search.default.directory_provider", FSDirectoryProvider.class.getName() );
cfg.setProperty( "hibernate.search.default.indexBase", "./indextemp" );
cfg.setProperty( Environment.ANALYZER_CLASS, StopAnalyzer.class.getName() );
Modified: trunk/HibernateExt/search/src/test/org/hibernate/search/test/session/OptimizeTest.java
===================================================================
--- trunk/HibernateExt/search/src/test/org/hibernate/search/test/session/OptimizeTest.java 2007-06-05 23:12:44 UTC (rev 11634)
+++ trunk/HibernateExt/search/src/test/org/hibernate/search/test/session/OptimizeTest.java 2007-06-05 23:13:23 UTC (rev 11635)
@@ -54,6 +54,7 @@
}
protected void configure(org.hibernate.cfg.Configuration cfg) {
+ super.configure( cfg );
File sub = getBaseIndexDir();
cfg.setProperty( "hibernate.search.default.indexBase", sub.getAbsolutePath() );
cfg.setProperty( "hibernate.search.default.directory_provider", FSDirectoryProvider.class.getName() );
Modified: trunk/HibernateExt/search/src/test/org/hibernate/search/test/worker/AsyncWorkerTest.java
===================================================================
--- trunk/HibernateExt/search/src/test/org/hibernate/search/test/worker/AsyncWorkerTest.java 2007-06-05 23:12:44 UTC (rev 11634)
+++ trunk/HibernateExt/search/src/test/org/hibernate/search/test/worker/AsyncWorkerTest.java 2007-06-05 23:13:23 UTC (rev 11635)
@@ -12,6 +12,7 @@
public class AsyncWorkerTest extends WorkerTestCase {
protected void configure(Configuration cfg) {
+ super.configure( cfg );
cfg.setProperty( "hibernate.search.default.directory_provider", RAMDirectoryProvider.class.getName() );
cfg.setProperty( Environment.ANALYZER_CLASS, StopAnalyzer.class.getName() );
cfg.setProperty( Environment.WORKER_SCOPE, "transaction" );
Modified: trunk/HibernateExt/search/src/test/org/hibernate/search/test/worker/SyncWorkerTest.java
===================================================================
--- trunk/HibernateExt/search/src/test/org/hibernate/search/test/worker/SyncWorkerTest.java 2007-06-05 23:12:44 UTC (rev 11634)
+++ trunk/HibernateExt/search/src/test/org/hibernate/search/test/worker/SyncWorkerTest.java 2007-06-05 23:13:23 UTC (rev 11635)
@@ -16,6 +16,7 @@
public class SyncWorkerTest extends WorkerTestCase {
protected void configure(Configuration cfg) {
+ super.configure( cfg );
cfg.setProperty( "hibernate.search.default.directory_provider", RAMDirectoryProvider.class.getName() );
cfg.setProperty( Environment.ANALYZER_CLASS, StopAnalyzer.class.getName() );
cfg.setProperty( Environment.WORKER_SCOPE, "transaction" );
Modified: trunk/HibernateExt/search/src/test/org/hibernate/search/test/worker/WorkerTestCase.java
===================================================================
--- trunk/HibernateExt/search/src/test/org/hibernate/search/test/worker/WorkerTestCase.java 2007-06-05 23:12:44 UTC (rev 11634)
+++ trunk/HibernateExt/search/src/test/org/hibernate/search/test/worker/WorkerTestCase.java 2007-06-05 23:13:23 UTC (rev 11635)
@@ -187,6 +187,7 @@
}
protected void configure(org.hibernate.cfg.Configuration cfg) {
+ super.configure( cfg );
File sub = getBaseIndexDir();
cfg.setProperty( "hibernate.search.default.indexBase", sub.getAbsolutePath() );
cfg.setProperty( "hibernate.search.Clock.directory_provider", FSDirectoryProvider.class.getName() );
18 years, 10 months