Hibernate SVN: r16561 - in core/branches/Branch_3_2: test/org/hibernate/test and 3 other directories.
by hibernate-commits@lists.jboss.org
Author: gbadner
Date: 2009-05-13 18:17:08 -0400 (Wed, 13 May 2009)
New Revision: 16561
Added:
core/branches/Branch_3_2/src/org/hibernate/event/def/CopyCache.java
core/branches/Branch_3_2/test/org/hibernate/test/cascade/circle/
core/branches/Branch_3_2/test/org/hibernate/test/cascade/circle/CascadeMergeToChildBeforeParent.hbm.xml
core/branches/Branch_3_2/test/org/hibernate/test/cascade/circle/CascadeMergeToChildBeforeParentTest.java
core/branches/Branch_3_2/test/org/hibernate/test/cascade/circle/MultiPathCircleCascade.hbm.xml
core/branches/Branch_3_2/test/org/hibernate/test/cascade/circle/MultiPathCircleCascadeTest.java
core/branches/Branch_3_2/test/org/hibernate/test/cascade/circle/Node.java
core/branches/Branch_3_2/test/org/hibernate/test/cascade/circle/Route.java
core/branches/Branch_3_2/test/org/hibernate/test/cascade/circle/Tour.java
core/branches/Branch_3_2/test/org/hibernate/test/cascade/circle/Transport.java
core/branches/Branch_3_2/test/org/hibernate/test/cascade/circle/Vehicle.java
Modified:
core/branches/Branch_3_2/src/org/hibernate/event/def/DefaultMergeEventListener.java
core/branches/Branch_3_2/test/org/hibernate/test/AllTests.java
core/branches/Branch_3_2/test/org/hibernate/test/cascade/A.java
core/branches/Branch_3_2/test/org/hibernate/test/cascade/G.java
core/branches/Branch_3_2/test/org/hibernate/test/cascade/H.java
core/branches/Branch_3_2/test/org/hibernate/test/cascade/MultiPathCascadeTest.java
core/branches/Branch_3_2/test/org/hibernate/test/ops/MergeTest.java
Log:
HHH-3810 : Transient entities can be inserted twice on merge
Added: core/branches/Branch_3_2/src/org/hibernate/event/def/CopyCache.java
===================================================================
--- core/branches/Branch_3_2/src/org/hibernate/event/def/CopyCache.java (rev 0)
+++ core/branches/Branch_3_2/src/org/hibernate/event/def/CopyCache.java 2009-05-13 22:17:08 UTC (rev 16561)
@@ -0,0 +1,244 @@
+//$Id: $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate.event.def;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.Iterator;
+import java.util.Collection;
+
+import org.hibernate.util.IdentityMap;
+import org.hibernate.AssertionFailure;
+
+/**
+ * CopyCache is intended to be the Map implementation used by
+ * {@link DefaultMergeEventListener} to keep track of entities and their copies
+ * being merged into the session. This implementation also tracks whether a
+ * an entity in the CopyCache is included in the merge. This allows a
+ * an entity and its copy to be added to a CopyCache before merge has cascaded
+ * to that entity.
+ *
+ * @author Gail Badner
+ */
+class CopyCache implements Map {
+ private Map entityToCopyMap = IdentityMap.instantiate(10);
+ // key is an entity involved with the merge;
+ // value can be either a copy of the entity or the entity itself
+
+ private Map entityToIncludeInMergeFlagMap = IdentityMap.instantiate(10);
+ // key is an entity involved with the merge;
+ // value is a flag indicating if the entity is included in the merge
+
+ /**
+ * Clears the CopyCache.
+ */
+ public void clear() {
+ entityToCopyMap.clear();
+ entityToIncludeInMergeFlagMap.clear();
+ }
+
+ /**
+ * Returns true if this CopyCache contains a mapping for the specified entity.
+ * @param entity must be non-null
+ * @return true if this CopyCache contains a mapping for the specified entity
+ * @throws NullPointerException if entity is null
+ */
+ public boolean containsKey(Object entity) {
+ if ( entity == null ) {
+ throw new NullPointerException( "null entities are not supported by " + getClass().getName() );
+ }
+ return entityToCopyMap.containsKey( entity );
+ }
+
+ /**
+ * Returns true if this CopyCache maps one or more entities to the specified copy.
+ * @param copy must be non-null
+ * @return true if this CopyCache maps one or more entities to the specified copy
+ * @throws NullPointerException if copy is null
+ */
+ public boolean containsValue(Object copy) {
+ if ( copy == null ) {
+ throw new NullPointerException( "null copies are not supported by " + getClass().getName() );
+ }
+ return entityToCopyMap.containsValue( copy );
+ }
+
+ /**
+ * Returns a set view of the entity-to-copy mappings contained in this CopyCache.
+ * @return set view of the entity-to-copy mappings contained in this CopyCache
+ */
+ public Set entrySet() {
+ return entityToCopyMap.entrySet();
+ }
+
+ /**
+ * Returns the copy to which this CopyCache maps the specified entity.
+ * @param entity must be non-null
+ * @return the copy to which this CopyCache maps the specified entity
+ * @throws NullPointerException if entity is null
+ */
+ public Object get(Object entity) {
+ if ( entity == null ) {
+ throw new NullPointerException( "null entities are not supported by " + getClass().getName() );
+ }
+ return entityToCopyMap.get( entity );
+ }
+
+ /**
+ * Returns true if this CopyCache contains no entity-copy mappings.
+ * @return true if this CopyCache contains no entity-copy mappings
+ */
+ public boolean isEmpty() {
+ return entityToCopyMap.isEmpty();
+ }
+
+ /**
+ * Returns a set view of the entities contained in this CopyCache
+ * @return a set view of the entities contained in this CopyCache
+ */
+ public Set keySet() {
+ return entityToCopyMap.keySet();
+ }
+
+ /**
+ * Associates the specified entity with the specified copy in this CopyCache;
+ * @param entity must be non-null
+ * @param copy must be non- null
+ * @return previous copy associated with specified entity, or null if
+ * there was no mapping for entity.
+ * @throws NullPointerException if entity or copy is null
+ */
+ public Object put(Object entity, Object copy) {
+ if ( entity == null || copy == null ) {
+ throw new NullPointerException( "null entities and copies are not supported by " + getClass().getName() );
+ }
+ entityToIncludeInMergeFlagMap.put( entity, Boolean.FALSE );
+ return entityToCopyMap.put( entity, copy );
+ }
+
+ /**
+ * Associates the specified entity with the specified copy in this CopyCache;
+ * @param entity must be non-null
+ * @param copy must be non- null
+ * @param isIncludedInMerge indicates if the entity is included in merge
+ *
+ * @return previous copy associated with specified entity, or null if
+ * there was no mapping for entity.
+ * @throws NullPointerException if entity or copy is null
+ */
+ /* package-private */ Object put(Object entity, Object copy, boolean isIncludedInMerge) {
+ if ( entity == null || copy == null ) {
+ throw new NullPointerException( "null entities and copies are not supported by " + getClass().getName() );
+ }
+ entityToIncludeInMergeFlagMap.put( entity, Boolean.valueOf( isIncludedInMerge ) );
+ return entityToCopyMap.put( entity, copy );
+ }
+
+ /**
+ * Copies all of the mappings from the specified map to this CopyCache
+ * @param map keys and values must be non-null
+ * @throws NullPointerException if any map keys or values are null
+ */
+ public void putAll(Map map) {
+ for ( Iterator it=map.entrySet().iterator(); it.hasNext(); ) {
+ Map.Entry entry = ( Map.Entry ) it.next();
+ if ( entry.getKey() == null || entry.getValue() == null ) {
+ throw new NullPointerException( "null entities and copies are not supported by " + getClass().getName() );
+ }
+ entityToCopyMap.put( entry.getKey(), entry.getValue() );
+ entityToIncludeInMergeFlagMap.put( entry.getKey(), Boolean.FALSE );
+ }
+ }
+
+ /**
+ * Removes the mapping for this entity from this CopyCache if it is present
+ * @param entity must be non-null
+ * @return previous value associated with specified entity, or null if there was no mapping for entity.
+ * @throws NullPointerException if entity is null
+ */
+ public Object remove(Object entity) {
+ if ( entity == null ) {
+ throw new NullPointerException( "null entities are not supported by " + getClass().getName() );
+ }
+ entityToIncludeInMergeFlagMap.remove( entity );
+ return entityToCopyMap.remove( entity );
+ }
+
+ /**
+ * Returns the number of entity-copy mappings in this CopyCache
+ * @return the number of entity-copy mappings in this CopyCache
+ */
+ public int size() {
+ return entityToCopyMap.size();
+ }
+
+ /**
+ * Returns a collection view of the entity copies contained in this CopyCache.
+ * @return a collection view of the entity copies contained in this CopyCache
+ */
+ public Collection values() {
+ return entityToCopyMap.values();
+ }
+
+ /**
+ * Returns true if the specified entity is included in the merge.
+ * @param entity must be non-null
+ * @return true if the specified entity is included in the merge.
+ * @throws NullPointerException if entity is null
+ */
+ public boolean isIncludedInMerge(Object entity) {
+ if ( entity == null ) {
+ throw new NullPointerException( "null entities are not supported by " + getClass().getName() );
+ }
+ return ( ( Boolean ) entityToIncludeInMergeFlagMap.get( entity ) ).booleanValue();
+ }
+
+ /**
+ * Set flag to indicate if an entity is included in the merge.
+ * @param entity must be non-null and this CopyCache must contain a mapping for this entity
+ * @return true if the specified entity is included in the merge
+ * @throws NullPointerException if entity is null
+ * @throws AssertionFailure if this CopyCache does not contain a mapping for the specified entity
+ */
+ /* package-private */ void setIncludedInMerge(Object entity, boolean isIncludedInMerge) {
+ if ( entity == null ) {
+ throw new NullPointerException( "null entities are not supported by " + getClass().getName() );
+ }
+ if ( ! entityToIncludeInMergeFlagMap.containsKey( entity ) ||
+ ! entityToCopyMap.containsKey( entity ) ) {
+ throw new AssertionFailure( "called CopyCache.setInMergeProcess() for entity not found in CopyCache" );
+ }
+ entityToIncludeInMergeFlagMap.put( entity, Boolean.valueOf( isIncludedInMerge ) );
+ }
+
+ /**
+ * Returns the copy-entity mappings
+ * @return the copy-entity mappings
+ */
+ public Map getMergeMap() {
+ return IdentityMap.invert( entityToCopyMap );
+ }
+}
\ No newline at end of file
Modified: core/branches/Branch_3_2/src/org/hibernate/event/def/DefaultMergeEventListener.java
===================================================================
--- core/branches/Branch_3_2/src/org/hibernate/event/def/DefaultMergeEventListener.java 2009-05-13 13:39:03 UTC (rev 16560)
+++ core/branches/Branch_3_2/src/org/hibernate/event/def/DefaultMergeEventListener.java 2009-05-13 22:17:08 UTC (rev 16561)
@@ -28,6 +28,8 @@
import java.io.Serializable;
import java.util.Iterator;
import java.util.Map;
+import java.util.Set;
+import java.util.HashSet;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -38,6 +40,7 @@
import org.hibernate.StaleObjectStateException;
import org.hibernate.TransientObjectException;
import org.hibernate.WrongClassException;
+import org.hibernate.PropertyValueException;
import org.hibernate.engine.Cascade;
import org.hibernate.engine.CascadingAction;
import org.hibernate.engine.EntityEntry;
@@ -54,7 +57,7 @@
import org.hibernate.proxy.LazyInitializer;
import org.hibernate.type.ForeignKeyDirection;
import org.hibernate.type.TypeFactory;
-import org.hibernate.util.IdentityMap;
+import org.hibernate.type.Type;
/**
* Defines the default copy event listener used by hibernate for copying entities
@@ -66,9 +69,9 @@
implements MergeEventListener {
private static final Log log = LogFactory.getLog(DefaultMergeEventListener.class);
-
+
protected Map getMergeMap(Object anything) {
- return IdentityMap.invert( (Map) anything );
+ return ( ( CopyCache ) anything ).getMergeMap();
}
/**
@@ -78,36 +81,96 @@
* @throws HibernateException
*/
public void onMerge(MergeEvent event) throws HibernateException {
- Map copyCache = IdentityMap.instantiate(10);
+ CopyCache copyCache = new CopyCache();
onMerge( event, copyCache );
- for ( Iterator it=copyCache.values().iterator(); it.hasNext(); ) {
- Object entity = it.next();
- if ( entity instanceof HibernateProxy ) {
- entity = ( (HibernateProxy) entity ).getHibernateLazyInitializer().getImplementation();
+ // TODO: iteratively get transient entities and retry merge until one of the following conditions:
+ // 1) transientCopyCache.size() == 0
+ // 2) transientCopyCache.size() is not decreasing and copyCache.size() is not increasing
+ // TODO: find out if retrying can add entities to copyCache (don't think it can...)
+ // For now, just retry once; throw TransientObjectException if there are still any transient entities
+ Map transientCopyCache = getTransientCopyCache(event, copyCache );
+ if ( transientCopyCache.size() > 0 ) {
+ retryMergeTransientEntities( event, transientCopyCache, copyCache );
+ // find any entities that are still transient after retry
+ transientCopyCache = getTransientCopyCache(event, copyCache );
+ if ( transientCopyCache.size() > 0 ) {
+ Set transientEntityNames = new HashSet();
+ for( Iterator it=transientCopyCache.keySet().iterator(); it.hasNext(); ) {
+ Object transientEntity = it.next();
+ String transientEntityName = event.getSession().guessEntityName( transientEntity );
+ transientEntityNames.add( transientEntityName );
+ log.trace( "transient instance could not be processed by merge: " +
+ transientEntityName + "[" + transientEntity + "]" );
+ }
+ throw new TransientObjectException(
+ "one or more objects is an unsaved transient instance - save transient instance(s) before merging: " +
+ transientEntityNames );
}
- EntityEntry entry = event.getSession().getPersistenceContext().getEntry( entity );
- if ( entry == null ) {
+ }
+ copyCache.clear();
+ copyCache = null;
+ }
+
+ protected CopyCache getTransientCopyCache(MergeEvent event, CopyCache copyCache) {
+ CopyCache transientCopyCache = new CopyCache();
+ for ( Iterator it=copyCache.entrySet().iterator(); it.hasNext(); ) {
+ Map.Entry mapEntry = ( Map.Entry ) it.next();
+ Object entity = mapEntry.getKey();
+ Object copy = mapEntry.getValue();
+ if ( copy instanceof HibernateProxy ) {
+ copy = ( (HibernateProxy) copy ).getHibernateLazyInitializer().getImplementation();
+ }
+ EntityEntry copyEntry = event.getSession().getPersistenceContext().getEntry( copy );
+ if ( copyEntry == null ) {
+ // entity name will not be available for non-POJO entities
+ // TODO: cache the entity name somewhere so that it is available to this exception
+ log.trace( "transient instance could not be processed by merge: " +
+ event.getSession().guessEntityName( copy ) + "[" + entity + "]" );
throw new TransientObjectException(
- "object references an unsaved transient instance - save the transient instance before merging: " +
- event.getSession().guessEntityName( entity )
+ "object is an unsaved transient instance - save the transient instance before merging: " +
+ event.getSession().guessEntityName( copy )
);
- // TODO: cache the entity name somewhere so that it is available to this exception
- // entity name will not be available for non-POJO entities
}
- if ( entry.getStatus() != Status.MANAGED && entry.getStatus() != Status.READ_ONLY ) {
- throw new AssertionFailure( "Merged entity does not have status set to MANAGED or READ_ONLY; "+entry+" status="+entry.getStatus() );
+ else if ( copyEntry.getStatus() == Status.SAVING ) {
+ transientCopyCache.put( entity, copy, copyCache.isIncludedInMerge( entity ) );
}
+ else if ( copyEntry.getStatus() != Status.MANAGED && copyEntry.getStatus() != Status.READ_ONLY ) {
+ throw new AssertionFailure( "Merged entity does not have status set to MANAGED or READ_ONLY; "+copy+" status="+copyEntry.getStatus() );
+ }
}
+ return transientCopyCache;
}
+ protected void retryMergeTransientEntities(MergeEvent event, Map transientCopyCache, CopyCache copyCache) {
+ // TODO: The order in which entities are saved may matter (e.g., a particular transient entity
+ // may need to be saved before other transient entities can be saved;
+ // Keep retrying the batch of transient entities until either:
+ // 1) there are no transient entities left in transientCopyCache
+ // or 2) no transient entities were saved in the last batch
+ // For now, just run through the transient entities and retry the merge
+ for ( Iterator it=transientCopyCache.entrySet().iterator(); it.hasNext(); ) {
+ Map.Entry mapEntry = ( Map.Entry ) it.next();
+ Object entity = mapEntry.getKey();
+ Object copy = transientCopyCache.get( entity );
+ EntityEntry copyEntry = event.getSession().getPersistenceContext().getEntry( copy );
+ if ( entity == event.getEntity() ) {
+ mergeTransientEntity( entity, copyEntry.getEntityName(), event.getRequestedId(), event.getSession(), copyCache);
+ }
+ else {
+ mergeTransientEntity( entity, copyEntry.getEntityName(), copyEntry.getId(), event.getSession(), copyCache);
+ }
+ }
+ }
+
/**
* Handle the given merge event.
*
* @param event The merge event to be handled.
* @throws HibernateException
*/
- public void onMerge(MergeEvent event, Map copyCache) throws HibernateException {
+ public void onMerge(MergeEvent event, Map copiedAlready) throws HibernateException {
+ final CopyCache copyCache = ( CopyCache ) copiedAlready;
final EventSource source = event.getSession();
final Object original = event.getOriginal();
@@ -128,13 +191,17 @@
else {
entity = original;
}
-
- if ( copyCache.containsKey(entity) &&
- source.getContextEntityIdentifier( copyCache.get( entity ) ) != null ) {
- log.trace("already merged");
- event.setResult(entity);
+
+ if ( copyCache.containsKey( entity ) &&
+ ( copyCache.isIncludedInMerge( entity ) ) ) {
+ log.trace("already in merge process");
+ event.setResult( entity );
}
else {
+ if ( copyCache.containsKey( entity ) ) {
+ log.trace("already in copyCache; setting in merge process");
+ copyCache.setIncludedInMerge( entity, true );
+ }
event.setEntity( entity );
int entityState = -1;
@@ -176,7 +243,7 @@
default: //DELETED
throw new ObjectDeletedException(
"deleted instance passed to merge",
- null,
+ null,
getLoggableName( event.getEntityName(), entity )
);
}
@@ -194,15 +261,15 @@
final Object entity = event.getEntity();
final EventSource source = event.getSession();
final EntityPersister persister = source.getEntityPersister( event.getEntityName(), entity );
+
+ ( ( CopyCache ) copyCache ).put( entity, entity, true ); //before cascade!
- copyCache.put(entity, entity); //before cascade!
-
cascadeOnMerge(source, persister, entity, copyCache);
copyValues(persister, entity, entity, source, copyCache);
event.setResult(entity);
}
-
+
protected void entityIsTransient(MergeEvent event, Map copyCache) {
log.trace("merging transient instance");
@@ -212,7 +279,16 @@
final EntityPersister persister = source.getEntityPersister( event.getEntityName(), entity );
final String entityName = persister.getEntityName();
-
+
+ event.setResult( mergeTransientEntity( entity, entityName, event.getRequestedId(), source, copyCache ) );
+ }
+
+ protected Object mergeTransientEntity(Object entity, String entityName, Serializable requestedId, EventSource source, Map copyCache) {
+
+ log.trace("merging transient instance");
+
+ final EntityPersister persister = source.getEntityPersister( entityName, entity );
+
final Serializable id = persister.hasIdentifierProperty() ?
persister.getIdentifier( entity, source.getEntityMode() ) :
null;
@@ -220,7 +296,7 @@
persister.setIdentifier( copyCache.get( entity ), id, source.getEntityMode() );
}
else {
- copyCache.put(entity, persister.instantiate( id, source.getEntityMode() ) ); //before cascade!
+ ( ( CopyCache ) copyCache ).put( entity, persister.instantiate( id, source.getEntityMode() ), true ); //before cascade!
//TODO: should this be Session.instantiate(Persister, ...)?
}
final Object copy = copyCache.get( entity );
@@ -230,25 +306,54 @@
//cascadeOnMerge(event, persister, entity, copyCache, Cascades.CASCADE_BEFORE_MERGE);
super.cascadeBeforeSave(source, persister, entity, copyCache);
copyValues(persister, entity, copy, source, copyCache, ForeignKeyDirection.FOREIGN_KEY_FROM_PARENT);
-
- //this bit is only *really* absolutely necessary for handling
- //requestedId, but is also good if we merge multiple object
- //graphs, since it helps ensure uniqueness
- final Serializable requestedId = event.getRequestedId();
- if (requestedId==null) {
- saveWithGeneratedId( copy, entityName, copyCache, source, false );
+
+ try {
+ //this bit is only *really* absolutely necessary for handling
+ //requestedId, but is also good if we merge multiple object
+ //graphs, since it helps ensure uniqueness
+ if (requestedId==null) {
+ saveWithGeneratedId( copy, entityName, copyCache, source, false );
+ }
+ else {
+ saveWithRequestedId( copy, requestedId, entityName, copyCache, source );
+ }
}
- else {
- saveWithRequestedId( copy, requestedId, entityName, copyCache, source );
+ catch (PropertyValueException ex) {
+ String propertyName = ex.getPropertyName();
+ Object propertyFromCopy = persister.getPropertyValue( copy, propertyName, source.getEntityMode() );
+ Object propertyFromEntity = persister.getPropertyValue( entity, propertyName, source.getEntityMode() );
+ Type propertyType = persister.getPropertyType( propertyName );
+ EntityEntry copyEntry = source.getPersistenceContext().getEntry( copy );
+ if ( propertyFromCopy == null || ! propertyType.isEntityType() ) {
+ log.trace( "property '" + copyEntry.getEntityName() + "." + propertyName +
+ "' is null or not an entity; " + propertyName + " =["+propertyFromCopy+"]");
+ throw ex;
+ }
+ if ( ! copyCache.containsKey( propertyFromEntity ) ) {
+ log.trace( "property '" + copyEntry.getEntityName() + "." + propertyName +
+ "' from original entity is not in copyCache; " + propertyName + " =["+propertyFromEntity+"]");
+ throw ex;
+ }
+ if ( ( ( CopyCache ) copyCache ).isIncludedInMerge( propertyFromEntity ) ) {
+ log.trace( "property '" + copyEntry.getEntityName() + "." + propertyName +
+ "' from original entity is in copyCache and is in the process of being merged; " +
+ propertyName + " =["+propertyFromEntity+"]");
+ }
+ else {
+ log.trace( "property '" + copyEntry.getEntityName() + "." + propertyName +
+ "' from original entity is in copyCache and is not in the process of being merged; " +
+ propertyName + " =["+propertyFromEntity+"]");
+ }
+ // continue...; we'll find out if it ends up not getting saved later
}
-
- // cascade first, so that all unsaved objects get their
+
+ // cascade first, so that all unsaved objects get their
// copy created before we actually copy
super.cascadeAfterSave(source, persister, entity, copyCache);
copyValues(persister, entity, copy, source, copyCache, ForeignKeyDirection.FOREIGN_KEY_TO_PARENT);
-
- event.setResult(copy);
+ return copy;
+
}
protected void entityIsDetached(MergeEvent event, Map copyCache) {
@@ -260,7 +365,7 @@
final EntityPersister persister = source.getEntityPersister( event.getEntityName(), entity );
final String entityName = persister.getEntityName();
-
+
Serializable id = event.getRequestedId();
if ( id == null ) {
id = persister.getIdentifier( entity, source.getEntityMode() );
@@ -293,7 +398,7 @@
entityIsTransient(event, copyCache);
}
else {
- copyCache.put(entity, result); //before cascade!
+ ( ( CopyCache ) copyCache ).put( entity, result, true ); //before cascade!
final Object target = source.getPersistenceContext().unproxy(result);
if ( target == entity ) {
@@ -381,7 +486,7 @@
return entry.isExistsInDatabase();
}
}
-
+
protected void copyValues(
final EntityPersister persister,
final Object entity,
@@ -389,7 +494,6 @@
final SessionImplementor source,
final Map copyCache
) {
-
final Object[] copiedValues = TypeFactory.replace(
persister.getPropertyValues( entity, source.getEntityMode() ),
persister.getPropertyValues( target, source.getEntityMode() ),
Modified: core/branches/Branch_3_2/test/org/hibernate/test/AllTests.java
===================================================================
--- core/branches/Branch_3_2/test/org/hibernate/test/AllTests.java 2009-05-13 13:39:03 UTC (rev 16560)
+++ core/branches/Branch_3_2/test/org/hibernate/test/AllTests.java 2009-05-13 22:17:08 UTC (rev 16561)
@@ -22,6 +22,8 @@
import org.hibernate.test.cascade.BidirectionalOneToManyCascadeTest;
import org.hibernate.test.cascade.MultiPathCascadeTest;
import org.hibernate.test.cascade.RefreshTest;
+import org.hibernate.test.cascade.circle.CascadeMergeToChildBeforeParentTest;
+import org.hibernate.test.cascade.circle.MultiPathCircleCascadeTest;
import org.hibernate.test.cfg.ListenerTest;
import org.hibernate.test.cid.CompositeIdTest;
import org.hibernate.test.collection.bag.PersistentBagTest;
@@ -404,6 +406,8 @@
suite.addTest( BidirectionalOneToManyCascadeTest.suite() );
suite.addTest( RefreshTest.suite() );
suite.addTest( MultiPathCascadeTest.suite() );
+ suite.addTest( CascadeMergeToChildBeforeParentTest.suite() );
+ suite.addTest( MultiPathCircleCascadeTest.suite() );
suite.addTest( ListenerTest.suite() );
suite.addTest( BrokenCollectionEventTest.suite() );
suite.addTest( BidirectionalManyToManyBagToSetCollectionEventTest.suite() );
Modified: core/branches/Branch_3_2/test/org/hibernate/test/cascade/A.java
===================================================================
--- core/branches/Branch_3_2/test/org/hibernate/test/cascade/A.java 2009-05-13 13:39:03 UTC (rev 16560)
+++ core/branches/Branch_3_2/test/org/hibernate/test/cascade/A.java 2009-05-13 22:17:08 UTC (rev 16561)
@@ -1,4 +1,28 @@
-// $Id$
+//$Id: $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
package org.hibernate.test.cascade;
Modified: core/branches/Branch_3_2/test/org/hibernate/test/cascade/G.java
===================================================================
--- core/branches/Branch_3_2/test/org/hibernate/test/cascade/G.java 2009-05-13 13:39:03 UTC (rev 16560)
+++ core/branches/Branch_3_2/test/org/hibernate/test/cascade/G.java 2009-05-13 22:17:08 UTC (rev 16561)
@@ -1,3 +1,29 @@
+//$Id: $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+
package org.hibernate.test.cascade;
import java.util.Set;
Modified: core/branches/Branch_3_2/test/org/hibernate/test/cascade/H.java
===================================================================
--- core/branches/Branch_3_2/test/org/hibernate/test/cascade/H.java 2009-05-13 13:39:03 UTC (rev 16560)
+++ core/branches/Branch_3_2/test/org/hibernate/test/cascade/H.java 2009-05-13 22:17:08 UTC (rev 16561)
@@ -1,6 +1,29 @@
-// $Id$
+//$Id: $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
-
package org.hibernate.test.cascade;
import java.util.Set;
Modified: core/branches/Branch_3_2/test/org/hibernate/test/cascade/MultiPathCascadeTest.java
===================================================================
--- core/branches/Branch_3_2/test/org/hibernate/test/cascade/MultiPathCascadeTest.java 2009-05-13 13:39:03 UTC (rev 16560)
+++ core/branches/Branch_3_2/test/org/hibernate/test/cascade/MultiPathCascadeTest.java 2009-05-13 22:17:08 UTC (rev 16561)
@@ -1,4 +1,28 @@
//$Id: $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
package org.hibernate.test.cascade;
Added: core/branches/Branch_3_2/test/org/hibernate/test/cascade/circle/CascadeMergeToChildBeforeParent.hbm.xml
===================================================================
--- core/branches/Branch_3_2/test/org/hibernate/test/cascade/circle/CascadeMergeToChildBeforeParent.hbm.xml (rev 0)
+++ core/branches/Branch_3_2/test/org/hibernate/test/cascade/circle/CascadeMergeToChildBeforeParent.hbm.xml 2009-05-13 22:17:08 UTC (rev 16561)
@@ -0,0 +1,115 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
+
+<hibernate-mapping package="org.hibernate.test.cascade.circle">
+
+ <class name="Route" table="HB_Route">
+
+ <id name="routeID" type="long"><generator class="native"/></id>
+ <version name="version" column="VERS" type="long" />
+
+ <property name="name" type="string" not-null="true"/>
+
+ <set name="nodes" inverse="true" cascade="persist,merge,refresh">
+ <key column="routeID"/>
+ <one-to-many class="Node"/>
+ </set>
+ <set name="vehicles" inverse="true" cascade="persist,merge,refresh">
+ <key column="routeID"/>
+ <one-to-many class="Vehicle"/>
+ </set>
+ </class>
+
+ <class name="Tour" table="HB_Tour">
+
+ <id name="tourID" type="long"><generator class="native"/></id>
+ <version name="version" column="VERS" type="long" />
+
+ <property name="name" type="string" not-null="true"/>
+
+ <set name="nodes" inverse="true" lazy="true" cascade="merge,refresh">
+ <key column="tourID"/>
+ <one-to-many class="Node"/>
+ </set>
+ </class>
+
+ <class name="Transport" table="HB_Transport">
+
+ <id name="transportID" type="long"><generator class="native"/></id>
+ <version name="version" column="VERS" type="long" />
+
+ <property name="name" type="string" not-null="true"/>
+
+ <many-to-one name="pickupNode"
+ column="pickupNodeID"
+ unique="true"
+ not-null="true"
+ cascade="merge,refresh"
+ lazy="false"/>
+
+ <many-to-one name="deliveryNode"
+ column="deliveryNodeID"
+ unique="true"
+ not-null="true"
+ cascade="merge,refresh"
+ lazy="false"/>
+
+ <many-to-one name="vehicle"
+ column="vehicleID"
+ unique="false"
+ not-null="true"
+ cascade="none"
+ lazy="false"/>
+ </class>
+
+ <class name="Vehicle" table="HB_Vehicle">
+ <id name="vehicleID" type="long"><generator class="native"/></id>
+ <version name="version" column="VERS" type="long" />
+
+ <property name="name"/>
+ <set name="transports" inverse="false" lazy="true" cascade="merge,refresh">
+ <key column="vehicleID"/>
+ <one-to-many class="Transport" not-found="exception"/>
+ </set>
+ <many-to-one name="route"
+ column="routeID"
+ unique="false"
+ not-null="true"
+ cascade="none"
+ lazy="false"/>
+ </class>
+
+
+ <class name="Node" table="HB_Node">
+
+ <id name="nodeID" type="long"><generator class="native"/></id>
+ <version name="version" column="VERS" type="long" />
+
+ <property name="name" type="string" not-null="true"/>
+
+ <set name="deliveryTransports" inverse="true" lazy="true" cascade="merge,refresh">
+ <key column="deliveryNodeID"/>
+ <one-to-many class="Transport"/>
+ </set>
+
+ <set name="pickupTransports" inverse="true" lazy="true" cascade="merge,refresh">
+ <key column="pickupNodeID"/>
+ <one-to-many class="Transport"/>
+ </set>
+
+ <many-to-one name="route"
+ column="routeID"
+ unique="false"
+ not-null="true"
+ cascade="none"
+ lazy="false"/>
+
+ <many-to-one name="tour"
+ column="tourID"
+ unique="false"
+ not-null="false"
+ cascade="merge,refresh"
+ lazy="false"/>
+ </class>
+
+</hibernate-mapping>
Added: core/branches/Branch_3_2/test/org/hibernate/test/cascade/circle/CascadeMergeToChildBeforeParentTest.java
===================================================================
--- core/branches/Branch_3_2/test/org/hibernate/test/cascade/circle/CascadeMergeToChildBeforeParentTest.java (rev 0)
+++ core/branches/Branch_3_2/test/org/hibernate/test/cascade/circle/CascadeMergeToChildBeforeParentTest.java 2009-05-13 22:17:08 UTC (rev 16561)
@@ -0,0 +1,288 @@
+//$Id: $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+
+package org.hibernate.test.cascade.circle;
+
+import junit.framework.Test;
+
+import org.hibernate.Session;
+import org.hibernate.junit.functional.FunctionalTestCase;
+import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
+
+/**
+ * The test case uses the following model:
+ *
+ * <- ->
+ * -- (N : 0,1) -- Tour
+ * | <- ->
+ * | -- (1 : N) -- (pickup) ----
+ * -> | | |
+ * Route -- (1 : N) - Node Transport
+ * | | <- -> | |
+ * | -- (1 : N) -- (delivery) -- |
+ * | |
+ * | -> -> |
+ * -------- (1 : N) ---- Vehicle--(1 : N)------------
+ *
+ * Arrows indicate the direction of cascade-merge.
+ *
+ * I believe it reproduces the following issue:
+ * http://opensource.atlassian.com/projects/hibernate/browse/HHH-3544
+ *
+ * @author Gail Badner (based on original model provided by Pavol Zibrita)
+ */
+public class CascadeMergeToChildBeforeParentTest extends FunctionalTestCase {
+
+ public CascadeMergeToChildBeforeParentTest(String string) {
+ super(string);
+ }
+
+ public String[] getMappings() {
+ return new String[] {
+ "cascade/circle/CascadeMergeToChildBeforeParent.hbm.xml"
+ };
+ }
+
+ public static Test suite() {
+ return new FunctionalTestClassTestSuite( CascadeMergeToChildBeforeParentTest.class );
+ }
+
+ protected void cleanupTest() {
+ Session s = openSession();
+ s.beginTransaction();
+ s.createQuery( "delete from Transport" );
+ s.createQuery( "delete from Tour" );
+ s.createQuery( "delete from Node" );
+ s.createQuery( "delete from Route" );
+ s.createQuery( "delete from Vehicle" );
+ }
+
+ public void testMerge()
+ {
+ Session s = openSession();
+ s.beginTransaction();
+
+ Route route = new Route();
+ route.setName("routeA");
+
+ s.save( route );
+ s.getTransaction().commit();
+ s.close();
+
+ s = openSession();
+ s.beginTransaction();
+
+ route = (Route) s.get(Route.class, new Long(1));
+
+ route.setTransientField(new String("sfnaouisrbn"));
+
+ Tour tour = new Tour();
+ tour.setName("tourB");
+
+ Node pickupNode = new Node();
+ pickupNode.setName("pickupNodeB");
+
+ Node deliveryNode = new Node();
+ deliveryNode.setName("deliveryNodeB");
+
+ pickupNode.setRoute(route);
+ pickupNode.setTour(tour);
+ pickupNode.setTransientField("pickup node aaaaaaaaaaa");
+
+ deliveryNode.setRoute(route);
+ deliveryNode.setTour(tour);
+ deliveryNode.setTransientField("delivery node aaaaaaaaa");
+
+ tour.getNodes().add(pickupNode);
+ tour.getNodes().add(deliveryNode);
+
+ route.getNodes().add(pickupNode);
+ route.getNodes().add(deliveryNode);
+
+ Route mergedRoute = (Route) s.merge(route);
+
+ s.getTransaction().commit();
+ s.close();
+ }
+
+ // This test fails because the merge algorithm tries to save a
+ // transient child (transport) before cascade-merge gets its
+ // transient parent (vehicle); merge does not cascade from the
+ // child to the parent.
+ public void testMergeTransientChildBeforeTransientParent()
+ {
+ Session s = openSession();
+ s.beginTransaction();
+
+ Route route = new Route();
+ route.setName("routeA");
+
+ s.save( route );
+ s.getTransaction().commit();
+ s.close();
+
+ s = openSession();
+ s.beginTransaction();
+
+ route = (Route) s.get(Route.class, new Long(1));
+
+ route.setTransientField(new String("sfnaouisrbn"));
+
+ Tour tour = new Tour();
+ tour.setName("tourB");
+
+ Transport transport = new Transport();
+ transport.setName("transportB");
+
+ Node pickupNode = new Node();
+ pickupNode.setName("pickupNodeB");
+
+ Node deliveryNode = new Node();
+ deliveryNode.setName("deliveryNodeB");
+
+ Vehicle vehicle = new Vehicle();
+ vehicle.setName("vehicleB");
+
+ pickupNode.setRoute(route);
+ pickupNode.setTour(tour);
+ pickupNode.getPickupTransports().add(transport);
+ pickupNode.setTransientField("pickup node aaaaaaaaaaa");
+
+ deliveryNode.setRoute(route);
+ deliveryNode.setTour(tour);
+ deliveryNode.getDeliveryTransports().add(transport);
+ deliveryNode.setTransientField("delivery node aaaaaaaaa");
+
+ tour.getNodes().add(pickupNode);
+ tour.getNodes().add(deliveryNode);
+
+ route.getNodes().add(pickupNode);
+ route.getNodes().add(deliveryNode);
+ route.getVehicles().add(vehicle);
+
+ transport.setPickupNode(pickupNode);
+ transport.setDeliveryNode(deliveryNode);
+ transport.setVehicle( vehicle );
+ transport.setTransientField("aaaaaaaaaaaaaa");
+
+ vehicle.getTransports().add(transport);
+ vehicle.setTransientField( "anewvalue" );
+ vehicle.setRoute( route );
+
+ Route mergedRoute = (Route) s.merge(route);
+
+ s.getTransaction().commit();
+ s.close();
+ }
+
+ public void testMergeData3Nodes()
+ {
+
+ Session s = openSession();
+ s.beginTransaction();
+
+ Route route = new Route();
+ route.setName("routeA");
+
+ s.save( route );
+ s.getTransaction().commit();
+ s.close();
+
+ s = openSession();
+ s.beginTransaction();
+
+ route = (Route) s.get(Route.class, new Long(1));
+
+ route.setTransientField(new String("sfnaouisrbn"));
+
+ Tour tour = new Tour();
+ tour.setName("tourB");
+
+ Transport transport1 = new Transport();
+ transport1.setName("TRANSPORT1");
+
+ Transport transport2 = new Transport();
+ transport2.setName("TRANSPORT2");
+
+ Node node1 = new Node();
+ node1.setName("NODE1");
+
+ Node node2 = new Node();
+ node2.setName("NODE2");
+
+ Node node3 = new Node();
+ node3.setName("NODE3");
+
+ Vehicle vehicle = new Vehicle();
+ vehicle.setName("vehicleB");
+
+ node1.setRoute(route);
+ node1.setTour(tour);
+ node1.getPickupTransports().add(transport1);
+ node1.setTransientField("node 1");
+
+ node2.setRoute(route);
+ node2.setTour(tour);
+ node2.getDeliveryTransports().add(transport1);
+ node2.getPickupTransports().add(transport2);
+ node2.setTransientField("node 2");
+
+ node3.setRoute(route);
+ node3.setTour(tour);
+ node3.getDeliveryTransports().add(transport2);
+ node3.setTransientField("node 3");
+
+ tour.getNodes().add(node1);
+ tour.getNodes().add(node2);
+ tour.getNodes().add(node3);
+
+ route.getNodes().add(node1);
+ route.getNodes().add(node2);
+ route.getNodes().add(node3);
+ route.getVehicles().add(vehicle);
+
+ transport1.setPickupNode(node1);
+ transport1.setDeliveryNode(node2);
+ transport1.setVehicle( vehicle );
+ transport1.setTransientField("aaaaaaaaaaaaaa");
+
+ transport2.setPickupNode(node2);
+ transport2.setDeliveryNode(node3);
+ transport2.setVehicle( vehicle );
+ transport2.setTransientField("bbbbbbbbbbbbb");
+
+ vehicle.getTransports().add(transport1);
+ vehicle.getTransports().add(transport2);
+ vehicle.setTransientField( "anewvalue" );
+ vehicle.setRoute( route );
+
+ Route mergedRoute = (Route) s.merge(route);
+
+ s.getTransaction().commit();
+ s.close();
+ }
+
+}
Added: core/branches/Branch_3_2/test/org/hibernate/test/cascade/circle/MultiPathCircleCascade.hbm.xml
===================================================================
--- core/branches/Branch_3_2/test/org/hibernate/test/cascade/circle/MultiPathCircleCascade.hbm.xml (rev 0)
+++ core/branches/Branch_3_2/test/org/hibernate/test/cascade/circle/MultiPathCircleCascade.hbm.xml 2009-05-13 22:17:08 UTC (rev 16561)
@@ -0,0 +1,82 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
+
+<hibernate-mapping package="org.hibernate.test.cascade.circle">
+
+ <class name="Route" table="HB_Route">
+
+ <id name="routeID" type="long"><generator class="native"/></id>
+
+ <property name="name" type="string" not-null="true"/>
+
+ <set name="nodes" inverse="true" cascade="persist,merge,refresh">
+ <key column="routeID"/>
+ <one-to-many class="Node"/>
+ </set>
+ </class>
+
+ <class name="Tour" table="HB_Tour">
+
+ <id name="tourID" type="long"><generator class="native"/></id>
+
+ <property name="name" type="string" not-null="true"/>
+
+ <set name="nodes" inverse="true" lazy="true" cascade="merge,refresh">
+ <key column="tourID"/>
+ <one-to-many class="Node"/>
+ </set>
+ </class>
+
+ <class name="Transport" table="HB_Transport">
+
+ <id name="transportID" type="long"><generator class="native"/></id>
+
+ <property name="name" type="string" not-null="true"/>
+
+ <many-to-one name="pickupNode"
+ column="pickupNodeID"
+ unique="true"
+ not-null="true"
+ cascade="merge,refresh"
+ lazy="false"/>
+
+ <many-to-one name="deliveryNode"
+ column="deliveryNodeID"
+ unique="true"
+ not-null="true"
+ cascade="merge,refresh"
+ lazy="false"/>
+ </class>
+
+ <class name="Node" table="HB_Node">
+
+ <id name="nodeID" type="long"><generator class="native"/></id>
+
+ <property name="name" type="string" not-null="true"/>
+
+ <set name="deliveryTransports" inverse="true" lazy="true" cascade="merge,refresh">
+ <key column="deliveryNodeID"/>
+ <one-to-many class="Transport"/>
+ </set>
+
+ <set name="pickupTransports" inverse="true" lazy="true" cascade="merge,refresh">
+ <key column="pickupNodeID"/>
+ <one-to-many class="Transport"/>
+ </set>
+
+ <many-to-one name="route"
+ column="routeID"
+ unique="false"
+ not-null="true"
+ cascade="none"
+ lazy="false"/>
+
+ <many-to-one name="tour"
+ column="tourID"
+ unique="false"
+ not-null="false"
+ cascade="merge,refresh"
+ lazy="false"/>
+ </class>
+
+</hibernate-mapping>
Added: core/branches/Branch_3_2/test/org/hibernate/test/cascade/circle/MultiPathCircleCascadeTest.java
===================================================================
--- core/branches/Branch_3_2/test/org/hibernate/test/cascade/circle/MultiPathCircleCascadeTest.java (rev 0)
+++ core/branches/Branch_3_2/test/org/hibernate/test/cascade/circle/MultiPathCircleCascadeTest.java 2009-05-13 22:17:08 UTC (rev 16561)
@@ -0,0 +1,459 @@
+//$Id: $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+
+package org.hibernate.test.cascade.circle;
+
+import java.util.Iterator;
+
+import junit.framework.Test;
+
+import org.hibernate.Session;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Environment;
+import org.hibernate.junit.functional.FunctionalTestCase;
+import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
+
+/**
+ * The test case uses the following model:
+ *
+ * <- ->
+ * -- (N : 0,1) -- Tour
+ * | <- ->
+ * | -- (1 : N) -- (pickup) ----
+ * -> | | |
+ * Route -- (1 : N) -- Node Transport
+ * | <- -> |
+ * -- (1 : N) -- (delivery) --
+ *
+ * Arrows indicate the direction of cascade-merge.
+ *
+ * It reproduced the following issues:
+ * http://opensource.atlassian.com/projects/hibernate/browse/HHH-3046
+ * http://opensource.atlassian.com/projects/hibernate/browse/HHH-3810
+ *
+ * This tests that merge is cascaded properly from each entity.
+ *
+ * @author Pavol Zibrita, Gail Badner
+ */
+public class MultiPathCircleCascadeTest extends FunctionalTestCase {
+
+ public MultiPathCircleCascadeTest(String string) {
+ super(string);
+ }
+
+ public void configure(Configuration cfg) {
+ cfg.setProperty( Environment.GENERATE_STATISTICS, "true");
+ cfg.setProperty( Environment.STATEMENT_BATCH_SIZE, "0" );
+ }
+
+ public String[] getMappings() {
+ return new String[] {
+ "cascade/circle/MultiPathCircleCascade.hbm.xml"
+ };
+ }
+
+ public static Test suite() {
+ return new FunctionalTestClassTestSuite( MultiPathCircleCascadeTest.class );
+ }
+
+ protected void cleanupTest() {
+ Session s = openSession();
+ s.beginTransaction();
+ s.createQuery( "delete from Transport" );
+ s.createQuery( "delete from Tour" );
+ s.createQuery( "delete from Node" );
+ s.createQuery( "delete from Route" );
+ }
+
+ public void testMergeRoute()
+ {
+
+ Route route = getUpdatedDetachedEntity();
+
+ clearCounts();
+
+ Session s = openSession();
+ s.beginTransaction();
+
+ s.merge(route);
+
+ s.getTransaction().commit();
+ s.close();
+
+ assertInsertCount( 4 );
+ assertUpdateCount( 1 );
+
+ s = openSession();
+ s.beginTransaction();
+ route = ( Route ) s.get( Route.class, route.getRouteID() );
+ checkResults( route, true );
+ s.getTransaction().commit();
+ s.close();
+ }
+
+ public void testMergePickupNode()
+ {
+
+ Route route = getUpdatedDetachedEntity();
+
+ clearCounts();
+
+ Session s = openSession();
+ s.beginTransaction();
+
+ Iterator it=route.getNodes().iterator();
+ Node node = ( Node ) it.next();
+ Node pickupNode;
+ if ( node.getName().equals( "pickupNodeB") ) {
+ pickupNode = node;
+ }
+ else {
+ node = ( Node ) it.next();
+ assertEquals( "pickupNodeB", node.getName() );
+ pickupNode = node;
+ }
+
+ pickupNode = ( Node ) s.merge( pickupNode );
+
+ s.getTransaction().commit();
+ s.close();
+
+ assertInsertCount( 4 );
+ assertUpdateCount( 0 );
+
+ s = openSession();
+ s.beginTransaction();
+ route = ( Route ) s.get( Route.class, route.getRouteID() );
+ checkResults( route, false );
+ s.getTransaction().commit();
+ s.close();
+ }
+
+ public void testMergeDeliveryNode()
+ {
+
+ Route route = getUpdatedDetachedEntity();
+
+ clearCounts();
+
+ Session s = openSession();
+ s.beginTransaction();
+
+ Iterator it=route.getNodes().iterator();
+ Node node = ( Node ) it.next();
+ Node deliveryNode;
+ if ( node.getName().equals( "deliveryNodeB") ) {
+ deliveryNode = node;
+ }
+ else {
+ node = ( Node ) it.next();
+ assertEquals( "deliveryNodeB", node.getName() );
+ deliveryNode = node;
+ }
+
+ deliveryNode = ( Node ) s.merge( deliveryNode );
+
+ s.getTransaction().commit();
+ s.close();
+
+ assertInsertCount( 4 );
+ assertUpdateCount( 0 );
+
+ s = openSession();
+ s.beginTransaction();
+ route = ( Route ) s.get( Route.class, route.getRouteID() );
+ checkResults( route, false );
+ s.getTransaction().commit();
+ s.close();
+ }
+
+ public void testMergeTour()
+ {
+
+ Route route = getUpdatedDetachedEntity();
+
+ clearCounts();
+
+ Session s = openSession();
+ s.beginTransaction();
+
+ Tour tour = ( Tour ) s.merge( ( ( Node ) route.getNodes().toArray()[0]).getTour() );
+
+ s.getTransaction().commit();
+ s.close();
+
+ assertInsertCount( 4 );
+ assertUpdateCount( 0 );
+
+ s = openSession();
+ s.beginTransaction();
+ route = ( Route ) s.get( Route.class, route.getRouteID() );
+ checkResults( route, false );
+ s.getTransaction().commit();
+ s.close();
+ }
+
+ public void testMergeTransport()
+ {
+
+ Route route = getUpdatedDetachedEntity();
+
+ clearCounts();
+
+ Session s = openSession();
+ s.beginTransaction();
+
+ Node node = ( ( Node ) route.getNodes().toArray()[0]);
+ Transport transport;
+ if ( node.getPickupTransports().size() == 1 ) {
+ transport = ( Transport ) node.getPickupTransports().toArray()[0];
+ }
+ else {
+ transport = ( Transport ) node.getDeliveryTransports().toArray()[0];
+ }
+
+ transport = ( Transport ) s.merge( transport );
+
+ s.getTransaction().commit();
+ s.close();
+
+ assertInsertCount( 4 );
+ assertUpdateCount( 0 );
+
+ s = openSession();
+ s.beginTransaction();
+ route = ( Route ) s.get( Route.class, route.getRouteID() );
+ checkResults( route, false );
+ s.getTransaction().commit();
+ s.close();
+ }
+
+ private Route getUpdatedDetachedEntity() {
+
+ Session s = openSession();
+ s.beginTransaction();
+
+ Route route = new Route();
+ route.setName("routeA");
+
+ s.save( route );
+ s.getTransaction().commit();
+ s.close();
+
+ route.setName( "new routeA" );
+ route.setTransientField(new String("sfnaouisrbn"));
+
+ Tour tour = new Tour();
+ tour.setName("tourB");
+
+ Transport transport = new Transport();
+ transport.setName("transportB");
+
+ Node pickupNode = new Node();
+ pickupNode.setName("pickupNodeB");
+
+ Node deliveryNode = new Node();
+ deliveryNode.setName("deliveryNodeB");
+
+ pickupNode.setRoute(route);
+ pickupNode.setTour(tour);
+ pickupNode.getPickupTransports().add(transport);
+ pickupNode.setTransientField("pickup node aaaaaaaaaaa");
+
+ deliveryNode.setRoute(route);
+ deliveryNode.setTour(tour);
+ deliveryNode.getDeliveryTransports().add(transport);
+ deliveryNode.setTransientField("delivery node aaaaaaaaa");
+
+ tour.getNodes().add(pickupNode);
+ tour.getNodes().add(deliveryNode);
+
+ route.getNodes().add(pickupNode);
+ route.getNodes().add(deliveryNode);
+
+ transport.setPickupNode(pickupNode);
+ transport.setDeliveryNode(deliveryNode);
+ transport.setTransientField("aaaaaaaaaaaaaa");
+
+ return route;
+ }
+
+ private void checkResults(Route route, boolean isRouteUpdated) {
+ // since merge is not cascaded to route, this method needs to
+ // know whether route is expected to be updated
+ if ( isRouteUpdated ) {
+ assertEquals( "new routeA", route.getName() );
+ }
+ assertEquals( 2, route.getNodes().size() );
+ Node deliveryNode = null;
+ Node pickupNode = null;
+ for( Iterator it=route.getNodes().iterator(); it.hasNext(); ) {
+ Node node = ( Node ) it.next();
+ if( "deliveryNodeB".equals( node.getName( ) ) ) {
+ deliveryNode = node;
+ }
+ else if( "pickupNodeB".equals( node.getName() ) ) {
+ pickupNode = node;
+ }
+ else {
+ fail( "unknown node");
+ }
+ }
+ assertNotNull( deliveryNode );
+ assertSame( route, deliveryNode.getRoute() );
+ assertEquals( 1, deliveryNode.getDeliveryTransports().size() );
+ assertEquals( 0, deliveryNode.getPickupTransports().size() );
+ assertNotNull( deliveryNode.getTour() );
+ assertEquals( "node original value", deliveryNode.getTransientField() );
+
+ assertNotNull( pickupNode );
+ assertSame( route, pickupNode.getRoute() );
+ assertEquals( 0, pickupNode.getDeliveryTransports().size() );
+ assertEquals( 1, pickupNode.getPickupTransports().size() );
+ assertNotNull( pickupNode.getTour() );
+ assertEquals( "node original value", pickupNode.getTransientField() );
+
+ assertTrue( ! deliveryNode.getNodeID().equals( pickupNode.getNodeID() ) );
+ assertSame( deliveryNode.getTour(), pickupNode.getTour() );
+ assertSame( deliveryNode.getDeliveryTransports().iterator().next(),
+ pickupNode.getPickupTransports().iterator().next() );
+
+ Tour tour = deliveryNode.getTour();
+ Transport transport = ( Transport ) deliveryNode.getDeliveryTransports().iterator().next();
+
+ assertEquals( "tourB", tour.getName() );
+ assertEquals( 2, tour.getNodes().size() );
+ assertTrue( tour.getNodes().contains( deliveryNode ) );
+ assertTrue( tour.getNodes().contains( pickupNode ) );
+
+ assertEquals( "transportB", transport.getName() );
+ assertSame( deliveryNode, transport.getDeliveryNode() );
+ assertSame( pickupNode, transport.getPickupNode() );
+ assertEquals( "transport original value", transport.getTransientField() );
+ }
+
+ public void testMergeData3Nodes()
+ {
+
+ Session s = openSession();
+ s.beginTransaction();
+
+ Route route = new Route();
+ route.setName("routeA");
+
+ s.save( route );
+ s.getTransaction().commit();
+ s.close();
+
+ clearCounts();
+
+ s = openSession();
+ s.beginTransaction();
+
+ route = (Route) s.get(Route.class, new Long(1));
+ //System.out.println(route);
+ route.setName( "new routA" );
+
+ route.setTransientField(new String("sfnaouisrbn"));
+
+ Tour tour = new Tour();
+ tour.setName("tourB");
+
+ Transport transport1 = new Transport();
+ transport1.setName("TRANSPORT1");
+
+ Transport transport2 = new Transport();
+ transport2.setName("TRANSPORT2");
+
+ Node node1 = new Node();
+ node1.setName("NODE1");
+
+ Node node2 = new Node();
+ node2.setName("NODE2");
+
+ Node node3 = new Node();
+ node3.setName("NODE3");
+
+ node1.setRoute(route);
+ node1.setTour(tour);
+ node1.getPickupTransports().add(transport1);
+ node1.setTransientField("node 1");
+
+ node2.setRoute(route);
+ node2.setTour(tour);
+ node2.getDeliveryTransports().add(transport1);
+ node2.getPickupTransports().add(transport2);
+ node2.setTransientField("node 2");
+
+ node3.setRoute(route);
+ node3.setTour(tour);
+ node3.getDeliveryTransports().add(transport2);
+ node3.setTransientField("node 3");
+
+ tour.getNodes().add(node1);
+ tour.getNodes().add(node2);
+ tour.getNodes().add(node3);
+
+ route.getNodes().add(node1);
+ route.getNodes().add(node2);
+ route.getNodes().add(node3);
+
+ transport1.setPickupNode(node1);
+ transport1.setDeliveryNode(node2);
+ transport1.setTransientField("aaaaaaaaaaaaaa");
+
+ transport2.setPickupNode(node2);
+ transport2.setDeliveryNode(node3);
+ transport2.setTransientField("bbbbbbbbbbbbb");
+
+ Route mergedRoute = (Route) s.merge(route);
+
+ s.getTransaction().commit();
+ s.close();
+
+ assertInsertCount( 6 );
+ assertUpdateCount( 1 );
+ }
+
+ protected void clearCounts() {
+ getSessions().getStatistics().clear();
+ }
+
+ protected void assertInsertCount(int expected) {
+ int inserts = ( int ) getSessions().getStatistics().getEntityInsertCount();
+ assertEquals( "unexpected insert count", expected, inserts );
+ }
+
+ protected void assertUpdateCount(int expected) {
+ int updates = ( int ) getSessions().getStatistics().getEntityUpdateCount();
+ assertEquals( "unexpected update counts", expected, updates );
+ }
+
+ protected void assertDeleteCount(int expected) {
+ int deletes = ( int ) getSessions().getStatistics().getEntityDeleteCount();
+ assertEquals( "unexpected delete counts", expected, deletes );
+ }
+}
Added: core/branches/Branch_3_2/test/org/hibernate/test/cascade/circle/Node.java
===================================================================
--- core/branches/Branch_3_2/test/org/hibernate/test/cascade/circle/Node.java (rev 0)
+++ core/branches/Branch_3_2/test/org/hibernate/test/cascade/circle/Node.java 2009-05-13 22:17:08 UTC (rev 16561)
@@ -0,0 +1,154 @@
+//$Id: $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+
+package org.hibernate.test.cascade.circle;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.HashSet;
+
+public class Node {
+
+// @Id
+// @SequenceGenerator(name="NODE_SEQ", sequenceName="NODE_SEQ", initialValue=1, allocationSize=1)
+// @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="NODE_SEQ")
+ private Long nodeID;
+
+ private long version;
+
+ private String name;
+
+ /** the list of orders that are delivered at this node */
+// @OneToMany(fetch=FetchType.LAZY, cascade={CascadeType.MERGE, CascadeType.REFRESH}, mappedBy="deliveryNode")
+ private Set deliveryTransports = new HashSet();
+
+ /** the list of orders that are picked up at this node */
+// @OneToMany(fetch=FetchType.LAZY, cascade=CascadeType.ALL, mappedBy="pickupNode")
+ private Set pickupTransports = new HashSet();
+
+ /** the route to which this node belongs */
+// @ManyToOne(targetEntity=Route.class, optional=false, fetch=FetchType.EAGER)
+// @JoinColumn(name="ROUTEID", nullable=false, insertable=true, updatable=true)
+ private Route route = null;
+
+ /** the tour this node belongs to, null if this node does not belong to a tour (e.g first node of a route) */
+// @ManyToOne(targetEntity=Tour.class, cascade={CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}, optional=true, fetch=FetchType.LAZY)
+// @JoinColumn(name="TOURID", nullable=true, insertable=true, updatable=true)
+ private Tour tour;
+
+// @Transient
+ private String transientField = "node original value";
+
+ public Set getDeliveryTransports() {
+ return deliveryTransports;
+ }
+
+ public void setDeliveryTransports(Set deliveryTransports) {
+ this.deliveryTransports = deliveryTransports;
+ }
+
+ public Set getPickupTransports() {
+ return pickupTransports;
+ }
+
+ public void setPickupTransports(Set pickupTransports) {
+ this.pickupTransports = pickupTransports;
+ }
+
+ public Long getNodeID() {
+ return nodeID;
+ }
+
+ public long getVersion() {
+ return version;
+ }
+
+ protected void setVersion(long version) {
+ this.version = version;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Route getRoute() {
+ return route;
+ }
+
+ public void setRoute(Route route) {
+ this.route = route;
+ }
+
+ public Tour getTour() {
+ return tour;
+ }
+
+ public void setTour(Tour tour) {
+ this.tour = tour;
+ }
+
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer();
+
+ buffer.append( name + " id: " + nodeID );
+ if ( route != null ) {
+ buffer.append( " route name: " ).append( route.getName() ).append( " tour name: " ).append( tour.getName() );
+ }
+ if ( pickupTransports != null ) {
+ for (Iterator it = pickupTransports.iterator(); it.hasNext();) {
+ buffer.append("Pickup transports: " + it.next());
+ }
+ }
+
+ if ( deliveryTransports != null ) {
+ for (Iterator it = deliveryTransports.iterator(); it.hasNext();) {
+ buffer.append("Delviery transports: " + it.next());
+ }
+ }
+
+ return buffer.toString();
+ }
+
+ public String getTransientField() {
+ return transientField;
+ }
+
+ public void setTransientField(String transientField) {
+ this.transientField = transientField;
+ }
+
+ protected void setNodeID(Long nodeID) {
+ this.nodeID = nodeID;
+ }
+
+}
Added: core/branches/Branch_3_2/test/org/hibernate/test/cascade/circle/Route.java
===================================================================
--- core/branches/Branch_3_2/test/org/hibernate/test/cascade/circle/Route.java (rev 0)
+++ core/branches/Branch_3_2/test/org/hibernate/test/cascade/circle/Route.java 2009-05-13 22:17:08 UTC (rev 16561)
@@ -0,0 +1,119 @@
+//$Id: $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+
+package org.hibernate.test.cascade.circle;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.HashSet;
+
+
+public class Route {
+
+// @Id
+// @SequenceGenerator(name="ROUTE_SEQ", sequenceName="ROUTE_SEQ", initialValue=1, allocationSize=1)
+// @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="ROUTE_SEQ")
+ private Long routeID;
+
+ private long version;
+
+ /** A List of nodes contained in this route. */
+// @OneToMany(targetEntity=Node.class, fetch=FetchType.EAGER, cascade=CascadeType.ALL, mappedBy="route")
+ private Set nodes = new HashSet();
+
+ private Set vehicles = new HashSet();
+
+ private String name;
+
+// @Transient
+ private String transientField = null;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ protected Set getNodes() {
+ return nodes;
+ }
+
+ protected void setNodes(Set nodes) {
+ this.nodes = nodes;
+ }
+
+ protected Set getVehicles() {
+ return vehicles;
+ }
+
+ protected void setVehicles(Set vehicles) {
+ this.vehicles = vehicles;
+ }
+
+ protected void setRouteID(Long routeID) {
+ this.routeID = routeID;
+ }
+
+ public Long getRouteID() {
+ return routeID;
+ }
+
+ public long getVersion() {
+ return version;
+ }
+
+ protected void setVersion(long version) {
+ this.version = version;
+ }
+
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer();
+
+ buffer.append("Route name: " + name + " id: " + routeID + " transientField: " + transientField + "\n");
+ for (Iterator it = nodes.iterator(); it.hasNext();) {
+ buffer.append("Node: " + (Node)it.next());
+ }
+
+ for (Iterator it = vehicles.iterator(); it.hasNext();) {
+ buffer.append("Vehicle: " + (Vehicle)it.next());
+ }
+
+ return buffer.toString();
+ }
+
+ public String getTransientField() {
+ return transientField;
+ }
+
+ public void setTransientField(String transientField) {
+ this.transientField = transientField;
+ }
+}
Added: core/branches/Branch_3_2/test/org/hibernate/test/cascade/circle/Tour.java
===================================================================
--- core/branches/Branch_3_2/test/org/hibernate/test/cascade/circle/Tour.java (rev 0)
+++ core/branches/Branch_3_2/test/org/hibernate/test/cascade/circle/Tour.java 2009-05-13 22:17:08 UTC (rev 16561)
@@ -0,0 +1,80 @@
+//$Id: $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate.test.cascade.circle;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.HashSet;
+
+
+public class Tour {
+
+// @Id
+// @SequenceGenerator(name="TOUR_SEQ", sequenceName="TOUR_SEQ", initialValue=1, allocationSize=1)
+// @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="TOUR_SEQ")
+ private Long tourID;
+
+ private long version;
+
+ private String name;
+
+ /** A List of nodes contained in this tour. */
+// @OneToMany(targetEntity=Node.class, fetch=FetchType.LAZY, cascade={CascadeType.MERGE, CascadeType.REFRESH}, mappedBy="tour")
+ private Set nodes = new HashSet(0);
+
+ public String getName() {
+ return name;
+ }
+
+ protected void setTourID(Long tourID) {
+ this.tourID = tourID;
+ }
+
+ public long getVersion() {
+ return version;
+ }
+
+ protected void setVersion(long version) {
+ this.version = version;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Set getNodes() {
+ return nodes;
+ }
+
+ public void setNodes(Set nodes) {
+ this.nodes = nodes;
+ }
+
+ public Long getTourID() {
+ return tourID;
+ }
+}
Added: core/branches/Branch_3_2/test/org/hibernate/test/cascade/circle/Transport.java
===================================================================
--- core/branches/Branch_3_2/test/org/hibernate/test/cascade/circle/Transport.java (rev 0)
+++ core/branches/Branch_3_2/test/org/hibernate/test/cascade/circle/Transport.java 2009-05-13 22:17:08 UTC (rev 16561)
@@ -0,0 +1,120 @@
+//$Id: $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+
+package org.hibernate.test.cascade.circle;
+
+
+public class Transport {
+
+// @Id
+// @SequenceGenerator(name="TRANSPORT_SEQ", sequenceName="TRANSPORT_SEQ", initialValue=1, allocationSize=1)
+// @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="TRANSPORT_SEQ")
+ private Long transportID;
+
+ private long version;
+
+ private String name;
+
+ /** node value object at which the order is picked up */
+// @ManyToOne(optional=false, cascade={CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}, fetch=FetchType.EAGER)
+// @JoinColumn(name="PICKUPNODEID", /*nullable=false,*/insertable=true, updatable=true)
+ private Node pickupNode = null;
+
+ /** node value object at which the order is delivered */
+// @ManyToOne(optional=false, cascade={CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}, fetch=FetchType.EAGER)
+// @JoinColumn(name="DELIVERYNODEID", /*nullable=false,*/ insertable=true, updatable=true)
+ private Node deliveryNode = null;
+
+ private Vehicle vehicle;
+
+// @Transient
+ private String transientField = "transport original value";
+
+ public Node getDeliveryNode() {
+ return deliveryNode;
+ }
+
+ public void setDeliveryNode(Node deliveryNode) {
+ this.deliveryNode = deliveryNode;
+ }
+
+ public Node getPickupNode() {
+ return pickupNode;
+ }
+
+ protected void setTransportID(Long transportID) {
+ this.transportID = transportID;
+ }
+
+ public void setPickupNode(Node pickupNode) {
+ this.pickupNode = pickupNode;
+ }
+
+ public Vehicle getVehicle() {
+ return vehicle;
+ }
+
+ public void setVehicle(Vehicle vehicle) {
+ this.vehicle = vehicle;
+ }
+
+ public Long getTransportID() {
+ return transportID;
+ }
+
+ public long getVersion() {
+ return version;
+ }
+
+ protected void setVersion(long version) {
+ this.version = version;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer();
+
+ buffer.append(name + " id: " + transportID + "\n");
+
+ return buffer.toString();
+ }
+
+ public String getTransientField() {
+ return transientField;
+ }
+
+ public void setTransientField(String transientField) {
+ this.transientField = transientField;
+ }
+}
Added: core/branches/Branch_3_2/test/org/hibernate/test/cascade/circle/Vehicle.java
===================================================================
--- core/branches/Branch_3_2/test/org/hibernate/test/cascade/circle/Vehicle.java (rev 0)
+++ core/branches/Branch_3_2/test/org/hibernate/test/cascade/circle/Vehicle.java 2009-05-13 22:17:08 UTC (rev 16561)
@@ -0,0 +1,106 @@
+//$Id: $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+
+package org.hibernate.test.cascade.circle;
+
+import java.util.Set;
+import java.util.HashSet;
+
+
+public class Vehicle {
+
+// @Id
+// @SequenceGenerator(name="TRANSPORT_SEQ", sequenceName="TRANSPORT_SEQ", initialValue=1, allocationSize=1)
+// @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="TRANSPORT_SEQ")
+ private Long vehicleID;
+
+ private long version;
+
+ private String name;
+
+ private Set transports = new HashSet();
+
+ private Route route;
+
+ private String transientField = "vehicle original value";
+
+ protected void setVehicleID(Long vehicleID) {
+ this.vehicleID = vehicleID;
+ }
+
+ public Long getVehicleID() {
+ return vehicleID;
+ }
+
+ public long getVersion() {
+ return version;
+ }
+
+ protected void setVersion(long version) {
+ this.version = version;
+ }
+
+ public Set getTransports() {
+ return transports;
+ }
+
+ public void setTransports(Set transports) {
+ this.transports = transports;
+ }
+
+ public Route getRoute() {
+ return route;
+ }
+
+ public void setRoute(Route route) {
+ this.route = route;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer();
+
+ buffer.append(name + " id: " + vehicleID + "\n");
+
+ return buffer.toString();
+ }
+
+ public String getTransientField() {
+ return transientField;
+ }
+
+ public void setTransientField(String transientField) {
+ this.transientField = transientField;
+ }
+}
\ No newline at end of file
Modified: core/branches/Branch_3_2/test/org/hibernate/test/ops/MergeTest.java
===================================================================
--- core/branches/Branch_3_2/test/org/hibernate/test/ops/MergeTest.java 2009-05-13 13:39:03 UTC (rev 16560)
+++ core/branches/Branch_3_2/test/org/hibernate/test/ops/MergeTest.java 2009-05-13 22:17:08 UTC (rev 16561)
@@ -187,7 +187,7 @@
// as a control measure, now update the node while it is detached and
// make sure we get an update as a result...
( ( Node ) parent.getChildren().iterator().next() ).setDescription( "child's new description" );
- parent.getChildren().add( new Node( "second child" ) );
+ parent.addChild( new Node( "second child" ) );
s = openSession();
s.beginTransaction();
parent = ( Node ) s.merge( parent );
15 years, 6 months
Hibernate SVN: r16560 - in search/branches/Branch_3_1: src/main and 3 other directories.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-05-13 09:39:03 -0400 (Wed, 13 May 2009)
New Revision: 16560
Added:
search/branches/Branch_3_1/src/main/assembly/
search/branches/Branch_3_1/src/main/assembly/dist.xml
Modified:
search/branches/Branch_3_1/pom.xml
search/branches/Branch_3_1/src/main/docbook/en-US/master.xml
search/branches/Branch_3_1/src/main/docbook/en-US/modules/architecture.xml
search/branches/Branch_3_1/src/main/docbook/en-US/modules/configuration.xml
Log:
Backporting HSEARCH-82 - Maven migration. This hopefully makes it easier to maintain this branch for EAP
Modified: search/branches/Branch_3_1/pom.xml
===================================================================
--- search/branches/Branch_3_1/pom.xml 2009-05-13 13:08:01 UTC (rev 16559)
+++ search/branches/Branch_3_1/pom.xml 2009-05-13 13:39:03 UTC (rev 16560)
@@ -224,8 +224,7 @@
<artifactId>maven-release-plugin</artifactId>
<configuration>
<releaseProfiles>release</releaseProfiles>
- <goals>package javadoc:javadoc org.jboss.maven.plugins:maven-jdocbook-plugin:2.1.0:resources
- org.jboss.maven.plugins:maven-jdocbook-plugin:2.1.0:generate assembly:assembly
+ <goals>package javadoc:javadoc org.jboss.maven.plugins:maven-jdocbook-plugin:2.1.0:resources org.jboss.maven.plugins:maven-jdocbook-plugin:2.1.0:generate assembly:assembly
</goals>
</configuration>
</plugin>
Added: search/branches/Branch_3_1/src/main/assembly/dist.xml
===================================================================
--- search/branches/Branch_3_1/src/main/assembly/dist.xml (rev 0)
+++ search/branches/Branch_3_1/src/main/assembly/dist.xml 2009-05-13 13:39:03 UTC (rev 16560)
@@ -0,0 +1,43 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<assembly>
+ <id>dist</id>
+ <formats>
+ <format>tar.gz</format>
+ <format>tar.bz2</format>
+ <format>zip</format>
+ </formats>
+
+ <dependencySets>
+ <dependencySet>
+ <useProjectArtifact>false</useProjectArtifact>
+ <outputDirectory>/dist/lib</outputDirectory>
+ <scope>runtime</scope>
+ </dependencySet>
+ </dependencySets>
+
+ <fileSets>
+ <fileSet>
+ <directory>target</directory>
+ <outputDirectory>/dist</outputDirectory>
+ <includes>
+ <include>*.jar</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>target/site/apidocs</directory>
+ <outputDirectory>/dist/docs/api</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>target/docbook/publish/en-US</directory>
+ <outputDirectory>/dist/docs/manual</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>.</directory>
+ <outputDirectory></outputDirectory>
+ <useDefaultExcludes>true</useDefaultExcludes>
+ <excludes>
+ <exclude>**/target/**</exclude>
+ </excludes>
+ </fileSet>
+ </fileSets>
+</assembly>
Modified: search/branches/Branch_3_1/src/main/docbook/en-US/master.xml
===================================================================
--- search/branches/Branch_3_1/src/main/docbook/en-US/master.xml 2009-05-13 13:08:01 UTC (rev 16559)
+++ search/branches/Branch_3_1/src/main/docbook/en-US/master.xml 2009-05-13 13:39:03 UTC (rev 16560)
@@ -40,10 +40,15 @@
<releaseinfo>&versionNumber;</releaseinfo>
<mediaobject>
- <imageobject>
- <imagedata fileref="images/hibernate_logo_a.png" format="PNG" />
+ <imageobject role="fo">
+ <imagedata align="center" fileref="hibernate_logo_a.png" />
</imageobject>
+
+ <imageobject role="html">
+ <imagedata depth="3cm" fileref="hibernate_logo_a.png" />
+ </imageobject>
</mediaobject>
+
</bookinfo>
<toc></toc>
Modified: search/branches/Branch_3_1/src/main/docbook/en-US/modules/architecture.xml
===================================================================
--- search/branches/Branch_3_1/src/main/docbook/en-US/modules/architecture.xml 2009-05-13 13:08:01 UTC (rev 16559)
+++ search/branches/Branch_3_1/src/main/docbook/en-US/modules/architecture.xml 2009-05-13 13:39:03 UTC (rev 16560)
@@ -119,14 +119,13 @@
<mediaobject>
<imageobject role="html">
- <imagedata align="center"
- fileref="../shared/images/lucene-backend.png"
+ <imagedata align="center" fileref="lucene-backend.png"
format="PNG" />
</imageobject>
<imageobject role="fo">
- <imagedata align="center" fileref="images/lucene-backend.png"
- format="PNG" />
+ <imagedata align="center" fileref="lucene-backend.png"
+ format="PNG" scalefit="1" width="12cm" />
</imageobject>
<caption>
@@ -156,13 +155,12 @@
<mediaobject>
<imageobject role="html">
- <imagedata align="center"
- fileref="../shared/images/jms-backend.png" format="PNG" />
+ <imagedata align="center" fileref="jms-backend.png" format="PNG" />
</imageobject>
<imageobject role="fo">
- <imagedata align="center" fileref="images/jms-backend.png"
- format="PNG" />
+ <imagedata align="center" fileref="jms-backend.png" format="PNG"
+ scalefit="1" width="12cm" />
</imageobject>
<caption>
Modified: search/branches/Branch_3_1/src/main/docbook/en-US/modules/configuration.xml
===================================================================
--- search/branches/Branch_3_1/src/main/docbook/en-US/modules/configuration.xml 2009-05-13 13:08:01 UTC (rev 16559)
+++ search/branches/Branch_3_1/src/main/docbook/en-US/modules/configuration.xml 2009-05-13 13:39:03 UTC (rev 16560)
@@ -424,13 +424,12 @@
<para><mediaobject>
<imageobject role="html">
- <imagedata align="center" fileref="../shared/images/jms-backend.png"
- format="PNG" />
+ <imagedata align="center" fileref="jms-backend.png" format="PNG" />
</imageobject>
<imageobject role="fo">
- <imagedata align="center" fileref="images/jms-backend.png"
- format="PNG" />
+ <imagedata align="center" fileref="jms-backend.png" format="PNG"
+ scalefit="1" width="12cm" />
</imageobject>
<caption><para>JMS Master/Slave architecture
@@ -600,8 +599,9 @@
<para>To enable Hibernate Search in Hibernate Core (ie. if you don't use
Hibernate Annotations), add the
<literal>FullTextIndexEventListener</literal> for the following six
- Hibernate events and also add it after the default
- <literal>DefaultFlushEventListener</literal>, as in the following example.</para>
+ Hibernate events and also add it after the default
+ <literal>DefaultFlushEventListener</literal>, as in the following
+ example.</para>
<example>
<title>Explicitly enabling Hibernate Search by configuring the
15 years, 6 months
Hibernate SVN: r16559 - search/branches/Branch_3_1.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-05-13 09:08:01 -0400 (Wed, 13 May 2009)
New Revision: 16559
Removed:
search/branches/Branch_3_1/doc/
Log:
Backporting HSEARCH-82 - Maven migration. This hopefully makes it easier to maintain this branch for EAP
15 years, 6 months
Hibernate SVN: r16558 - search/branches/Branch_3_1/doc.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-05-13 09:07:16 -0400 (Wed, 13 May 2009)
New Revision: 16558
Removed:
search/branches/Branch_3_1/doc/api/
search/branches/Branch_3_1/doc/reference/
Log:
Backporting HSEARCH-82 - Maven migration. This hopefully makes it easier to maintain this branch for EAP
15 years, 6 months
Hibernate SVN: r16557 - in search/branches/Branch_3_1: src/main/javadoc and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-05-13 09:00:54 -0400 (Wed, 13 May 2009)
New Revision: 16557
Added:
search/branches/Branch_3_1/src/main/javadoc/package.html
Removed:
search/branches/Branch_3_1/doc/api/package.html
Log:
Backporting HSEARCH-82 - Maven migration. This hopefully makes it easier to maintain this branch for EAP
Deleted: search/branches/Branch_3_1/doc/api/package.html
===================================================================
--- search/branches/Branch_3_1/doc/api/package.html 2009-05-13 12:59:42 UTC (rev 16556)
+++ search/branches/Branch_3_1/doc/api/package.html 2009-05-13 13:00:54 UTC (rev 16557)
@@ -1 +0,0 @@
-<body></body>
Copied: search/branches/Branch_3_1/src/main/javadoc/package.html (from rev 16556, search/branches/Branch_3_1/doc/api/package.html)
===================================================================
--- search/branches/Branch_3_1/src/main/javadoc/package.html (rev 0)
+++ search/branches/Branch_3_1/src/main/javadoc/package.html 2009-05-13 13:00:54 UTC (rev 16557)
@@ -0,0 +1 @@
+<body></body>
15 years, 6 months
Hibernate SVN: r16556 - in search/branches/Branch_3_1: doc and 5 other directories.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-05-13 08:59:42 -0400 (Wed, 13 May 2009)
New Revision: 16556
Added:
search/branches/Branch_3_1/hibernate-search-archetype/
search/branches/Branch_3_1/src/main/docbook/
search/branches/Branch_3_1/src/main/docbook/en-US/
search/branches/Branch_3_1/src/main/docbook/en-US/images/
search/branches/Branch_3_1/src/main/docbook/en-US/master.xml
search/branches/Branch_3_1/src/main/docbook/en-US/modules/
Removed:
search/branches/Branch_3_1/doc/quickstart/
search/branches/Branch_3_1/doc/reference/en/images/
search/branches/Branch_3_1/doc/reference/en/master.xml
search/branches/Branch_3_1/doc/reference/en/modules/
Modified:
search/branches/Branch_3_1/
search/branches/Branch_3_1/src/
Log:
Backporting HSEARCH-82 - Maven migration. This hopefully makes it easier to maintain this branch for EAP
Property changes on: search/branches/Branch_3_1
___________________________________________________________________
Name: svn:ignore
- build
indextemp
lucenedirs
target
test_output
bin
build.properties
.*
+ build
indextemp
lucenedirs
target
test_output
bin
build.properties
.*
*.ipr
*.iws
Deleted: search/branches/Branch_3_1/doc/reference/en/master.xml
===================================================================
--- search/branches/Branch_3_1/doc/reference/en/master.xml 2009-05-13 12:43:40 UTC (rev 16555)
+++ search/branches/Branch_3_1/doc/reference/en/master.xml 2009-05-13 12:59:42 UTC (rev 16556)
@@ -1,92 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- $Id$ -->
-<!--
- ~ Hibernate, Relational Persistence for Idiomatic Java
- ~
- ~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- ~ indicated by the @author tags or express copyright attribution
- ~ statements applied by the authors. All third-party contributions are
- ~ distributed under license by Red Hat Middleware LLC.
- ~
- ~ This copyrighted material is made available to anyone wishing to use, modify,
- ~ copy, or redistribute it subject to the terms and conditions of the GNU
- ~ Lesser General Public License, as published by the Free Software Foundation.
- ~
- ~ This program is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- ~ for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public License
- ~ along with this distribution; if not, write to:
- ~ Free Software Foundation, Inc.
- ~ 51 Franklin Street, Fifth Floor
- ~ Boston, MA 02110-1301 USA
- -->
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
-"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY versionNumber "3.1.0.GA">
-<!ENTITY copyrightYear "2004">
-<!ENTITY copyrightHolder "Red Hat Middleware, LLC.">
-]>
-<book lang="en">
- <bookinfo>
- <title>Hibernate Search</title>
-
- <subtitle>Apache <trademark>Lucene</trademark> Integration</subtitle>
-
- <subtitle>Reference Guide</subtitle>
-
- <releaseinfo>&versionNumber;</releaseinfo>
-
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/hibernate_logo_a.png" format="PNG" />
- </imageobject>
- </mediaobject>
- </bookinfo>
-
- <toc></toc>
-
- <preface id="preface" revision="2">
- <title>Preface</title>
-
- <para>Full text search engines like Apache Lucene are very powerful
- technologies to add efficient free text search capabilities to
- applications. However, Lucene suffers several mismatches when dealing with
- object domain model. Amongst other things indexes have to be kept up to
- date and mismatches between index structure and domain model as well as
- query mismatches have to be avoided.</para>
-
- <para>Hibernate Search addresses these shortcomings - it indexes your
- domain model with the help of a few annotations, takes care of
- database/index synchronization and brings back regular managed objects
- from free text queries. To achieve this Hibernate Search is combining the
- power of <ulink url="http://www.hibernate.org">Hibernate</ulink> and
- <ulink url="http://lucene.apache.org">Apache Lucene</ulink>.</para>
- </preface>
-
- <xi:include href="modules/getting-started.xml"
- xmlns:xi="http://www.w3.org/2001/XInclude" />
-
- <xi:include href="modules/architecture.xml"
- xmlns:xi="http://www.w3.org/2001/XInclude" />
-
- <xi:include href="modules/configuration.xml"
- xmlns:xi="http://www.w3.org/2001/XInclude" />
-
- <xi:include href="modules/mapping.xml"
- xmlns:xi="http://www.w3.org/2001/XInclude" />
-
- <xi:include href="modules/query.xml"
- xmlns:xi="http://www.w3.org/2001/XInclude" />
-
- <xi:include href="modules/batchindex.xml"
- xmlns:xi="http://www.w3.org/2001/XInclude" />
-
- <xi:include href="modules/optimize.xml"
- xmlns:xi="http://www.w3.org/2001/XInclude" />
-
- <xi:include href="modules/lucene-native.xml"
- xmlns:xi="http://www.w3.org/2001/XInclude" />
-</book>
Copied: search/branches/Branch_3_1/hibernate-search-archetype (from rev 16553, search/branches/Branch_3_1/doc/quickstart)
Property changes on: search/branches/Branch_3_1/src
___________________________________________________________________
Name: svn:ignore
+ *.iml
Copied: search/branches/Branch_3_1/src/main/docbook/en-US/images (from rev 16553, search/branches/Branch_3_1/doc/reference/en/images)
Copied: search/branches/Branch_3_1/src/main/docbook/en-US/master.xml (from rev 16553, search/branches/Branch_3_1/doc/reference/en/master.xml)
===================================================================
--- search/branches/Branch_3_1/src/main/docbook/en-US/master.xml (rev 0)
+++ search/branches/Branch_3_1/src/main/docbook/en-US/master.xml 2009-05-13 12:59:42 UTC (rev 16556)
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- $Id$ -->
+<!--
+ ~ Hibernate, Relational Persistence for Idiomatic Java
+ ~
+ ~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ ~ indicated by the @author tags or express copyright attribution
+ ~ statements applied by the authors. All third-party contributions are
+ ~ distributed under license by Red Hat Middleware LLC.
+ ~
+ ~ This copyrighted material is made available to anyone wishing to use, modify,
+ ~ copy, or redistribute it subject to the terms and conditions of the GNU
+ ~ Lesser General Public License, as published by the Free Software Foundation.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ ~ for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this distribution; if not, write to:
+ ~ Free Software Foundation, Inc.
+ ~ 51 Franklin Street, Fifth Floor
+ ~ Boston, MA 02110-1301 USA
+ -->
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY versionNumber "3.1.0.GA">
+<!ENTITY copyrightYear "2004">
+<!ENTITY copyrightHolder "Red Hat Middleware, LLC.">
+]>
+<book lang="en">
+ <bookinfo>
+ <title>Hibernate Search</title>
+
+ <subtitle>Apache <trademark>Lucene</trademark> Integration</subtitle>
+
+ <subtitle>Reference Guide</subtitle>
+
+ <releaseinfo>&versionNumber;</releaseinfo>
+
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/hibernate_logo_a.png" format="PNG" />
+ </imageobject>
+ </mediaobject>
+ </bookinfo>
+
+ <toc></toc>
+
+ <preface id="preface" revision="2">
+ <title>Preface</title>
+
+ <para>Full text search engines like Apache Lucene are very powerful
+ technologies to add efficient free text search capabilities to
+ applications. However, Lucene suffers several mismatches when dealing with
+ object domain model. Amongst other things indexes have to be kept up to
+ date and mismatches between index structure and domain model as well as
+ query mismatches have to be avoided.</para>
+
+ <para>Hibernate Search addresses these shortcomings - it indexes your
+ domain model with the help of a few annotations, takes care of
+ database/index synchronization and brings back regular managed objects
+ from free text queries. To achieve this Hibernate Search is combining the
+ power of <ulink url="http://www.hibernate.org">Hibernate</ulink> and
+ <ulink url="http://lucene.apache.org">Apache Lucene</ulink>.</para>
+ </preface>
+
+ <xi:include href="modules/getting-started.xml"
+ xmlns:xi="http://www.w3.org/2001/XInclude" />
+
+ <xi:include href="modules/architecture.xml"
+ xmlns:xi="http://www.w3.org/2001/XInclude" />
+
+ <xi:include href="modules/configuration.xml"
+ xmlns:xi="http://www.w3.org/2001/XInclude" />
+
+ <xi:include href="modules/mapping.xml"
+ xmlns:xi="http://www.w3.org/2001/XInclude" />
+
+ <xi:include href="modules/query.xml"
+ xmlns:xi="http://www.w3.org/2001/XInclude" />
+
+ <xi:include href="modules/batchindex.xml"
+ xmlns:xi="http://www.w3.org/2001/XInclude" />
+
+ <xi:include href="modules/optimize.xml"
+ xmlns:xi="http://www.w3.org/2001/XInclude" />
+
+ <xi:include href="modules/lucene-native.xml"
+ xmlns:xi="http://www.w3.org/2001/XInclude" />
+</book>
Copied: search/branches/Branch_3_1/src/main/docbook/en-US/modules (from rev 16553, search/branches/Branch_3_1/doc/reference/en/modules)
15 years, 6 months
Hibernate SVN: r16555 - search/branches/Branch_3_1/src/test/resources.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-05-13 08:43:40 -0400 (Wed, 13 May 2009)
New Revision: 16555
Added:
search/branches/Branch_3_1/src/test/resources/jndi.properties
Log:
Backporting HSEARCH-82 - Maven migration. This hopefully makes it easier to maintain this branch for EAP
Added: search/branches/Branch_3_1/src/test/resources/jndi.properties
===================================================================
--- search/branches/Branch_3_1/src/test/resources/jndi.properties (rev 0)
+++ search/branches/Branch_3_1/src/test/resources/jndi.properties 2009-05-13 12:43:40 UTC (rev 16555)
@@ -0,0 +1,12 @@
+java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
+java.naming.provider.url=vm://localhost
+
+# use the following property to specify the JNDI name the connection factory
+# should appear as.
+connectionFactoryNames = ConnectionFactory, java:/ConnectionFactory
+
+# register some queues in JNDI using the form
+# queue.[jndiName] = [physicalName]
+queue.queue/searchtest = searchQueue
+
+
15 years, 6 months
Hibernate SVN: r16554 - in search/branches/Branch_3_1: doc/api and 20 other directories.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-05-13 08:38:19 -0400 (Wed, 13 May 2009)
New Revision: 16554
Added:
search/branches/Branch_3_1/src/main/
search/branches/Branch_3_1/src/main/java/
search/branches/Branch_3_1/src/main/javadoc/
search/branches/Branch_3_1/src/main/javadoc/jdstyle.css
search/branches/Branch_3_1/src/test/java/
search/branches/Branch_3_1/src/test/java/org/
search/branches/Branch_3_1/src/test/resources/
Removed:
search/branches/Branch_3_1/build.properties.dist
search/branches/Branch_3_1/build.xml
search/branches/Branch_3_1/common-build.xml
search/branches/Branch_3_1/doc/api/jdstyle.css
search/branches/Branch_3_1/ivy.xml
search/branches/Branch_3_1/ivy/
search/branches/Branch_3_1/jdbc/
search/branches/Branch_3_1/lib/
search/branches/Branch_3_1/src/filters/
search/branches/Branch_3_1/src/java/
search/branches/Branch_3_1/src/test-resources/
search/branches/Branch_3_1/src/test/org/
search/branches/Branch_3_1/src/test/resources/conf/
search/branches/Branch_3_1/src/test/resources/deploy/
search/branches/Branch_3_1/src/test/resources/deployers/
search/branches/Branch_3_1/src/test/resources/jndi.properties
Modified:
search/branches/Branch_3_1/pom.xml
search/branches/Branch_3_1/src/main/java/org/hibernate/search/analyzer/Discriminator.java
search/branches/Branch_3_1/src/main/java/org/hibernate/search/annotations/AnalyzerDiscriminator.java
search/branches/Branch_3_1/src/main/java/org/hibernate/search/impl/InitContext.java
search/branches/Branch_3_1/src/main/java/org/hibernate/search/reader/CacheableMultiReader.java
search/branches/Branch_3_1/src/main/java/org/hibernate/search/util/LoggerFactory.java
search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/analyzer/Article.java
search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/analyzer/BlogEntry.java
search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/analyzer/LanguageDiscriminator.java
search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/analyzer/inheritance/BaseClass.java
search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/analyzer/inheritance/ISOLatin1Analyzer.java
search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/analyzer/inheritance/SubClass.java
search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/embedded/Country.java
search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/embedded/Person.java
search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/jms/master/JMSMasterTest.java
search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/jms/master/MDBSearchController.java
search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/jms/slave/JMSSlaveTest.java
search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/jms/slave/SearchQueueChecker.java
search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/optimizer/OptimizerTestCase.java
search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/session/OptimizeTest.java
search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/shards/ShardsTest.java
search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/similarity/DummySimilarity.java
search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/similarity/SimilarityTest.java
search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/similarity/Trash.java
search/branches/Branch_3_1/src/test/resources/hibernate.properties
Log:
Backporting HSEARCH-82 - Maven migration. This hopefully makes it easier to maintain this branch for EAP
Deleted: search/branches/Branch_3_1/build.properties.dist
===================================================================
--- search/branches/Branch_3_1/build.properties.dist 2009-05-12 15:25:27 UTC (rev 16553)
+++ search/branches/Branch_3_1/build.properties.dist 2009-05-13 12:38:19 UTC (rev 16554)
@@ -1,6 +0,0 @@
-common.dir=.
-src.dir=src
-test.dir=test
-filter.dir=filters
-testresources.dir=test-resources
-test.resources.dir=test-resources
\ No newline at end of file
Deleted: search/branches/Branch_3_1/build.xml
===================================================================
--- search/branches/Branch_3_1/build.xml 2009-05-12 15:25:27 UTC (rev 16553)
+++ search/branches/Branch_3_1/build.xml 2009-05-13 12:38:19 UTC (rev 16554)
@@ -1,369 +0,0 @@
-<!-- $Id$ -->
-<!--
-
- Hibernate Search ANT build script.
-
- You need JDK 5.0 installed to build Hibernate Search.
-
--->
-
-<project name="Hibernate Search" default="dist" basedir="."
- xmlns:ivy="antlib:fr.jayasoft.ivy.ant">
-
- <!-- Give user a chance to override without editing this file
- (and without typing -D each time it compiles it) -->
- <property file="build.properties"/>
- <property file="${user.home}/.ant.properties"/>
-
- <!-- 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.1.0.GA"/>
- <property name="javadoc.packagenames" value="org.hibernate.search.*"/>
- <property name="copy.test" value="true"/>
- <property name="javac.source" value="1.5"/>
- <property name="javac.target" value="1.5"/>
- <property name="jdbc.dir" value="jdbc"/>
-
- <property name="ivy.dep.dir" value="${basedir}/build/lib"/>
-
- <!-- ivy load -->
- <property name="ivy.jar.dir" value="${basedir}/ivy"/>
- <property name="ivy.conf.dir" value="${basedir}"/>
- <path id="ivy.lib.path">
- <fileset dir="${ivy.jar.dir}" includes="*.jar"/>
- </path>
- <taskdef resource="fr/jayasoft/ivy/ant/antlib.xml"
- uri="antlib:fr.jayasoft.ivy.ant" classpathref="ivy.lib.path"/>
-
- <import file="common-build.xml"/>
-
- <property name="build.testresources.dir" value="${build.dir}/testresources"/>
- <property name="testresources.dir" value="${basedir}/src/test-resources"/>
-
-
- <path id="lib.class.path.required" description="Compile and runtime libraries. Required jars only.">
- <fileset dir="${ivy.dep.dir}/core">
- <include name="*.jar"/>
- <exclude name="xml-apis.jar"/>
- <exclude name="xerces*.jar"/>
- <exclude name="solr*.jar"/>
- <exclude name="ejb3-persistence.jar"/>
- </fileset>
- <fileset dir="${lib.dir}">
- <include name="*.jar"/>
- </fileset>
- </path>
-
- <path id="lib.class.path.optional" description="Compile and runtime libraries. Optional jars only.">
- <fileset dir="${ivy.dep.dir}/core">
- <include name="solr*.jar"/>
- <include name="ejb3-persistence.jar"/>
- </fileset>
- </path>
-
- <path id="lib.class.path" description="Compile and runtime libraries.">
- <path refid="lib.class.path.required"/>
- <path refid="lib.class.path.optional"/>
- </path>
-
- <path id="junit.moduleclasspath.required" description="Test classes. Optional jars excluded.">
- <!-- order matters for JBoss XB proper bootstrap -->
- <fileset dir="${lib.dir}/test">
- <include name="*.jar"/>
- </fileset>
- <pathelement location="${src.dir}"/>
- <pathelement location="${test.dir}"/>
- <fileset dir="${ivy.dep.dir}/test">
- <include name="*.jar"/>
- <exclude name="annotations.jar"/>
- </fileset>
- <fileset dir="${jdbc.dir}">
- <include name="*.jar"/>
- <include name="*.zip"/>
- </fileset>
- </path>
-
- <path id="junit.moduleclasspath.optional" description="Optional test jars.">
- <fileset dir="${ivy.dep.dir}/test">
- <include name="annotations.jar"/>
- </fileset>
- </path>
-
- <path id="junit.classpath.required.only"
- description="Classpath containing all compile and test classes excluding the optional ones, eg Annotations, Solr, JPA">
- <fileset dir="${lib.dir}">
- <include name="*.jar"/>
- </fileset>
- <pathelement path="${classes.dir}"/>
- <pathelement path="${testclasses.dir}"/>
- <path refid="junit.moduleclasspath.required"/>
- <path refid="lib.class.path.required"/>
- </path>
-
- <path id="junit.classpath"
- description="Classpath containing all compile and test classes including the optional ones">
- <path refid="junit.classpath.required.only"/>
- <path refid="junit.moduleclasspath.optional"/>
- <path refid="lib.class.path.optional"/>
- </path>
-
- <target name="init">
- <antcall target="common-build.init"/>
- <tstamp>
- <format property="now" pattern="yyyyMMddhhmmss"/>
- </tstamp>
- <mkdir dir="${ivy.dep.dir}/core"/>
- <mkdir dir="${ivy.dep.dir}/test"/>
- <ivy:configure file="${ivy.jar.dir}/ivyconf.xml"/>
- <mkdir dir="${lib.dir}/test"/>
- <mkdir dir="${build.testresources.dir}"/>
- </target>
-
- <target name="get.deps.core" depends="init" description="retrieve the core dependencies" unless="disable.ivy">
- <ivy:resolve conf="default"/>
- <ivy:retrieve pattern="${ivy.dep.dir}/core/[artifact].[ext]" conf="default"/>
- </target>
-
- <target name="compile" depends="init,get.deps.core" description="Compile the Java source code">
- <available
- classname="org.eclipse.core.launcher.Main"
- property="build.compiler"
- value="org.eclipse.jdt.core.JDTCompilerAdapter"
- classpath="${java.class.path}"/>
- <javac
- srcdir="${src.dir}"
- destdir="${classes.dir}"
- classpathref="lib.class.path"
- debug="${javac.debug}"
- optimize="${javac.optimize}"
- nowarn="on"
- source="${javac.source}"
- target="${javac.target}">
- <src path="${src.dir}"/>
- </javac>
- <copy todir="${classes.dir}">
- <fileset dir="${src.dir}">
- <include name="**/resources/*.properties"/>
- <include name="**/*.xsd"/>
- </fileset>
- </copy>
- </target>
-
- <target name="get.deps.test" depends="init" description="retrieve the test dependencies" unless="disable.ivy">
- <ivy:resolve conf="test"/>
- <ivy:retrieve pattern="${ivy.dep.dir}/test/[artifact].[ext]" conf="test"/>
- </target>
-
- <target name="compiletest" depends="init,get.deps.test,compile" description="Compile the tests">
- <available
- classname="org.eclipse.core.launcher.Main"
- property="build.compiler"
- value="org.eclipse.jdt.core.JDTCompilerAdapter"
- classpath="${java.class.path}"/>
- <javac
- destdir="${testclasses.dir}"
- classpathref="junit.classpath"
- debug="${javac.debug}"
- optimize="${javac.optimize}"
- nowarn="on"
- source="${javac.source}"
- target="${javac.target}">
- <src refid="testsrc.path"/>
- </javac>
- </target>
-
- <target name="prepare-test-resources" depends="compiletest">
- <copy todir="${build.testresources.dir}">
- <fileset dir="${testresources.dir}">
- <include name="**/*.*"/>
- <exclude name="hibernate.properties"/>
- </fileset>
- </copy>
- <mkdir dir="${build.testresources.dir}/jars"/>
- <jar filesetmanifest="merge" jarfile="${build.testresources.dir}/jars/jms-slave.jar">
- <fileset dir="${testclasses.dir}">
- <include name="org/hibernate/search/test/jms/slave/**.*"/>
- </fileset>
- </jar>
- <jar filesetmanifest="merge" jarfile="${build.testresources.dir}/jars/jms-master.jar">
- <fileset dir="${testclasses.dir}">
- <include name="org/hibernate/search/test/jms/master/**.*"/>
- </fileset>
- </jar>
- </target>
-
- <target name="junit" depends="compiletest, prepare-test-resources">
- <for list="${targetdb}" param="db">
- <sequential>
- <antcall target="test-resources">
- <param name="db" value="@{db}"/>
- </antcall>
- <mkdir dir="${testreports.dir}/@{db}"/>
- <echo>Running against db: @{db}</echo>
- <junit forkmode="perBatch" printsummary="yes" haltonfailure="yes">
- <classpath>
- <path path="${build.testresources.dir}"/>
- <path refid="junit.classpath"/>
- <fileset dir="${jdbc.dir}">
- <include name="**/*.jar"/>
- <include name="**/*.zip"/>
- </fileset>
- </classpath>
- <sysproperty key="build.dir" value="${build.dir}"/>
- <formatter type="plain"/>
- <formatter type="xml"/>
- <batchtest fork="yes" todir="${testreports.dir}/@{db}" haltonfailure="no">
- <fileset dir="${testclasses.dir}">
- <include name="**/*Test.class"/>
- <exclude name="**/JMSSlaveTest.class"/>
- <exclude name="**/classloading/**"/>
- </fileset>
- </batchtest>
- <test fork="yes"
- todir="${testreports.dir}/@{db}"
- haltonfailure="no"
- name="org.hibernate.search.test.jms.slave.JMSSlaveTest"/>
- </junit>
- <junit forkmode="perBatch" printsummary="yes" haltonfailure="yes">
- <classpath>
- <path path="${build.testresources.dir}"/>
- <path refid="junit.classpath.required.only"/>
- <fileset dir="${jdbc.dir}">
- <include name="**/*.jar"/>
- <include name="**/*.zip"/>
- </fileset>
- </classpath>
- <sysproperty key="build.dir" value="${build.dir}"/>
- <formatter type="plain"/>
- <formatter type="xml"/>
- <batchtest fork="yes" todir="${testreports.dir}/@{db}" haltonfailure="no">
- <fileset dir="${testclasses.dir}">
- <include name="**/classloading/**/*Test.class"/>
- </fileset>
- </batchtest>
- </junit>
- </sequential>
- </for>
- </target>
-
- <!-- Run a single unit test. -->
- <target name="junitsingle" depends="compiletest"
- description="Run a single test suite (requires testname and jdbc.driver properties)">
- <for list="${targetdb}" param="db">
- <sequential>
- <antcall target="test-resources">
- <param name="db" value="@{db}"/>
- </antcall>
- <mkdir dir="${testreports.dir}/@{db}"/>
- <echo>Running against db: @{db}</echo>
- <junit printsummary="yes" fork="yes" haltonfailure="yes">
- <classpath>
- <path path="${build.testresources.dir}"/>
- <path refid="junit.classpath"/>
- <fileset dir="${jdbc.dir}">
- <include name="**/*.jar"/>
- <include name="**/*.zip"/>
- </fileset>
- </classpath>
- <sysproperty key="build.dir" value="${build.dir}"/>
- <formatter type="plain"/>
- <formatter type="xml"/>
- <test fork="yes" todir="${testreports.dir}/@{db}" haltonfailure="no" name="${testname}"/>
- </junit>
- </sequential>
- </for>
- </target>
-
- <target name="jar" depends="compile" description="Build the distribution .jar file">
- <mkdir dir="${classes.dir}/META-INF"/>
- <manifest file="${classes.dir}/META-INF/MANIFEST.MF">
- <attribute name="Implementation-Title" value="${Name}"/>
- <attribute name="Implementation-Version" value="${version}"/>
- <attribute name="Implementation-Vendor" value="hibernate.org"/>
- <attribute name="Implementation-Vendor-Id" value="hibernate.org"/>
- <attribute name="Implementation-URL" value="http://search.hibernate.org"/>
- </manifest>
- <mkdir dir="${dist.dir}"/>
- <jar filesetmanifest="merge" jarfile="${jar.file.name}"
- basedir="${classes.dir}"/>
- </target>
-
- <!-- Some of this can probably be moved to common-build... -->
- <target name="dist" depends="get.deps.core,get.deps.test,jar,jar,javadoc,copysource,copytest,copylib,extras"
- description="Build everything">
-
- <ant inheritall="false" dir="${basedir}/doc/reference"/>
- <copy todir="${dist.dir}/doc/reference" failonerror="false">
- <fileset dir="${basedir}/doc/reference/build">
- <include name="**/*.*"/>
- <exclude name="en/master.xml"/>
- </fileset>
- </copy>
-
- <copy todir="${dist.dir}" failonerror="false">
- <fileset dir="${basedir}">
- <include name="common-build.xml"/>
- </fileset>
- </copy>
-
- <copy todir="${dist.dir}/test-resources" failonerror="false">
- <fileset dir="${testresources.dir}">
- <include name="**/*.*"/>
- </fileset>
- </copy>
- <copy todir="${dist.dir}/ivy" failonerror="false">
- <fileset dir="${ivy.jar.dir}">
- <include name="**/*.*"/>
- </fileset>
- </copy>
-
- <!-- copy dependencies -->
- <copy todir="${dist.lib.dir}" failonerror="false">
- <!-- fileset file="${jpa-api.jar}"/>
- <fileset file="${commons-annotations.jar}"/ -->
- <fileset dir="${ivy.dep.dir}/core">
- <include name="*.jar"/>
- </fileset>
- </copy>
- <mkdir dir="${dist.lib.dir}/test"/>
- <copy todir="${dist.lib.dir}/test" failonerror="false">
- <fileset dir="${ivy.dep.dir}/test">
- <include name="*.jar"/>
- </fileset>
- </copy>
- <copy todir="${dist.lib.dir}/test" failonerror="false">
- <fileset file="${lib.dir}/test/*.jar"/>
- </copy>
-
- <mkdir dir="${dist.lib.dir}/build"/>
- <copy todir="${dist.lib.dir}/build" failonerror="false">
- <fileset file="${lib.dir}/build/*.jar"/>
- </copy>
-
- <!-- ivy uses the module name without hibernate- (to mimic the directory names). Revert the situation -->
- <move file="${dist.lib.dir}/commons-annotations.jar" tofile="${dist.lib.dir}/hibernate-commons-annotations.jar"
- failonerror="false"/>
- <move file="${dist.lib.dir}/test/commons-annotations.jar"
- tofile="${dist.lib.dir}/test/hibernate-commons-annotations.jar"
- failonerror="false"/>
- <move file="${dist.lib.dir}/test/annotations.jar" tofile="${dist.lib.dir}/test/hibernate-annotations.jar"
- failonerror="false"/>
- <move file="${dist.lib.dir}/test/entitymanager.jar" tofile="${dist.lib.dir}/test/hibernate-entitymanager.jar"
- failonerror="false"/>
-
-
- <copy file="${basedir}/build.properties.dist" tofile="${dist.dir}/build.properties" failonerror="false">
- </copy>
- <antcall target="common-build.dist"/>
- </target>
-
- <target name="zip-dist" description="zip the dist">
- <zip zipfile="${dist.dir}-${version}.zip">
- <zipfileset prefix="${name}-${version}" dir="${dist.dir}"/>
- </zip>
- <tar compression="gzip" tarfile="${dist.dir}-${version}.tar.gz">
- <tarfileset prefix="${name}-${version}" dir="${dist.dir}"/>
- </tar>
- </target>
-</project>
Deleted: search/branches/Branch_3_1/common-build.xml
===================================================================
--- search/branches/Branch_3_1/common-build.xml 2009-05-12 15:25:27 UTC (rev 16553)
+++ search/branches/Branch_3_1/common-build.xml 2009-05-13 12:38:19 UTC (rev 16554)
@@ -1,420 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project name="common-build" default="dist"
- xmlns:artifact="urn:maven-artifact-ant" xmlns:ivy="antlib:fr.jayasoft.ivy.ant">
- <description>Common properties and targets for the HibernateExt
- project</description>
-
-
- <!-- my.basedir property can be used to refer to files/directories relatively to the common-build.xml file -->
- <dirname property="common-build.basedir" file="${ant.file.common-build}"/>
-
- <!-- Give user a chance to override without editing this file
- (and without typing -D each time it compiles it) -->
- <property file="${common-build.basedir}/build.properties"/>
- <property file="${user.home}/.ant.properties"/>
-
- <property name="src.dir" location="src/java"/>
- <property name="test.dir" location="src/test"/>
- <property name="test.resources.dir" location="src/test-resources"/>
- <property name="filter.dir" location="src/filters"/>
- <property name="lib.dir" location="lib"/>
- <property name="build.dir" location="build"/>
- <property name="classes.dir" location="${build.dir}/classes"/>
- <property name="testclasses.dir" location="${build.dir}/testclasses"/>
- <property name="testreports.dir" location="${build.dir}/test-reports"/>
- <property name="dist.target.dir" location="target"/>
- <property name="dist.dir" location="${dist.target.dir}/${name}"/>
- <property name="instrumenttest.out.dir" value="${build.dir}/test-reports/instrument"/>
- <property name="doc.dir" location="doc"/>
- <property name="doc.api.dir" location="${doc.dir}/api"/>
- <property name="doc.reference.dir" location="${doc.dir}/reference"/>
-
- <property name="dist.doc.dir" location="${dist.dir}/doc"/>
- <property name="dist.api.dir" location="${dist.dir}/doc/api"/>
-
- <property name="dist.src.dir" location="${dist.dir}/src"/>
- <property name="dist.test.dir" location="${dist.dir}/test"/>
- <property name="dist.lib.dir" location="${dist.dir}/lib"/>
- <property name="dist.filter.dir" location="${dist.dir}/filters"/>
- <property name="jar.name" value="${name}"/>
- <property name="jar.file.name" value="${dist.dir}/${jar.name}.jar"/>
- <property name="jartest.file.name" value="${dist.dir}/${jar.name}-tests.jar"/>
-
- <property name="javadoc" value="http://java.sun.com/j2se/1.4/docs/api"/>
- <property name="javac.debug" value="on"/>
- <property name="javac.optimize" value="off"/>
- <property name="javac.source" value="1.4"/>
- <property name="javac.target" value="1.4"/>
-
- <property name="pom.file" value="pom.xml"/>
- <property name="src.jar" value="${build.dir}/src.jar"/>
-
- <taskdef name="junit"
- classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask">
- <classpath>
- <fileset dir="${common-build.basedir}/lib/build">
- <!-- ${build.lib.dir} fails in reference doc build -->
- <include name="junit-*.jar"/>
- <include name="ant-junit-*.jar"/>
- </fileset>
- </classpath>
- </taskdef>
-
- <taskdef name="junitreport"
- classname="org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator">
- <classpath>
- <fileset dir="${common-build.basedir}/lib/build">
- <!-- ${build.lib.dir} fails in reference doc build -->
- <include name="junit-*.jar"/>
- <include name="ant-junit-*.jar"/>
- </fileset>
- </classpath>
- </taskdef>
-
- <taskdef resource="net/sf/antcontrib/antlib.xml">
- <classpath>
- <fileset dir="${common-build.basedir}/lib/build">
- <!-- ${build.lib.dir} fails in reference doc build -->
- <include name="ant-contrib-*.jar"/>
- </fileset>
- </classpath>
- </taskdef>
-
- <!-- ivy load -->
- <property name="ivy.jar.dir" value="${common-build.basedir}/ivy"/>
- <property name="ivy.conf.dir" value="${common-build.basedir}"/>
- <path id="ivy.lib.path">
- <fileset dir="${ivy.jar.dir}" includes="*.jar"/>
- </path>
- <taskdef resource="fr/jayasoft/ivy/ant/antlib.xml"
- uri="antlib:fr.jayasoft.ivy.ant" classpathref="ivy.lib.path"/>
-
- <!-- maven task load -->
- <path id="maven-ant-tasks.path" path="${ivy.jar.dir}/maven-ant-tasks.jar"/>
- <typedef resource="org/apache/maven/artifact/ant/antlib.xml"
- uri="urn:maven-artifact-ant" classpathref="maven-ant-tasks.path"/>
-
- <artifact:remoteRepository id="offline.repository.jboss.org"
- url="file://${offline.repository.jboss.org}"/>
-
- <path id="lib.class.path">
- <path refid="lib.moduleclass.path"/>
- </path>
-
- <!-- overridable in modules -->
- <path id="lib.moduleclass.path"/>
-
- <patternset id="support.files">
- <include name="**/*.jpg"/>
- <include name="**/*.gif"/>
- <include name="**/*.dtd"/>
- <include name="**/*.xsd"/>
- <include name="**/*.xml"/>
- <include name="**/*.xslt"/>
-
- <!-- exclude everything we don't want in the jar -->
- <exclude name="${build.dir}/**/*"/>
- <exclude name="${doc.dir}/**/*"/>
- <exclude name="classes/**/*"/>
- <exclude name="build.xml"/>
- <exclude name="**/*.properties"/>
- <exclude name="**/*.ccf"/>
- <exclude name="**/*.cfg.xml"/>
- <exclude name="**/ehcache.xml"/>
- </patternset>
-
- <patternset id="source.files">
- <include name="**/*.java"/>
- <include name="**/*.properties"/>
- </patternset>
-
- <!-- junit paths/filesets -->
- <fileset dir="${testclasses.dir}" id="junit.batchtestset">
- <include name="**/*Test.class"/>
- </fileset>
-
- <path id="testsrc.path">
- <pathelement location="${test.dir}"/>
- </path>
-
- <!-- Determine the database against which to run tests-->
- <if>
- <equals arg1="${targetdb}" arg2="$${targetdb}"/>
- <then>
- <echo message="No target database specified using default HSQLDB"/>
- <property name="targetdb" value="hsqldb"/>
- </then>
- </if>
-
-
- <!-- Tasks -->
- <target name="clean" description="Cleans up build and dist directories">
- <delete dir="${build.dir}"/>
- <delete dir="${dist.target.dir}"/>
- </target>
-
- <target name="init" description="Initialize the build">
- <tstamp>
- <format property="subversion" pattern="yyyy-MM-dd hh:mm:ss"/>
- </tstamp>
- <echo message="Build ${Name}-${version} (${subversion})"/>
- <mkdir dir="${classes.dir}"/>
- <mkdir dir="${testclasses.dir}"/>
- <copy todir="${classes.dir}">
- <fileset dir="${src.dir}">
- <patternset refid="support.files"/>
- </fileset>
- </copy>
-
- <copy todir="${build.dir}">
- <fileset dir=".">
- <include name="readme.txt"/>
- <include name="lgpl.txt"/>
- </fileset>
- </copy>
- </target>
-
- <target name="get.deps.core" depends="init"
- description="retrieve the core dependencies">
- <ivy:resolve conf="default"/>
- <ivy:retrieve pattern="${ivy.dep.dir}/core/[artifact].[ext]"
- conf="default"/>
- </target>
-
- <target name="get.deps.test" depends="init"
- description="retrieve the test dependencies">
- <ivy:resolve conf="test"/>
- <ivy:retrieve pattern="${ivy.dep.dir}/test/[artifact].[ext]" conf="test"/>
- </target>
-
- <target name="copytest" description="Copy tests to dist dir" if="copy.test">
- <mkdir dir="${dist.test.dir}"/>
- <copy todir="${dist.test.dir}">
- <fileset dir="${test.dir}"/>
- </copy>
- <mkdir dir="${dist.filter.dir}"/>
- <copy todir="${dist.filter.dir}">
- <fileset dir="${filter.dir}"/>
- </copy>
- </target>
-
- <target name="copysource" depends="copytest"
- description="Copy sources to dist dir">
- <mkdir dir="${dist.src.dir}"/>
- <copy todir="${dist.src.dir}">
- <fileset dir="${src.dir}">
- <patternset refid="source.files"/>
- </fileset>
- <fileset dir="${src.dir}">
- <patternset refid="support.files"/>
- </fileset>
- </copy>
- <mkdir dir="${dist.src.dir}"/>
- <copy todir="${dist.src.dir}">
- <fileset dir="${src.dir}">
- <patternset refid="source.files"/>
- </fileset>
- <fileset dir="${src.dir}">
- <patternset refid="support.files"/>
- </fileset>
- </copy>
- </target>
-
- <target name="copylib" description="Copy jars to lib dir">
- <mkdir dir="${dist.lib.dir}"/>
- <copy todir="${dist.lib.dir}" verbose="true">
- <fileset dir="${lib.dir}">
- <include name="**/*.jar"/>
- <exclude name="log4j.jar"/>
- <exclude name="checkstyle*.jar"/>
- <include name="*.txt"/>
- </fileset>
- </copy>
- </target>
-
- <target name="copydoc" description="Copy doc to dist dir" if="copy.doc">
- <mkdir dir="${dist.doc.dir}"/>
- <copy todir="${dist.doc.dir}">
- <fileset dir="${doc.dir}">
- <include name="**/*.html"/>
- </fileset>
- </copy>
- </target>
-
- <target name="jartest" depends="compiletest"
- description="Build the distribution .jar file">
- <mkdir dir="${dist.dir}"/>
- <jar filesetmanifest="merge" jarfile="${jartest.file.name}"
- basedir="${testclasses.dir}"/>
- </target>
-
- <!-- DOCUMENTATION -->
-
- <target name="javadoc"
- description="Compile the Javadoc API documentation to dist dir">
- <mkdir dir="${dist.api.dir}"/>
- <javadoc packagenames="${javadoc.packagenames}"
- classpathref="lib.class.path" destdir="${dist.api.dir}" use="true"
- protected="true" version="true"
- windowtitle="${Name} API Documentation"
- Overview="${doc.api.dir}/package.html"
- doctitle="${Name} API Documentation"
- stylesheetfile="${doc.api.dir}/jdstyle.css" link="${javadoc}">
- <packageset dir="${src.dir}" defaultexcludes="yes">
- <include name="**/*"/>
- </packageset>
- <link href="http://lucene.apache.org/java/2_4_0/api"/>
- </javadoc>
- </target>
-
- <target name="extras" description="Copies miscellaneous files to root dir">
- <copy file="readme.txt" todir="${dist.dir}"/>
- <copy file="lgpl.txt" todir="${dist.dir}"/>
- <copy file="changelog.txt" todir="${dist.dir}"/>
- <copy file="build.xml" todir="${dist.dir}"/>
- <copy file="ivy.xml" todir="${dist.dir}"/>
- <copy todir="${dist.dir}/jdbc">
- <fileset dir="jdbc"/>
- </copy>
- <replace file="${dist.dir}/build.xml">
- <replacetoken><![CDATA[../${name}-${version}]]>
- </replacetoken>
- <replacevalue><![CDATA[../${name}]]>
- </replacevalue>
- </replace>
- </target>
-
- <target name="dist" depends="jar,javadoc,copysource,copydoc,extras"
- description="Build everything">
- <zip zipfile="${dist.dir}-${version}.zip">
- <zipfileset prefix="${name}-${version}" dir="${dist.dir}"/>
- </zip>
- <tar compression="gzip" tarfile="${dist.dir}-${version}.tar.gz">
- <tarfileset prefix="${name}-${version}" dir="${dist.dir}"/>
- </tar>
- </target>
-
- <target name="info" description="Echoes useful system properties">
- <echo message="java.vm.info=${java.vm.info}"/>
- <echo message="java.vm.name=${java.vm.name}"/>
- <echo message="java.vm.vendor=${java.vm.vendor}"/>
- <echo message="java.vm.version=${java.vm.version}"/>
- <echo message="os.arch=${os.arch}"/>
- <echo message="os.name=${os.name}"/>
- <echo message="os.version=${os.version}"/>
- <echo message="java.home = ${java.home}"/>
- <echo message="java.class.path = ${java.class.path}"/>
- <echo message="build.compiler = ${build.compiler}"/>
- <echo message="file.encoding=${file.encoding}"/>
- <echo message="user.home = ${user.home}"/>
- <echo message="user.language=${user.language}"/>
- </target>
-
- <target name="test-resources" description="Copies and filters test resources">
- <filter filtersfile="${filter.dir}/${db}.filter"/>
- <mkdir dir="${testclasses.dir}"/>
- <copy todir="${testclasses.dir}" filtering="true" overwrite="true">
- <fileset dir="${test.resources.dir}">
- <include name="*.properties"/>
- <include name="*.xml"/>
- </fileset>
- </copy>
- </target>
-
- <target name="instrument" depends="compiletest"
- description="Instrument the persistent classes"> <!-- depends="jar" -->
-
- <taskdef name="instrument"
- classname="org.hibernate.tool.instrument.javassist.InstrumentTask">
- <classpath refid="junit.classpath"/>
- </taskdef>
-
- <instrument verbose="true">
- <fileset dir="${testclasses.dir}/org/hibernate/test">
- <include name="**/*.class"/>
- <exclude name="**/*Test$*.class"/>
- <exclude name="**/*Test.class"/>
- <exclude name="**/*Tests.class"/>
- </fileset>
- </instrument>
- </target>
-
- <target name="junitinstrument" depends="compiletest,instrument"
- description="Run the instrument test suite">
- <for list="${targetdb}" param="db">
- <sequential>
- <antcall target="test-resources">
- <param name="db" value="@{db}"/>
- </antcall>
- <mkdir dir="${instrumenttest.out.dir}/@{db}"/>
- <echo>Running against db: @{db}</echo>
- <junit printsummary="yes" haltonfailure="yes" dir="${basedir}"
- maxmemory="256M" fork="yes" forkmode="perBatch">
- <classpath refid="junit.classpath"/>
- <formatter type="plain"/>
- <formatter type="xml"/>
- <batchtest todir="${instrumenttest.out.dir}/@{db}" haltonfailure="no">
- <fileset refid="junit.batchtestset"/>
- </batchtest>
- </junit>
- </sequential>
- </for>
- </target>
-
- <target name="junitreport">
- <junitreport todir="${testreports.dir}">
- <fileset dir="${testreports.dir}">
- <include name="TEST-*.xml"/>
- </fileset>
- <report format="frames" todir="${testreports.dir}"/>
- </junitreport>
- </target>
-
- <target name="checkstyle" description="Check coding style">
- <taskdef resource="checkstyletask.properties">
- <classpath>
- <path refid="lib.class.path"/>
- <fileset dir="${common-build.basedir}/lib">
- <include name="checkstyle*.jar"/>
- </fileset>
- </classpath>
- </taskdef>
-
- <checkstyle config="${common-build.basedir}/checkstyle_checks.xml">
- <fileset dir="${src.dir}">
- <include name="**/*.java"/>
- </fileset>
- <formatter type="plain"/>
- </checkstyle>
- </target>
-
- <target name="patch" depends="checkstyle" description="Create a patch">
- <cvs command="-q diff -u -N" output="patch.txt"/>
- </target>
-
- <!-- maven deploy: to be used by the subbuild and delcare deps on jar -->
- <target name="deploy" depends="jar">
- <fail unless="offline.repository.jboss.org"
- message="offline.repository.jboss.org must be defined"/>
- <jar jarfile="${src.jar}" basedir="${src.dir}">
- <include name="**/*.java"/>
- <exclude name="**/test/*.java"/>
- <!-- patternset refid="meta.files" / -->
- </jar>
-
- <artifact:pom id="maven.project" file="${pom.file}"/>
-
- <artifact:install file="${jar.file.name}">
- <pom refid="maven.project"/>
- </artifact:install>
-
- <artifact:deploy file="${jar.file.name}">
- <pom refid="maven.project"/>
- <remoteRepository refId="offline.repository.jboss.org">
- </remoteRepository>
- <attach file="${src.jar}" classifier="sources"/>
- <attach file="${jar.file.name}" classifier=""/>
- </artifact:deploy>
- </target>
-
-</project>
\ No newline at end of file
Deleted: search/branches/Branch_3_1/doc/api/jdstyle.css
===================================================================
--- search/branches/Branch_3_1/doc/api/jdstyle.css 2009-05-12 15:25:27 UTC (rev 16553)
+++ search/branches/Branch_3_1/doc/api/jdstyle.css 2009-05-13 12:38:19 UTC (rev 16554)
@@ -1,117 +0,0 @@
-/* Javadoc style sheet */
-
-/* Define colors, fonts and other style attributes here to override the defaults */
-
-/* Page background color */
-body { font-family: Arial;
- background-color: white;
- font-size: 10pt;
- }
-td { font-family: Arial;
- font-size: 10pt;
- }
-/* Table colors */
-.TableHeadingColor { background: #F4F4F4 }
-.TableSubHeadingColor { background: #F4F4F4 }
-.TableRowColor { background: #FFFFFF }
-
-/* Font used in left-hand frame lists */
-.FrameTitleFont { font-size: normal; font-family: Arial }
-.FrameHeadingFont { font-size: normal; font-family: Arial }
-.FrameItemFont { font-size: normal; font-family: Arial }
-
-/* Example of smaller, sans-serif font in frames */
-/* .FrameItemFont { font-size: 10pt; font-family: Helvetica, Arial, sans-serif } */
-
-/* Navigation bar fonts and colors */
-.NavBarCell1 { background-color:#F4F4F4;}
-.NavBarCell1Rev { background-color:silver;}
-
-.NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;}
-.NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;}
-
-.NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;}
-.NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;}
-
-A {
- color: #003399;
-}
-
-A:active {
- color: #003399;
-}
-
-A:visited {
- color: #888888;
-}
-
-P, OL, UL, LI, DL, DT, DD, BLOCKQUOTE {
- color: #000000;
-}
-
-TD, TH, SPAN {
- color: #000000;
-}
-
-BLOCKQUOTE {
- margin-right: 0px;
-}
-
-
-/*H1, H2, H3, H4, H5, H6 {
- color: #000000;
- font-weight:500;
- margin-top:10px;
- padding-top:15px;
-}
-
-H1 { font-size: 150%; }
-H2 { font-size: 140%; }
-H3 { font-size: 110%; font-weight: bold; }
-H4 { font-size: 110%; font-weight: bold;}
-H5 { font-size: 100%; font-style: italic; }
-H6 { font-size: 100%; font-style: italic; }*/
-
-TT {
-font-size: 90%;
- font-family: "Courier New", Courier, monospace;
- color: #000000;
-}
-
-PRE {
-font-size: 90%;
- padding: 5px;
- border-style: solid;
- border-width: 1px;
- border-color: #CCCCCC;
- background-color: #F4F4F4;
-}
-
-UL, OL, LI {
- list-style: disc;
-}
-
-HR {
- width: 100%;
- height: 1px;
- background-color: #CCCCCC;
- border-width: 0px;
- padding: 0px;
- color: #CCCCCC;
-}
-
-.variablelist {
- padding-top: 10;
- padding-bottom:10;
- margin:0;
-}
-
-.itemizedlist, UL {
- padding-top: 0;
- padding-bottom:0;
- margin:0;
-}
-
-.term {
- font-weight:bold;
-}
Deleted: search/branches/Branch_3_1/ivy.xml
===================================================================
--- search/branches/Branch_3_1/ivy.xml 2009-05-12 15:25:27 UTC (rev 16553)
+++ search/branches/Branch_3_1/ivy.xml 2009-05-13 12:38:19 UTC (rev 16554)
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ivy-module version="1.3"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:noNamespaceSchemaLocation=
- "http://www.jayasoft.org/misc/ivy/ivy.xsd">
- <info organisation="org.hibernate" module="search"/>
- <configurations>
- <conf name="default" description="Core module dependencies"/>
- <conf name="test" visibility="private" description="Dependencies needed for testing purposes"/>
- </configurations>
- <publications>
- <artifact name="hibernate-search" conf="default"/>
- </publications>
- <dependencies>
-
- <!-- compile time dependencies -->
- <dependency name="ejb3-persistence" rev="1.0.2.GA" conf="default->default"/>
- <dependency name="commons-annotations" rev="3.1.0.GA" conf="default->default"/>
- <dependency org="org.slf4j" name="slf4j-api" rev="1.4.2" conf="default->default"/>
- <dependency org="org.hibernate" name="hibernate-core" rev="3.3.1.GA" conf="default->default"/>
- <dependency org="javax.transaction" name="jta" rev="1.1" conf="default->default"/>
- <dependency org="org.apache.lucene" name="lucene-core" rev="2.4.1" conf="default->default"/>
- <dependency org="javax.jms" name="jms" rev="1.1" conf="default->default"/> <!-- optional -->
- <dependency org="javax.annotation" name="jsr250-api" rev="1.0" conf="default->default"/> <!-- optional -->
- <dependency org="org.apache.solr" name="solr-core" rev="1.3.0" conf="default->default"/> <!-- optional -->
- <dependency org="org.apache.solr" name="solr-common" rev="1.3.0" conf="default->default"/> <!-- optional -->
-
- <!-- transitive dependencies -->
- <dependency org="antlr" name="antlr" rev="2.7.6" conf="test->default"/>
- <dependency org="commons-collections" name="commons-collections" rev="3.1" conf="test->default"/>
- <dependency org="dom4j" name="dom4j" rev="1.6.1" conf="test->default"/>
-
- <!-- test deps -->
- <dependency name="annotations" rev="3.4.0.GA" conf="test->default"/>
- <dependency name="entitymanager" rev="3.4.0.GA" conf="test->default"/>
- <dependency org="org.apache.lucene" name="lucene-snowball" rev="2.4.1" conf="test->default"/>
- <dependency org="org.apache.lucene" name="lucene-analyzers" rev="2.4.1" conf="test->default"/>
- <dependency org="org.apache.commons" name="commons-codec" rev="1.3" conf="test->default"/>
- <dependency org="org.apache.commons" name="commons-io" rev="1.3.2" conf="test->default"/>
- <dependency org="cglib" name="cglib" rev="2.1_3" conf="test->default"/>
- <dependency org="asm" name="asm" rev="1.5.3" conf="test->default"/>
- <dependency org="asm" name="asm-attrs" rev="1.5.3" conf="test->default"/>
- <dependency org="org.slf4j" name="slf4j-log4j12" rev="1.4.2" conf="test->default"/>
- <dependency org="log4j" name="log4j" rev="1.2.14" conf="test->default"/>
- <dependency org="junit" name="junit" rev="3.8.1" conf="test->default"/>
- <dependency org="hsqldb" name="hsqldb" rev="1.8.0.2" conf="test->default"/>
- <dependency org="postgresql" name="postgresql" rev="8.3-603.jdbc3" conf="test->default"/>
- <dependency org="mysql" name="mysql-connector-java" rev="5.1.6" conf="test->default"/>
- <dependency org="org.apache.derby" name="derby" rev="10.2.1.6" conf="test->default"/>
-
- </dependencies>
-</ivy-module>
Modified: search/branches/Branch_3_1/pom.xml
===================================================================
--- search/branches/Branch_3_1/pom.xml 2009-05-12 15:25:27 UTC (rev 16553)
+++ search/branches/Branch_3_1/pom.xml 2009-05-13 12:38:19 UTC (rev 16554)
@@ -1,31 +1,63 @@
<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/maven-v4_0_0.xsd">
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search</artifactId>
- <version>3.1.0.GA</version>
+ <version>3.2.0-SNAPSHOT</version>
<name>Hibernate Search</name>
<description>Hibernate Search</description>
<url>http://search.hibernate.org</url>
+
<issueManagement>
- <system>JIRA</system>
- <url>http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH</url>
+ <system>JIRA</system>
+ <url>http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH</url>
</issueManagement>
<scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/hibernate/search/</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/hibernate/search/</developerConnection>
- <url>http://fisheye.jboss.com/browse/Hibernate/search</url>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/hibernate/search/</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/hibernate/search/</developerConnection>
+ <url>http://fisheye.jboss.com/browse/Hibernate/search</url>
</scm>
+
<organization>
- <name>Hibernate</name>
- <url>http://www.hibernate.org</url>
+ <name>Hibernate</name>
+ <url>http://www.hibernate.org</url>
</organization>
+
+ <licenses>
+ <license>
+ <name>LGPL</name>
+ <url>lgpl.txt</url>
+ </license>
+ </licenses>
+
+ <developers>
+ <developer>
+ <id>epbernard</id>
+ <name>Emmanuel Bernard</name>
+ <email>emmanuel(a)hibernate.org</email>
+ <url>http://in.relation.to/Bloggers/Emmanuel</url>
+ </developer>
+ <developer>
+ <id>hardy.ferentschik</id>
+ <name>Hardy Ferentschik</name>
+ <url>http://in.relation.to/Bloggers/Hardy</url>
+ </developer>
+ </developers>
+ <contributors>
+ <contributor>
+ <name>Sanne Grinovero</name>
+ </contributor>
+ </contributors>
+
<dependencies>
+ <!-- =============================== -->
+ <!-- Required Dependencies -->
+ <!-- =============================== -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
- <version>3.3.1.GA</version>
+ <version>${hibernateVersion}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
@@ -40,79 +72,593 @@
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
- <version>2.4.0</version>
+ <version>${luceneVersion}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
- <version>1.4.2</version>
+ <version>${slf4jVersion}</version>
</dependency>
<dependency>
- <groupId>javax.transaction</groupId>
- <artifactId>jta</artifactId>
- <version>1.1</version>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-annotations</artifactId>
- <version>3.4.0.GA</version>
- <optional>true</optional>
+ <groupId>javax.transaction</groupId>
+ <artifactId>jta</artifactId>
+ <version>1.1</version>
</dependency>
+
+ <!-- =============================== -->
+ <!-- Testing Dependencies -->
+ <!-- =============================== -->
<dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-entitymanager</artifactId>
- <version>3.4.0.GA</version>
- <optional>true</optional>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-core</artifactId>
+ <version>5.2.0</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
- <groupId>org.apache.solr</groupId>
- <artifactId>solr-common</artifactId>
- <version>1.3.0</version>
- <optional>true</optional>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.solr</groupId>
- <artifactId>solr-core</artifactId>
- <version>1.3.0</version>
- <optional>true</optional>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>${slf4jVersion}</version>
+ <scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.apache.lucene</groupId>
- <artifactId>lucene-snowball</artifactId>
- <version>2.4.0</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.apache.lucene</groupId>
- <artifactId>lucene-analyzers</artifactId>
- <version>2.4.0</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-codec</artifactId>
- <version>1.3</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-io</artifactId>
- <version>1.3.2</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>javax.jms</groupId>
- <artifactId>jms</artifactId>
- <version>1.1</version>
- <scope>runtime</scope>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>javax.annotation</groupId>
- <artifactId>jsr250-api</artifactId>
- <version>1.0</version>
- <scope>runtime</scope>
- <optional>true</optional>
- </dependency>
</dependencies>
+
+ <build>
+ <defaultGoal>test</defaultGoal>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <forkMode>pertest</forkMode>
+ <redirectTestOutputToFile>true</redirectTestOutputToFile>
+ <systemProperties>
+ <property>
+ <name>build.dir</name>
+ <value>${basedir}/target</value>
+ </property>
+ </systemProperties>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jdocbook-plugin</artifactId>
+ <version>2.1.0</version>
+ <extensions>true</extensions>
+ <dependencies>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-jdocbook-style</artifactId>
+ <version>1.0.2</version>
+ <type>jdocbook-style</type>
+ </dependency>
+ </dependencies>
+ <configuration>
+ <sourceDocumentName>master.xml</sourceDocumentName>
+ <sourceDirectory>${basedir}/src/main/docbook/en-US</sourceDirectory>
+ <masterTranslation>en-US</masterTranslation>
+ <imageResource>
+ <directory>${basedir}/src/main/docbook/en-US/images</directory>
+ </imageResource>
+ <formats>
+ <format>
+ <formatName>pdf</formatName>
+ <stylesheetResource>classpath:/xslt/hibernate/pdf/main-pdf.xsl</stylesheetResource>
+ <finalName>hibernate-search-guide.pdf</finalName>
+ </format>
+ <format>
+ <formatName>html_single</formatName>
+ <stylesheetResource>classpath:/xslt/hibernate/html/main-single.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ <format>
+ <formatName>html</formatName>
+ <stylesheetResource>classpath:/xslt/hibernate/html/main-chunk.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ </formats>
+ <options>
+ <xincludeSupported>true</xincludeSupported>
+ <localeSeparator>-</localeSeparator>
+ <useRelativeImageUris>true</useRelativeImageUris>
+ </options>
+ </configuration>
+ <executions>
+ <execution>
+ <id>make-doc</id>
+ <phase>site</phase>
+ <goals>
+ <goal>resources</goal>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <stylesheetfile>${basedir}/src/main/javadoc/jdstyle.css</stylesheetfile>
+ </configuration>
+ <executions>
+ <execution>
+ <id>make-javadoc</id>
+ <phase>package</phase>
+ <goals>
+ <goal>javadoc</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/dist.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-release-plugin</artifactId>
+ <configuration>
+ <releaseProfiles>release</releaseProfiles>
+ <goals>package javadoc:javadoc org.jboss.maven.plugins:maven-jdocbook-plugin:2.1.0:resources
+ org.jboss.maven.plugins:maven-jdocbook-plugin:2.1.0:generate assembly:assembly
+ </goals>
+ </configuration>
+ </plugin>
+ </plugins>
+ <testResources>
+ <testResource>
+ <filtering>true</filtering>
+ <directory>src/test/resources</directory>
+ <includes>
+ <include>**/*.properties</include>
+ <include>**/*.xml</include>
+ </includes>
+ </testResource>
+ </testResources>
+ </build>
+
+ <profiles>
+ <!-- =============================== -->
+ <!-- Database profiles -->
+ <!-- =============================== -->
+ <!-- HSQLDB is the default (eventually move to H2) -->
+ <profile>
+ <id>hsqldb</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <version>1.8.0.2</version>
+ </dependency>
+ </dependencies>
+ <properties>
+ <db.dialect>org.hibernate.dialect.HSQLDialect</db.dialect>
+ <jdbc.driver>org.hsqldb.jdbcDriver</jdbc.driver>
+ <jdbc.url>jdbc:hsqldb:.</jdbc.url>
+ <jdbc.user>sa</jdbc.user>
+ <jdbc.pass/>
+ <jdbc.isolation/>
+ </properties>
+ </profile>
+ <profile>
+ <id>postgresql</id>
+ <dependencies>
+ <dependency>
+ <groupId>postgresql</groupId>
+ <artifactId>postgresql</artifactId>
+ <version>8.3-603.jdbc3</version>
+ </dependency>
+ </dependencies>
+ <properties>
+ <db.dialect>org.hibernate.dialect.PostgreSQLDialect</db.dialect>
+ <jdbc.driver>org.postgresql.Driver</jdbc.driver>
+ <jdbc.url>jdbc:postgresql://localhost:5432/hibernate</jdbc.url>
+ <jdbc.user>hibernate</jdbc.user>
+ <jdbc.pass>hibernate</jdbc.pass>
+ <jdbc.isolation/>
+ </properties>
+ </profile>
+ <profile>
+ <id>mysql</id>
+ <dependencies>
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <version>5.1.6</version>
+ </dependency>
+ </dependencies>
+ <properties>
+ <db.dialect>org.hibernate.dialect.MySQL5InnoDBDialect</db.dialect>
+ <jdbc.driver>com.mysql.jdbc.Driver</jdbc.driver>
+ <jdbc.url>jdbc:mysql://localhost/hibernate</jdbc.url>
+ <jdbc.user>hibernate</jdbc.user>
+ <jdbc.pass>hibernate</jdbc.pass>
+ <jdbc.isolation/>
+ </properties>
+ </profile>
+ <profile>
+ <id>sqlserver</id>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.jtds</groupId>
+ <artifactId>jtds</artifactId>
+ <version>1.2</version>
+ </dependency>
+ </dependencies>
+ <properties>
+ <db.dialect>org.hibernate.dialect.SQLServerDialect</db.dialect>
+ <jdbc.driver>net.sourceforge.jtds.jdbc.Driver</jdbc.driver>
+ <jdbc.url>jdbc:jtds:sqlserver://ec2-67-202-7-25.compute-1.amazonaws.com:1433;DatabaseName=hibernate
+ </jdbc.url>
+ <jdbc.user>hibernate</jdbc.user>
+ <jdbc.pass>hibernate</jdbc.pass>
+ <jdbc.isolation/>
+ </properties>
+ </profile>
+
+ <!--
+ ###################################################################
+ Profiles naming db instances in the Red Hat QA/QE lab
+
+ First, those with OSS drivers
+ ###################################################################
+ -->
+
+ <!-- The MySQL5 test envionment -->
+ <profile>
+ <id>mysql5</id>
+ <dependencies>
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <version>5.0.5</version>
+ </dependency>
+ </dependencies>
+ <properties>
+ <db.dialect>org.hibernate.dialect.MySQL5InnoDBDialect</db.dialect>
+ <jdbc.driver>com.mysql.jdbc.Driver</jdbc.driver>
+ <jdbc.url>jdbc:mysql://dev02.qa.atl.jboss.com/hibbrtru</jdbc.url>
+ <jdbc.user>hibbrtru</jdbc.user>
+ <jdbc.pass>hibbrtru</jdbc.pass>
+ <jdbc.isolation/>
+ </properties>
+ </profile>
+
+ <!-- The PostgreSQL test envionment -->
+ <profile>
+ <id>postgresql823</id>
+ <dependencies>
+ <dependency>
+ <groupId>postgresql</groupId>
+ <artifactId>postgresql</artifactId>
+ <version>8.2-504</version>
+ <classifier>jdbc3</classifier>
+ </dependency>
+ </dependencies>
+ <properties>
+ <db.dialect>org.hibernate.dialect.PostgreSQLDialect</db.dialect>
+ <jdbc.driver>org.postgresql.Driver</jdbc.driver>
+ <jdbc.url>jdbc:postgresql://dev01.qa.atl.jboss.com:5432:hibbrtru</jdbc.url>
+ <jdbc.user>hibbrtru</jdbc.user>
+ <jdbc.pass>hibbrtru</jdbc.pass>
+ <jdbc.isolation/>
+ </properties>
+ </profile>
+
+ <!--
+ ###################################################################
+ Then, those with commercial drivers
+ ###################################################################
+ -->
+
+ <!-- The DB2 8.x test envionment (using 9x drivers)-->
+ <profile>
+ <id>db2v82</id>
+ <dependencies>
+ <dependency>
+ <groupId>com.ibm</groupId>
+ <artifactId>db2jcc</artifactId>
+ <version>3.1.57</version>
+ </dependency>
+ <dependency>
+ <groupId>com.ibm</groupId>
+ <artifactId>db2jcc_license_cu</artifactId>
+ <version>3.1.57</version>
+ </dependency>
+ </dependencies>
+ <properties>
+ <db.dialect>org.hibernate.dialect.DB2Dialect</db.dialect>
+ <jdbc.driver>com.ibm.db2.jcc.DB2Driver</jdbc.driver>
+ <jdbc.url>jdbc:db2://dev32.qa.atl.jboss.com:50000/jbossqa</jdbc.url>
+ <jdbc.user>hibbrtru</jdbc.user>
+ <jdbc.pass>hibbrtru</jdbc.pass>
+ <jdbc.isolation/>
+ </properties>
+ </profile>
+
+ <!-- The DB2 9.x test envionment (using 9x drivers)-->
+ <profile>
+ <id>db2v91</id>
+ <dependencies>
+ <dependency>
+ <groupId>com.ibm</groupId>
+ <artifactId>db2jcc</artifactId>
+ <version>3.1.57</version>
+ </dependency>
+ <dependency>
+ <groupId>com.ibm</groupId>
+ <artifactId>db2jcc_license_cu</artifactId>
+ <version>3.1.57</version>
+ </dependency>
+ </dependencies>
+ <properties>
+ <db.dialect>org.hibernate.dialect.DB2Dialect</db.dialect>
+ <jdbc.driver>com.ibm.db2.jcc.DB2Driver</jdbc.driver>
+ <jdbc.url>jdbc:db2://dev67.qa.atl.jboss.com:50000/jbossqa</jdbc.url>
+ <jdbc.user>hibbrtru</jdbc.user>
+ <jdbc.pass>hibbrtru</jdbc.pass>
+ <jdbc.isolation/>
+ </properties>
+ </profile>
+
+ <!-- The Oracle9i test envionment -->
+ <profile>
+ <id>oracle9i</id>
+ <dependencies>
+ <dependency>
+ <groupId>com.oracle</groupId>
+ <artifactId>ojdbc14</artifactId>
+ <!-- use the 10g drivers which are surprisingly largely bug free -->
+ <version>10.0.2.0</version>
+ </dependency>
+ </dependencies>
+ <properties>
+ <db.dialect>org.hibernate.dialect.Oracle9iDialect</db.dialect>
+ <jdbc.driver>oracle.jdbc.driver.OracleDriver</jdbc.driver>
+ <jdbc.url>jdbc:oracle:thin:@dev20.qa.atl.jboss.com:1521:qa</jdbc.url>
+ <jdbc.user>hibbrtru</jdbc.user>
+ <jdbc.pass>hibbrtru</jdbc.pass>
+ <jdbc.isolation/>
+ </properties>
+ </profile>
+
+ <!-- The Oracle10g test envionment -->
+ <profile>
+ <id>oracle10g</id>
+ <dependencies>
+ <dependency>
+ <groupId>com.oracle</groupId>
+ <artifactId>ojdbc14</artifactId>
+ <!-- use the 10g drivers which are surprisingly largely bug free -->
+ <version>10.0.2.0</version>
+ </dependency>
+ </dependencies>
+ <properties>
+ <db.dialect>org.hibernate.dialect.Oracle10gDialect</db.dialect>
+ <jdbc.driver>oracle.jdbc.driver.OracleDriver</jdbc.driver>
+ <jdbc.url>jdbc:oracle:thin:@dev01.qa.atl.jboss.com:1521:qadb01</jdbc.url>
+ <jdbc.user>hibbrtru</jdbc.user>
+ <jdbc.pass>hibbrtru</jdbc.pass>
+ <jdbc.isolation/>
+ </properties>
+ </profile>
+
+ <!-- The Sybase 15 test envionment -->
+ <profile>
+ <id>sybase15</id>
+ <dependencies>
+ <dependency>
+ <groupId>com.sybase</groupId>
+ <artifactId>jconnect</artifactId>
+ <version>6.0.5</version>
+ </dependency>
+ </dependencies>
+ <properties>
+ <db.dialect>org.hibernate.dialect.SybaseASE15Dialect</db.dialect>
+ <jdbc.driver>com.sybase.jdbc3.jdbc.SybDriver</jdbc.driver>
+ <jdbc.url>jdbc:sybase:Tds:dev77.qa.atl2.redhat.com:5000/hibbrtru</jdbc.url>
+ <jdbc.user>hibbrtru</jdbc.user>
+ <jdbc.pass>hibbrtru</jdbc.pass>
+ <jdbc.isolation/>
+ </properties>
+ </profile>
+
+ <!-- The SQLServer2005 (MS JDBC) test envionment -->
+ <profile>
+ <id>mssql2005</id>
+ <dependencies>
+ <dependency>
+ <groupId>com.microsoft.sqlserver</groupId>
+ <artifactId>msjdbc</artifactId>
+ <version>1.1</version>
+ </dependency>
+ </dependencies>
+ <properties>
+ <db.dialect>org.hibernate.dialect.SQLServerDialect</db.dialect>
+ <jdbc.driver>com.microsoft.sqlserver.jdbc.SQLServerDriver</jdbc.driver>
+ <jdbc.url>jdbc:sqlserver://dev30.qa.atl.jboss.com:3918</jdbc.url>
+ <jdbc.user>hibbrtru</jdbc.user>
+ <jdbc.pass>hibbrtru</jdbc.pass>
+ <jdbc.isolation>4096</jdbc.isolation>
+ </properties>
+ </profile>
+
+ <!-- ================================ -->
+ <!-- Dependecy profiles to test w and -->
+ <!-- w/o optional dependencies -->
+ <!-- =============================== -->
+ <profile>
+ <id>with-optional-jars</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <dependencies>
+ <!-- =============================== -->
+ <!-- Optional Dependencies -->
+ <!-- =============================== -->
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-annotations</artifactId>
+ <version>3.4.0.GA</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-entitymanager</artifactId>
+ <version>3.4.0.GA</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.solr</groupId>
+ <artifactId>solr-common</artifactId>
+ <version>1.3.0</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.solr</groupId>
+ <artifactId>solr-core</artifactId>
+ <version>1.3.0</version>
+ <optional>true</optional>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.solr</groupId>
+ <artifactId>solr-solrj</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>net.java.dev.stax-utils</groupId>
+ <artifactId>stax-utils</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-snowball</artifactId>
+ <version>${luceneVersion}</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-analyzers</artifactId>
+ <version>${luceneVersion}</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.3</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.3.2</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>javax.jms</groupId>
+ <artifactId>jms</artifactId>
+ <version>1.1</version>
+ <scope>provided</scope>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>javax.annotation</groupId>
+ <artifactId>jsr250-api</artifactId>
+ <version>1.0</version>
+ <optional>true</optional>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <forkMode>pertest</forkMode>
+ <redirectTestOutputToFile>true</redirectTestOutputToFile>
+ <excludes>
+ <exclude>**/classloading/*.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>without-optional-jars</id>
+ <dependencies>
+ <dependency>
+ <groupId>javassist</groupId>
+ <artifactId>javassist</artifactId>
+ <version>3.4.GA</version>
+ <optional>true</optional>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <forkMode>pertest</forkMode>
+ <redirectTestOutputToFile>true</redirectTestOutputToFile>
+ <excludes>
+ <exclude>none</exclude>
+ </excludes>
+ <includes>
+ <include>**/classloading/*Test.java</include>
+ </includes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <properties>
+ <slf4jVersion>1.4.2</slf4jVersion>
+ <luceneVersion>2.4.1</luceneVersion>
+ <hibernateVersion>3.3.1.GA</hibernateVersion>
+ </properties>
+
</project>
Copied: search/branches/Branch_3_1/src/main/java (from rev 16553, search/branches/Branch_3_1/src/java)
Modified: search/branches/Branch_3_1/src/main/java/org/hibernate/search/analyzer/Discriminator.java
===================================================================
--- search/branches/Branch_3_1/src/java/org/hibernate/search/analyzer/Discriminator.java 2009-05-12 15:25:27 UTC (rev 16553)
+++ search/branches/Branch_3_1/src/main/java/org/hibernate/search/analyzer/Discriminator.java 2009-05-13 12:38:19 UTC (rev 16554)
@@ -1,4 +1,4 @@
-// $Id:$
+// $Id$
package org.hibernate.search.analyzer;
/**
Modified: search/branches/Branch_3_1/src/main/java/org/hibernate/search/annotations/AnalyzerDiscriminator.java
===================================================================
--- search/branches/Branch_3_1/src/java/org/hibernate/search/annotations/AnalyzerDiscriminator.java 2009-05-12 15:25:27 UTC (rev 16553)
+++ search/branches/Branch_3_1/src/main/java/org/hibernate/search/annotations/AnalyzerDiscriminator.java 2009-05-13 12:38:19 UTC (rev 16554)
@@ -1,4 +1,4 @@
-// $Id:$
+// $Id$
package org.hibernate.search.annotations;
import java.lang.annotation.Retention;
Modified: search/branches/Branch_3_1/src/main/java/org/hibernate/search/impl/InitContext.java
===================================================================
--- search/branches/Branch_3_1/src/java/org/hibernate/search/impl/InitContext.java 2009-05-12 15:25:27 UTC (rev 16553)
+++ search/branches/Branch_3_1/src/main/java/org/hibernate/search/impl/InitContext.java 2009-05-13 12:38:19 UTC (rev 16554)
@@ -1,4 +1,4 @@
-// $Id:$
+// $Id$
package org.hibernate.search.impl;
import java.util.ArrayList;
Modified: search/branches/Branch_3_1/src/main/java/org/hibernate/search/reader/CacheableMultiReader.java
===================================================================
--- search/branches/Branch_3_1/src/java/org/hibernate/search/reader/CacheableMultiReader.java 2009-05-12 15:25:27 UTC (rev 16553)
+++ search/branches/Branch_3_1/src/main/java/org/hibernate/search/reader/CacheableMultiReader.java 2009-05-13 12:38:19 UTC (rev 16554)
@@ -1,4 +1,4 @@
-// $Id:$
+// $Id$
package org.hibernate.search.reader;
import java.io.IOException;
Modified: search/branches/Branch_3_1/src/main/java/org/hibernate/search/util/LoggerFactory.java
===================================================================
--- search/branches/Branch_3_1/src/java/org/hibernate/search/util/LoggerFactory.java 2009-05-12 15:25:27 UTC (rev 16553)
+++ search/branches/Branch_3_1/src/main/java/org/hibernate/search/util/LoggerFactory.java 2009-05-13 12:38:19 UTC (rev 16554)
@@ -1,4 +1,4 @@
-// $Id:$
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
Copied: search/branches/Branch_3_1/src/main/javadoc/jdstyle.css (from rev 16466, search/branches/Branch_3_1/doc/api/jdstyle.css)
===================================================================
--- search/branches/Branch_3_1/src/main/javadoc/jdstyle.css (rev 0)
+++ search/branches/Branch_3_1/src/main/javadoc/jdstyle.css 2009-05-13 12:38:19 UTC (rev 16554)
@@ -0,0 +1,117 @@
+/* Javadoc style sheet */
+
+/* Define colors, fonts and other style attributes here to override the defaults */
+
+/* Page background color */
+body { font-family: Arial;
+ background-color: white;
+ font-size: 10pt;
+ }
+td { font-family: Arial;
+ font-size: 10pt;
+ }
+/* Table colors */
+.TableHeadingColor { background: #F4F4F4 }
+.TableSubHeadingColor { background: #F4F4F4 }
+.TableRowColor { background: #FFFFFF }
+
+/* Font used in left-hand frame lists */
+.FrameTitleFont { font-size: normal; font-family: Arial }
+.FrameHeadingFont { font-size: normal; font-family: Arial }
+.FrameItemFont { font-size: normal; font-family: Arial }
+
+/* Example of smaller, sans-serif font in frames */
+/* .FrameItemFont { font-size: 10pt; font-family: Helvetica, Arial, sans-serif } */
+
+/* Navigation bar fonts and colors */
+.NavBarCell1 { background-color:#F4F4F4;}
+.NavBarCell1Rev { background-color:silver;}
+
+.NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;}
+.NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;}
+
+.NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;}
+.NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;}
+
+A {
+ color: #003399;
+}
+
+A:active {
+ color: #003399;
+}
+
+A:visited {
+ color: #888888;
+}
+
+P, OL, UL, LI, DL, DT, DD, BLOCKQUOTE {
+ color: #000000;
+}
+
+TD, TH, SPAN {
+ color: #000000;
+}
+
+BLOCKQUOTE {
+ margin-right: 0px;
+}
+
+
+/*H1, H2, H3, H4, H5, H6 {
+ color: #000000;
+ font-weight:500;
+ margin-top:10px;
+ padding-top:15px;
+}
+
+H1 { font-size: 150%; }
+H2 { font-size: 140%; }
+H3 { font-size: 110%; font-weight: bold; }
+H4 { font-size: 110%; font-weight: bold;}
+H5 { font-size: 100%; font-style: italic; }
+H6 { font-size: 100%; font-style: italic; }*/
+
+TT {
+font-size: 90%;
+ font-family: "Courier New", Courier, monospace;
+ color: #000000;
+}
+
+PRE {
+font-size: 90%;
+ padding: 5px;
+ border-style: solid;
+ border-width: 1px;
+ border-color: #CCCCCC;
+ background-color: #F4F4F4;
+}
+
+UL, OL, LI {
+ list-style: disc;
+}
+
+HR {
+ width: 100%;
+ height: 1px;
+ background-color: #CCCCCC;
+ border-width: 0px;
+ padding: 0px;
+ color: #CCCCCC;
+}
+
+.variablelist {
+ padding-top: 10;
+ padding-bottom:10;
+ margin:0;
+}
+
+.itemizedlist, UL {
+ padding-top: 0;
+ padding-bottom:0;
+ margin:0;
+}
+
+.term {
+ font-weight:bold;
+}
Copied: search/branches/Branch_3_1/src/test/java/org (from rev 16553, search/branches/Branch_3_1/src/test/org)
Modified: search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/analyzer/Article.java
===================================================================
--- search/branches/Branch_3_1/src/test/org/hibernate/search/test/analyzer/Article.java 2009-05-12 15:25:27 UTC (rev 16553)
+++ search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/analyzer/Article.java 2009-05-13 12:38:19 UTC (rev 16554)
@@ -1,4 +1,4 @@
-// $Id:$
+// $Id$
package org.hibernate.search.test.analyzer;
import java.util.Set;
Modified: search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/analyzer/BlogEntry.java
===================================================================
--- search/branches/Branch_3_1/src/test/org/hibernate/search/test/analyzer/BlogEntry.java 2009-05-12 15:25:27 UTC (rev 16553)
+++ search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/analyzer/BlogEntry.java 2009-05-13 12:38:19 UTC (rev 16554)
@@ -1,4 +1,4 @@
-// $Id:$
+// $Id$
package org.hibernate.search.test.analyzer;
import java.util.Set;
Modified: search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/analyzer/LanguageDiscriminator.java
===================================================================
--- search/branches/Branch_3_1/src/test/org/hibernate/search/test/analyzer/LanguageDiscriminator.java 2009-05-12 15:25:27 UTC (rev 16553)
+++ search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/analyzer/LanguageDiscriminator.java 2009-05-13 12:38:19 UTC (rev 16554)
@@ -1,4 +1,4 @@
-// $Id:$
+// $Id$
package org.hibernate.search.test.analyzer;
import org.hibernate.search.analyzer.Discriminator;
Modified: search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/analyzer/inheritance/BaseClass.java
===================================================================
--- search/branches/Branch_3_1/src/test/org/hibernate/search/test/analyzer/inheritance/BaseClass.java 2009-05-12 15:25:27 UTC (rev 16553)
+++ search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/analyzer/inheritance/BaseClass.java 2009-05-13 12:38:19 UTC (rev 16554)
@@ -1,4 +1,4 @@
-// $Id:$
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
Modified: search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/analyzer/inheritance/ISOLatin1Analyzer.java
===================================================================
--- search/branches/Branch_3_1/src/test/org/hibernate/search/test/analyzer/inheritance/ISOLatin1Analyzer.java 2009-05-12 15:25:27 UTC (rev 16553)
+++ search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/analyzer/inheritance/ISOLatin1Analyzer.java 2009-05-13 12:38:19 UTC (rev 16554)
@@ -1,4 +1,4 @@
-// $Id:$
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
Modified: search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/analyzer/inheritance/SubClass.java
===================================================================
--- search/branches/Branch_3_1/src/test/org/hibernate/search/test/analyzer/inheritance/SubClass.java 2009-05-12 15:25:27 UTC (rev 16553)
+++ search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/analyzer/inheritance/SubClass.java 2009-05-13 12:38:19 UTC (rev 16554)
@@ -1,4 +1,4 @@
-// $Id:$
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
Modified: search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/embedded/Country.java
===================================================================
--- search/branches/Branch_3_1/src/test/org/hibernate/search/test/embedded/Country.java 2009-05-12 15:25:27 UTC (rev 16553)
+++ search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/embedded/Country.java 2009-05-13 12:38:19 UTC (rev 16554)
@@ -1,4 +1,4 @@
-// $Id:$
+// $Id$
package org.hibernate.search.test.embedded;
import java.util.ArrayList;
Modified: search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/embedded/Person.java
===================================================================
--- search/branches/Branch_3_1/src/test/org/hibernate/search/test/embedded/Person.java 2009-05-12 15:25:27 UTC (rev 16553)
+++ search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/embedded/Person.java 2009-05-13 12:38:19 UTC (rev 16554)
@@ -1,4 +1,4 @@
-// $Id:$
+// $Id$
package org.hibernate.search.test.embedded;
/**
Modified: search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/jms/master/JMSMasterTest.java
===================================================================
--- search/branches/Branch_3_1/src/test/org/hibernate/search/test/jms/master/JMSMasterTest.java 2009-05-12 15:25:27 UTC (rev 16553)
+++ search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/jms/master/JMSMasterTest.java 2009-05-13 12:38:19 UTC (rev 16554)
@@ -2,92 +2,73 @@
package org.hibernate.search.test.jms.master;
import java.io.Serializable;
+import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
+import javax.jms.MessageConsumer;
import javax.jms.ObjectMessage;
import javax.jms.Queue;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
import javax.jms.QueueSender;
import javax.jms.QueueSession;
-import javax.naming.InitialContext;
+import javax.naming.Context;
+import org.apache.activemq.broker.BrokerService;
import org.apache.lucene.analysis.StopAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.queryParser.QueryParser;
import org.apache.lucene.search.Query;
+
import org.hibernate.Session;
import org.hibernate.cfg.Configuration;
import org.hibernate.search.Environment;
import org.hibernate.search.FullTextSession;
import org.hibernate.search.Search;
-import org.hibernate.search.engine.DocumentBuilder;
import org.hibernate.search.backend.AddLuceneWork;
import org.hibernate.search.backend.LuceneWork;
-import org.hibernate.search.backend.impl.jms.JMSBackendQueueProcessorFactory;
+import org.hibernate.search.engine.DocumentBuilder;
import org.hibernate.search.test.SearchTestCase;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.embedded.Bootstrap;
/**
+ * Tests that the Master node in a JMS cluster can propertly process messages placed onto the queue.
+ *
* @author Emmanuel Bernard
+ * @author Hardy Ferentschik
*/
public class JMSMasterTest extends SearchTestCase {
- private Bootstrap bootstrap;
+ /**
+ * Name of the test queue as found in JNDI (see jndi.properties).
+ */
+ private static final String QUEUE_NAME = "queue/searchtest";
- public void testMessageSending() throws Exception {
- MyHibernateUtil.sessionFactory = getSessions();
+ /**
+ * Name of the connection factort as found in JNDI (see jndi.properties).
+ */
+ private static final String CONNECTION_FACTORY_NAME = "java:/ConnectionFactory";
- //create an object wo trigggering indexing
- Session s = openSession( );
- s.getTransaction().begin();
- Statement statement = s.connection().createStatement();
- statement.executeUpdate(
- "insert into TShirt_Master(id, logo, size) values( '1', 'JBoss balls', 'large')"
- );
- statement.close();
- TShirt ts = (TShirt) s.get(TShirt.class, 1);
- s.getTransaction().commit();
- s.close();
- //create the work queue to send
- Document doc = new Document();
- Field field = new Field( DocumentBuilder.CLASS_FIELDNAME, ts.getClass().getName(), Field.Store.YES, Field.Index.NOT_ANALYZED );
- doc.add( field );
- field = new Field("id", "1", Field.Store.YES, Field.Index.NOT_ANALYZED );
- doc.add( field );
- field = new Field("logo", ts.getLogo(), Field.Store.NO, Field.Index.ANALYZED );
- doc.add( field );
- LuceneWork luceneWork = new AddLuceneWork(ts.getId(), String.valueOf( ts.getId() ), ts.getClass(), doc );
- List<LuceneWork> queue = new ArrayList<LuceneWork>();
- queue.add( luceneWork );
+ /**
+ * ActiveMQ message broker.
+ */
+ private BrokerService brokerService;
- //send the queue
- InitialContext context = new InitialContext();
- QueueConnectionFactory factory = (QueueConnectionFactory) context.lookup( "java:/ConnectionFactory" );
- Queue jmsQueue = (Queue) context.lookup( "queue/searchtest" );
- QueueConnection cnn;
- QueueSender sender;
- QueueSession session;
- cnn = factory.createQueueConnection();
- //TODO make transacted parameterized
- session = cnn.createQueueSession( false, QueueSession.AUTO_ACKNOWLEDGE );
+ private QueueSession queueSession;
- ObjectMessage message = session.createObjectMessage();
- message.setObject( (Serializable) queue );
+ public void testMessageSending() throws Exception {
- sender = session.createSender( jmsQueue );
- sender.send( message );
+ TShirt shirt = createObjectWithSQL();
+ List<LuceneWork> queue = createDocumentAndWorkQueue( shirt );
- session.close();
- cnn.close();
+ registerMessageListener();
+ sendMessage( queue );
- //wait for the message to be processed
+ // need to sleep to give JMS processing and indexing time
Thread.sleep( 1000 );
- FullTextSession ftSess = Search.getFullTextSession( openSession( ) );
+ FullTextSession ftSess = Search.getFullTextSession( openSession() );
ftSess.getTransaction().begin();
QueryParser parser = new QueryParser( "id", new StopAnalyzer() );
Query luceneQuery = parser.parse( "logo:jboss" );
@@ -99,52 +80,101 @@
ftSess.close();
}
- protected void setUp() throws Exception {
- bootstrap = startupEmbeddedJBoss();
- try {
- super.setUp();
- }
- catch( RuntimeException e ) {
- try {
- shutdownEmbeddedJBoss(bootstrap);
- }
- catch( Exception ee ) {
- //swallow
- }
- throw e;
- }
+ private void registerMessageListener() throws Exception {
+ MessageConsumer consumer = getQueueSession().createConsumer( getMessageQueue() );
+ consumer.setMessageListener( new MDBSearchController( getSessions() ) );
}
- protected void tearDown() throws Exception {
- super.tearDown();
- shutdownEmbeddedJBoss(bootstrap);
+ private void sendMessage(List<LuceneWork> queue) throws Exception {
+ ObjectMessage message = getQueueSession().createObjectMessage();
+ message.setObject( ( Serializable ) queue );
+ QueueSender sender = getQueueSession().createSender( getMessageQueue() );
+ sender.send( message );
}
- public static Bootstrap startupEmbeddedJBoss() {
- try {
- long start = System.currentTimeMillis();
- Bootstrap bootstrap = new Bootstrap();
- bootstrap.bootstrap();
- bootstrap.deployResource( "jars/jms-master.jar" );
- System.out.println("JBoss Embedded boot time: " + (System.currentTimeMillis() - start) + " ms");
- return bootstrap;
+ private Queue getMessageQueue() throws Exception {
+ Context ctx = new javax.naming.InitialContext();
+ return ( Queue ) ctx.lookup( QUEUE_NAME );
+ }
+
+ private QueueSession getQueueSession() throws Exception {
+ if ( queueSession == null ) {
+ Context ctx = new javax.naming.InitialContext();
+ QueueConnectionFactory factory = ( QueueConnectionFactory ) ctx.lookup( CONNECTION_FACTORY_NAME );
+ QueueConnection conn = factory.createQueueConnection();
+ conn.start();
+ queueSession = conn.createQueueSession( false, QueueSession.AUTO_ACKNOWLEDGE );
+
}
- catch (DeploymentException e) {
- throw new RuntimeException( "Failed to bootstrap", e );
- }
+ return queueSession;
}
- public static void shutdownEmbeddedJBoss(Bootstrap bootstrap) {
- bootstrap.shutdown();
+ /**
+ * Manually create the work queue. This lists gets send by the Slaves to the Master for indexing.
+ *
+ * @param shirt The shirt to index
+ *
+ * @return A manually create <code>LuceneWork</code> list.
+ */
+ private List<LuceneWork> createDocumentAndWorkQueue(TShirt shirt) {
+ Document doc = new Document();
+ Field field = new Field(
+ DocumentBuilder.CLASS_FIELDNAME, shirt.getClass().getName(), Field.Store.YES, Field.Index.NOT_ANALYZED
+ );
+ doc.add( field );
+ field = new Field( "id", "1", Field.Store.YES, Field.Index.NOT_ANALYZED );
+ doc.add( field );
+ field = new Field( "logo", shirt.getLogo(), Field.Store.NO, Field.Index.ANALYZED );
+ doc.add( field );
+ LuceneWork luceneWork = new AddLuceneWork(
+ shirt.getId(), String.valueOf( shirt.getId() ), shirt.getClass(), doc
+ );
+ List<LuceneWork> queue = new ArrayList<LuceneWork>();
+ queue.add( luceneWork );
+ return queue;
}
+ /**
+ * Create a test object without trigggering indexing. Use SQL directly.
+ *
+ * @return a <code>TShirt</code> test object.
+ *
+ * @throws SQLException in case the inset fails.
+ */
+ private TShirt createObjectWithSQL() throws SQLException {
+ Session s = openSession();
+ s.getTransaction().begin();
+ Statement statement = s.connection().createStatement();
+ statement.executeUpdate(
+ "insert into TShirt_Master(id, logo, size) values( '1', 'JBoss balls', 'large')"
+ );
+ statement.close();
+ TShirt ts = ( TShirt ) s.get( TShirt.class, 1 );
+ s.getTransaction().commit();
+ s.close();
+ return ts;
+ }
+ protected void setUp() throws Exception {
+ // create and start the brokerService
+ brokerService = new BrokerService();
+ brokerService.setPersistent( false );
+ brokerService.start();
+
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ if ( brokerService != null ) {
+ brokerService.stop();
+ }
+ }
+
protected void configure(Configuration cfg) {
super.configure( cfg );
+ // explcitily set the backend even though lucene is default.
cfg.setProperty( Environment.WORKER_BACKEND, "lucene" );
- cfg.setProperty( JMSBackendQueueProcessorFactory.JMS_CONNECTION_FACTORY, "java:/ConnectionFactory" );
- cfg.setProperty( JMSBackendQueueProcessorFactory.JMS_QUEUE, "queue/searchtest" );
-
}
protected Class[] getMappings() {
Modified: search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/jms/master/MDBSearchController.java
===================================================================
--- search/branches/Branch_3_1/src/test/org/hibernate/search/test/jms/master/MDBSearchController.java 2009-05-12 15:25:27 UTC (rev 16553)
+++ search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/jms/master/MDBSearchController.java 2009-05-13 12:38:19 UTC (rev 16554)
@@ -1,24 +1,25 @@
//$Id$
package org.hibernate.search.test.jms.master;
-import javax.ejb.MessageDriven;
-import javax.ejb.ActivationConfigProperty;
import javax.jms.MessageListener;
import org.hibernate.search.backend.impl.jms.AbstractJMSHibernateSearchController;
import org.hibernate.Session;
+import org.hibernate.SessionFactory;
/**
* @author Emmanuel Bernard
*/
-@MessageDriven(activationConfig = {
- @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
- @ActivationConfigProperty(propertyName="destination", propertyValue="queue/searchtest"),
- @ActivationConfigProperty(propertyName="DLQMaxResent", propertyValue="1")
- } )
-public class MDBSearchController extends AbstractJMSHibernateSearchController implements MessageListener {
+public class MDBSearchController extends AbstractJMSHibernateSearchController {
+
+ SessionFactory sessionFactory;
+
+ MDBSearchController( SessionFactory sessionFactory ) {
+ this.sessionFactory = sessionFactory;
+ }
+
protected Session getSession() {
- return MyHibernateUtil.sessionFactory.openSession( );
+ return sessionFactory.openSession( );
}
protected void cleanSessionIfNeeded(Session session) {
Modified: search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/jms/slave/JMSSlaveTest.java
===================================================================
--- search/branches/Branch_3_1/src/test/org/hibernate/search/test/jms/slave/JMSSlaveTest.java 2009-05-12 15:25:27 UTC (rev 16553)
+++ search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/jms/slave/JMSSlaveTest.java 2009-05-13 12:38:19 UTC (rev 16554)
@@ -1,46 +1,51 @@
//$Id$
package org.hibernate.search.test.jms.slave;
-import org.jboss.embedded.Bootstrap;
-import org.jboss.deployers.spi.DeploymentException;
-import org.hibernate.search.test.SearchTestCase;
+import javax.jms.MessageConsumer;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueSession;
+import javax.naming.Context;
+
+import org.apache.activemq.broker.BrokerService;
+
+import org.hibernate.cfg.Configuration;
import org.hibernate.search.Environment;
import org.hibernate.search.backend.impl.jms.JMSBackendQueueProcessorFactory;
+import org.hibernate.search.test.SearchTestCase;
import org.hibernate.Session;
import org.hibernate.Transaction;
-import org.hibernate.cfg.Configuration;
/**
+ * Checks that the Slave in a JMS configuration proplerly places index jobs onto the queue.
+ *
* @author Emmanuel Bernard
+ * @author Hardy Ferentschik
*/
public class JMSSlaveTest extends SearchTestCase {
- private Bootstrap bootstrap;
+ /**
+ * Name of the test queue as found in JNDI (see jndi.properties).
+ */
+ private static final String QUEUE_NAME = "queue/searchtest";
+ /**
+ * Name of the connection factort as found in JNDI (see jndi.properties).
+ */
+ private static final String CONNECTION_FACTORY_NAME = "java:/ConnectionFactory";
- protected void setUp() throws Exception {
- bootstrap = startupEmbeddedJBoss();
- try {
- super.setUp();
- }
- catch( RuntimeException e ) {
- try {
- shutdownEmbeddedJBoss(bootstrap);
- }
- catch( Exception ee ) {
- //swallow
- }
- throw e;
- }
- }
+ /**
+ * ActiveMQ message broker.
+ */
+ private BrokerService brokerService;
- protected void tearDown() throws Exception {
- super.tearDown();
- shutdownEmbeddedJBoss(bootstrap);
- }
+ private QueueSession queueSession;
public void testMessageSend() throws Exception {
+ registerMessageListener();
SearchQueueChecker.reset();
+
Session s = openSession();
Transaction tx = s.beginTransaction();
TShirt ts = new TShirt();
@@ -52,8 +57,10 @@
s.persist( ts );
s.persist( ts2 );
tx.commit();
+
//need to sleep for the message consumption
Thread.sleep(500);
+
assertEquals( 1, SearchQueueChecker.queues );
assertEquals( 2, SearchQueueChecker.works );
@@ -63,8 +70,10 @@
ts = (TShirt) s.get( TShirt.class, ts.getId() );
ts.setLogo( "Peter pan" );
tx.commit();
+
//need to sleep for the message consumption
Thread.sleep(500);
+
assertEquals( 1, SearchQueueChecker.queues );
assertEquals( 2, SearchQueueChecker.works ); //one update = 2 works
@@ -74,42 +83,62 @@
s.delete( s.get( TShirt.class, ts.getId() ) );
s.delete( s.get( TShirt.class, ts2.getId() ) );
tx.commit();
+
//Need to sleep for the message consumption
Thread.sleep(500);
+
assertEquals( 1, SearchQueueChecker.queues );
assertEquals( 2, SearchQueueChecker.works );
s.close();
}
- public static Bootstrap startupEmbeddedJBoss() {
- try {
- long start = System.currentTimeMillis();
- Bootstrap bootstrap = new Bootstrap();
- bootstrap.bootstrap();
- bootstrap.deployResource( "jars/jms-slave.jar" );
- System.out.println("JBoss Embedded boot time: " + (System.currentTimeMillis() - start) + " ms");
- return bootstrap;
+ protected void setUp() throws Exception {
+ // create and start the brokerService
+ brokerService = new BrokerService();
+ brokerService.setPersistent( false );
+ brokerService.start();
+
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ if ( brokerService != null ) {
+ brokerService.stop();
}
- catch (DeploymentException e) {
- throw new RuntimeException( "Failed to bootstrap", e );
- }
}
- public static void shutdownEmbeddedJBoss(Bootstrap bootstrap) {
- bootstrap.shutdown();
+ private void registerMessageListener() throws Exception {
+ MessageConsumer consumer = getQueueSession().createConsumer( getMessageQueue() );
+ consumer.setMessageListener( new SearchQueueChecker() );
}
+ private Queue getMessageQueue() throws Exception {
+ Context ctx = new javax.naming.InitialContext();
+ return ( Queue ) ctx.lookup( QUEUE_NAME );
+ }
+ private QueueSession getQueueSession() throws Exception {
+ if ( queueSession == null ) {
+ Context ctx = new javax.naming.InitialContext();
+ QueueConnectionFactory factory = ( QueueConnectionFactory ) ctx.lookup( CONNECTION_FACTORY_NAME );
+ QueueConnection conn = factory.createQueueConnection();
+ conn.start();
+ queueSession = conn.createQueueSession( false, QueueSession.AUTO_ACKNOWLEDGE );
+
+ }
+ return queueSession;
+ }
+
protected void configure(Configuration cfg) {
super.configure( cfg );
cfg.setProperty( Environment.WORKER_BACKEND, "jms" );
- cfg.setProperty( JMSBackendQueueProcessorFactory.JMS_CONNECTION_FACTORY, "java:/ConnectionFactory" );
- cfg.setProperty( JMSBackendQueueProcessorFactory.JMS_QUEUE, "queue/searchtest" );
-
+ cfg.setProperty( JMSBackendQueueProcessorFactory.JMS_CONNECTION_FACTORY, CONNECTION_FACTORY_NAME );
+ cfg.setProperty( JMSBackendQueueProcessorFactory.JMS_QUEUE, QUEUE_NAME );
}
protected Class[] getMappings() {
- return new Class[]{
+ return new Class[] {
TShirt.class
};
}
Modified: search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/jms/slave/SearchQueueChecker.java
===================================================================
--- search/branches/Branch_3_1/src/test/org/hibernate/search/test/jms/slave/SearchQueueChecker.java 2009-05-12 15:25:27 UTC (rev 16553)
+++ search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/jms/slave/SearchQueueChecker.java 2009-05-13 12:38:19 UTC (rev 16554)
@@ -6,19 +6,16 @@
import javax.jms.Message;
import javax.jms.ObjectMessage;
import javax.jms.JMSException;
-import javax.ejb.MessageDriven;
-import javax.ejb.ActivationConfigProperty;
+
import org.hibernate.search.backend.LuceneWork;
/**
+ * Helper class to verify that the Slave places messages onto the queue.
+ *
* @author Emmanuel Bernard
+ * @author Hardy Ferentschik
*/
-@MessageDriven(activationConfig = {
- @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
- @ActivationConfigProperty(propertyName="destination", propertyValue="queue/searchtest"),
- @ActivationConfigProperty(propertyName="DLQMaxResent", propertyValue="1")
- } )
public class SearchQueueChecker implements MessageListener {
public static int queues;
public static int works;
@@ -28,22 +25,24 @@
works = 0;
}
+ @SuppressWarnings("unchecked")
public void onMessage(Message message) {
- if (! (message instanceof ObjectMessage ) ) {
+ if ( !( message instanceof ObjectMessage ) ) {
return;
}
- ObjectMessage objectMessage = (ObjectMessage) message;
+ ObjectMessage objectMessage = ( ObjectMessage ) message;
+
List<LuceneWork> queue;
try {
- queue = (List<LuceneWork>) objectMessage.getObject();
+ queue = ( List<LuceneWork> ) objectMessage.getObject();
}
- catch (JMSException e) {
+ catch ( JMSException e ) {
return;
}
- catch( ClassCastException e ) {
+ catch ( ClassCastException e ) {
return;
}
queues++;
- works+=queue.size();
+ works += queue.size();
}
}
Modified: search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/optimizer/OptimizerTestCase.java
===================================================================
--- search/branches/Branch_3_1/src/test/org/hibernate/search/test/optimizer/OptimizerTestCase.java 2009-05-12 15:25:27 UTC (rev 16553)
+++ search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/optimizer/OptimizerTestCase.java 2009-05-13 12:38:19 UTC (rev 16554)
@@ -1,4 +1,4 @@
-// $Id:$
+// $Id$
package org.hibernate.search.test.optimizer;
import java.io.File;
Modified: search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/session/OptimizeTest.java
===================================================================
--- search/branches/Branch_3_1/src/test/org/hibernate/search/test/session/OptimizeTest.java 2009-05-12 15:25:27 UTC (rev 16553)
+++ search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/session/OptimizeTest.java 2009-05-13 12:38:19 UTC (rev 16554)
@@ -1,4 +1,4 @@
-// $Id:$
+// $Id$
package org.hibernate.search.test.session;
import java.io.File;
Modified: search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/shards/ShardsTest.java
===================================================================
--- search/branches/Branch_3_1/src/test/org/hibernate/search/test/shards/ShardsTest.java 2009-05-12 15:25:27 UTC (rev 16553)
+++ search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/shards/ShardsTest.java 2009-05-13 12:38:19 UTC (rev 16554)
@@ -1,4 +1,4 @@
-// $Id:$
+// $Id$
package org.hibernate.search.test.shards;
import java.io.File;
Modified: search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/similarity/DummySimilarity.java
===================================================================
--- search/branches/Branch_3_1/src/test/org/hibernate/search/test/similarity/DummySimilarity.java 2009-05-12 15:25:27 UTC (rev 16553)
+++ search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/similarity/DummySimilarity.java 2009-05-13 12:38:19 UTC (rev 16554)
@@ -1,4 +1,4 @@
-// $Id:$
+// $Id$
package org.hibernate.search.test.similarity;
import org.apache.lucene.search.DefaultSimilarity;
Modified: search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/similarity/SimilarityTest.java
===================================================================
--- search/branches/Branch_3_1/src/test/org/hibernate/search/test/similarity/SimilarityTest.java 2009-05-12 15:25:27 UTC (rev 16553)
+++ search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/similarity/SimilarityTest.java 2009-05-13 12:38:19 UTC (rev 16554)
@@ -1,4 +1,4 @@
-// $Id:$
+// $Id$
package org.hibernate.search.test.similarity;
import java.util.List;
Modified: search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/similarity/Trash.java
===================================================================
--- search/branches/Branch_3_1/src/test/org/hibernate/search/test/similarity/Trash.java 2009-05-12 15:25:27 UTC (rev 16553)
+++ search/branches/Branch_3_1/src/test/java/org/hibernate/search/test/similarity/Trash.java 2009-05-13 12:38:19 UTC (rev 16554)
@@ -1,4 +1,4 @@
-// $Id:$
+// $Id$
package org.hibernate.search.test.similarity;
import javax.persistence.Id;
Copied: search/branches/Branch_3_1/src/test/resources (from rev 16466, search/branches/Branch_3_1/src/test-resources)
Modified: search/branches/Branch_3_1/src/test/resources/hibernate.properties
===================================================================
--- search/branches/Branch_3_1/src/test-resources/hibernate.properties 2009-04-27 15:26:25 UTC (rev 16466)
+++ search/branches/Branch_3_1/src/test/resources/hibernate.properties 2009-05-13 12:38:19 UTC (rev 16554)
@@ -1,313 +1,31 @@
-######################
-### Query Language ###
-######################
+################################################################################
+# Copyright (c) 2007, Red Hat Middleware, LLC. All rights reserved. #
+# #
+# This copyrighted material is made available to anyone wishing to use, modify,#
+# copy, or redistribute it subject to the terms and conditions of the GNU #
+# Lesser General Public License, v. 2.1. This program is distributed in the #
+# hope that it will be useful, but WITHOUT A WARRANTY; without even the implied#
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU #
+# Lesser General Public License for more details. You should have received a #
+# copy of the GNU Lesser General Public License, v.2.1 along with this #
+# distribution; if not, write to the Free Software Foundation, Inc., #
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #
+# #
+# Red Hat Author(s): Steve Ebersole #
+################################################################################
+hibernate.dialect ${db.dialect}
+hibernate.connection.driver_class ${jdbc.driver}
+hibernate.connection.url ${jdbc.url}
+hibernate.connection.username ${jdbc.user}
+hibernate.connection.password ${jdbc.pass}
+hibernate.connection.isolation ${jdbc.isolation}
-## define query language constants / function names
+hibernate.connection.pool_size 5
-hibernate.query.substitutions true 1, false 0, yes 'Y', no 'N'
-
-
-## select the classic query parser
-
-#hibernate.query.factory_class org.hibernate.hql.classic.ClassicQueryTranslatorFactory
-
+hibernate.show_sql true
hibernate.format_sql true
+hibernate.max_fetch_depth 5
-
-#################
-### Platforms ###
-#################
-
-## JNDI Datasource
-
-#hibernate.connection.datasource jdbc/test
-#hibernate.connection.username db2
-#hibernate.connection.password db2
-
-
-hibernate.dialect @hibernate.dialect@
-hibernate.connection.driver_class @hibernate.connection.driver_class@
-hibernate.connection.username @hibernate.connection.username@
-hibernate.connection.password @hibernate.connection.password@
-hibernate.connection.url @hibernate.connection.url@
-
-
-#################################
-### Hibernate Connection Pool ###
-#################################
-
-hibernate.connection.pool_size 1
-
-
-
-###########################
-### C3P0 Connection Pool###
-###########################
-
-#hibernate.c3p0.max_size 2
-#hibernate.c3p0.min_size 2
-#hibernate.c3p0.timeout 5000
-#hibernate.c3p0.max_statements 100
-#hibernate.c3p0.idle_test_period 3000
-#hibernate.c3p0.acquire_increment 2
-#hibernate.c3p0.validate false
-
-
-
-##############################
-### Proxool Connection Pool###
-##############################
-
-## Properties for external configuration of Proxool
-
-hibernate.proxool.pool_alias pool1
-
-## Only need one of the following
-
-#hibernate.proxool.existing_pool true
-#hibernate.proxool.xml proxool.xml
-#hibernate.proxool.properties proxool.properties
-
-
-
-#################################
-### Plugin ConnectionProvider ###
-#################################
-
-## use a custom ConnectionProvider (if not set, Hibernate will choose a built-in ConnectionProvider using hueristics)
-
-#hibernate.connection.provider_class org.hibernate.connection.DriverManagerConnectionProvider
-#hibernate.connection.provider_class org.hibernate.connection.DatasourceConnectionProvider
-#hibernate.connection.provider_class org.hibernate.connection.C3P0ConnectionProvider
-#hibernate.connection.provider_class org.hibernate.connection.DBCPConnectionProvider
-#hibernate.connection.provider_class org.hibernate.connection.ProxoolConnectionProvider
-
-
-
-#######################
-### Transaction API ###
-#######################
-
-## Enable automatic flush during the JTA beforeCompletion() callback
-## (This setting is relevant with or without the Transaction API)
-
-#hibernate.transaction.flush_before_completion
-
-
-## Enable automatic session close at the end of transaction
-## (This setting is relevant with or without the Transaction API)
-
-#hibernate.transaction.auto_close_session
-
-
-## the Transaction API abstracts application code from the underlying JTA or JDBC transactions
-
-#hibernate.transaction.factory_class org.hibernate.transaction.JTATransactionFactory
-#hibernate.transaction.factory_class org.hibernate.transaction.JDBCTransactionFactory
-
-
-## to use JTATransactionFactory, Hibernate must be able to locate the UserTransaction in JNDI
-## default is java:comp/UserTransaction
-## you do NOT need this setting if you specify hibernate.transaction.manager_lookup_class
-
-#jta.UserTransaction jta/usertransaction
-#jta.UserTransaction javax.transaction.UserTransaction
-#jta.UserTransaction UserTransaction
-
-
-## to use the second-level cache with JTA, Hibernate must be able to obtain the JTA TransactionManager
-
-#hibernate.transaction.manager_lookup_class org.hibernate.transaction.JBossTransactionManagerLookup
-#hibernate.transaction.manager_lookup_class org.hibernate.transaction.WeblogicTransactionManagerLookup
-#hibernate.transaction.manager_lookup_class org.hibernate.transaction.WebSphereTransactionManagerLookup
-#hibernate.transaction.manager_lookup_class org.hibernate.transaction.OrionTransactionManagerLookup
-#hibernate.transaction.manager_lookup_class org.hibernate.transaction.ResinTransactionManagerLookup
-
-
-
-##############################
-### Miscellaneous Settings ###
-##############################
-
-## print all generated SQL to the console
-
-#hibernate.show_sql true
-
-
-## add comments to the generated SQL
-
-#hibernate.use_sql_comments true
-
-
-## generate statistics
-
-#hibernate.generate_statistics true
-
-
-## auto schema export
-
-#hibernate.hbm2ddl.auto create-drop
-#hibernate.hbm2ddl.auto create
-#hibernate.hbm2ddl.auto update
-
-
-## specify a default schema and catalog for unqualified tablenames
-
-#hibernate.default_schema test
-#hibernate.default_catalog test
-
-
-## enable ordering of SQL UPDATEs by primary key
-
-hibernate.order_updates true
-
-
-## set the maximum depth of the outer join fetch tree
-
-hibernate.max_fetch_depth 1
-
-
-## set the default batch size for batch fetching
-
-hibernate.default_batch_fetch_size 100
-
-
-## rollback generated identifier values of deleted entities to default values
-
-#hibernate.use_identifer_rollback true
-
-
-## enable CGLIB reflection optimizer (enabled by default)
-
-#hibernate.cglib.use_reflection_optimizer false
-
-
-
-#####################
-### JDBC Settings ###
-#####################
-
-## specify a JDBC isolation level
-
-#hibernate.connection.isolation 4
-
-
-## enable JDBC autocommit (not recommended!)
-
-#hibernate.connection.autocommit true
-
-
-## set the JDBC fetch size
-
-#hibernate.jdbc.fetch_size 25
-
-
-## set the maximum JDBC 2 batch size (a nonzero value enables batching)
-
-#hibernate.jdbc.batch_size 0
-
-
-## enable batch updates even for versioned data
-
-hibernate.jdbc.batch_versioned_data true
-
-
-## enable use of JDBC 2 scrollable ResultSets (specifying a Dialect will cause Hibernate to use a sensible default)
-
-#hibernate.jdbc.use_scrollable_resultset true
-
-
-## use streams when writing binary types to / from JDBC
-
-hibernate.jdbc.use_streams_for_binary true
-
-
-## use JDBC 3 PreparedStatement.getGeneratedKeys() to get the identifier of an inserted row
-
-#hibernate.jdbc.use_get_generated_keys false
-
-
-## choose a custom JDBC batcher
-
-# hibernate.jdbc.factory_class
-
-
-## enable JDBC result set column alias caching
-## (minor performance enhancement for broken JDBC drivers)
-
-# hibernate.jdbc.wrap_result_sets
-
-
-## choose a custom SQL exception converter
-
-#hibernate.jdbc.sql_exception_converter
-
-
-
-##########################
-### Second-level Cache ###
-##########################
-
-## optimize chache for minimal "puts" instead of minimal "gets" (good for clustered cache)
-
-#hibernate.cache.use_minimal_puts true
-
-
-## set a prefix for cache region names
-
hibernate.cache.region_prefix hibernate.test
-
-
-## disable the second-level cache
-
-#hibernate.cache.use_second_level_cache false
-
-
-## enable the query cache
-
-hibernate.cache.use_query_cache true
-
-
-## store the second-level cache entries in a more human-friendly format
-
-#hibernate.cache.use_structured_entries true
-
-
-## choose a cache implementation
-
-#hibernate.cache.provider_class org.hibernate.cache.EhCacheProvider
-#hibernate.cache.provider_class org.hibernate.cache.EmptyCacheProvider
hibernate.cache.provider_class org.hibernate.cache.HashtableCacheProvider
-#hibernate.cache.provider_class org.hibernate.cache.TreeCacheProvider
-#hibernate.cache.provider_class org.hibernate.cache.OSCacheProvider
-#hibernate.cache.provider_class org.hibernate.cache.SwarmCacheProvider
-
-
-## choose a custom query cache implementation
-
-#hibernate.cache.query_cache_factory
-
-
-
-############
-### JNDI ###
-############
-
-## specify a JNDI name for the SessionFactory
-
-#hibernate.session_factory_name hibernate/session_factory
-
-
-## Hibernate uses JNDI to bind a name to a SessionFactory and to look up the JTA UserTransaction;
-## if hibernate.jndi.* are not specified, Hibernate will use the default InitialContext() which
-## is the best approach in an application server
-
-#file system
-#hibernate.jndi.class com.sun.jndi.fscontext.RefFSContextFactory
-#hibernate.jndi.url file:/
-
-#WebSphere
-#hibernate.jndi.class com.ibm.websphere.naming.WsnInitialContextFactory
-#hibernate.jndi.url iiop://localhost:900/
-
Deleted: search/branches/Branch_3_1/src/test/resources/jndi.properties
===================================================================
--- search/branches/Branch_3_1/src/test-resources/jndi.properties 2009-04-27 15:26:25 UTC (rev 16466)
+++ search/branches/Branch_3_1/src/test/resources/jndi.properties 2009-05-13 12:38:19 UTC (rev 16554)
@@ -1,4 +0,0 @@
-# DO NOT EDIT THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING
-#
-java.naming.factory.initial=org.jboss.naming.JBossRemotingContextFactory
-java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
15 years, 6 months
Hibernate SVN: r16553 - search/branches/Branch_3_1/src/java/org/hibernate/search/query.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-05-12 11:25:27 -0400 (Tue, 12 May 2009)
New Revision: 16553
Modified:
search/branches/Branch_3_1/src/java/org/hibernate/search/query/FullTextQueryImpl.java
Log:
Backported HSEARCH-330
Modified: search/branches/Branch_3_1/src/java/org/hibernate/search/query/FullTextQueryImpl.java
===================================================================
--- search/branches/Branch_3_1/src/java/org/hibernate/search/query/FullTextQueryImpl.java 2009-05-12 15:21:13 UTC (rev 16552)
+++ search/branches/Branch_3_1/src/java/org/hibernate/search/query/FullTextQueryImpl.java 2009-05-12 15:25:27 UTC (rev 16553)
@@ -359,15 +359,22 @@
/**
* @return Calculates the number of <code>TopDocs</code> which should be retrieved as part of the query. If Hibernate's
- * pagination parameters are set returned value is <code>first + maxResults</code>. Otherwise <code>null</code> is
- * returned.
+ * pagination parameters are set returned value is <code>first + maxResults</code>. Otherwise <code>null</code> is
+ * returned.
*/
private Integer calculateTopDocsRetrievalSize() {
if ( maxResults == null ) {
return null;
}
else {
- return first() + maxResults;
+ long tmpMaxResult = (long) first() + maxResults;
+ if ( tmpMaxResult >= Integer.MAX_VALUE ) {
+ // don't return just Integer.MAX_VALUE due to a bug in Lucene - see HSEARCH-330
+ return Integer.MAX_VALUE - 1;
+ }
+ else {
+ return (int) tmpMaxResult;
+ }
}
}
15 years, 6 months
Hibernate SVN: r16552 - search/trunk/src/main/java/org/hibernate/search/query.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-05-12 11:21:13 -0400 (Tue, 12 May 2009)
New Revision: 16552
Modified:
search/trunk/src/main/java/org/hibernate/search/query/FullTextQueryImpl.java
Log:
HSEARCH-330 Made sure that calculateTopDocsRetrievalSize will not overrun and that at most Integer.MAX_VALUE-1 is returned. Using such a high value will, however, on many/most systems create OutOfMemoryExceptions since Lucene will instantiate an Object array with the specified size!
Modified: search/trunk/src/main/java/org/hibernate/search/query/FullTextQueryImpl.java
===================================================================
--- search/trunk/src/main/java/org/hibernate/search/query/FullTextQueryImpl.java 2009-05-12 13:09:57 UTC (rev 16551)
+++ search/trunk/src/main/java/org/hibernate/search/query/FullTextQueryImpl.java 2009-05-12 15:21:13 UTC (rev 16552)
@@ -33,7 +33,6 @@
import org.hibernate.ScrollMode;
import org.hibernate.ScrollableResults;
import org.hibernate.Session;
-import org.hibernate.util.ReflectHelper;
import org.hibernate.engine.SessionImplementor;
import org.hibernate.engine.query.ParameterMetadata;
import org.hibernate.impl.AbstractQueryImpl;
@@ -41,6 +40,7 @@
import org.hibernate.search.FullTextFilter;
import org.hibernate.search.FullTextQuery;
import org.hibernate.search.SearchException;
+import org.hibernate.search.engine.DocumentBuilder;
import org.hibernate.search.engine.DocumentBuilderIndexedEntity;
import org.hibernate.search.engine.DocumentExtractor;
import org.hibernate.search.engine.EntityInfo;
@@ -50,7 +50,6 @@
import org.hibernate.search.engine.ProjectionLoader;
import org.hibernate.search.engine.QueryLoader;
import org.hibernate.search.engine.SearchFactoryImplementor;
-import org.hibernate.search.engine.DocumentBuilder;
import org.hibernate.search.filter.ChainedFilter;
import org.hibernate.search.filter.FilterKey;
import org.hibernate.search.filter.StandardFilterKey;
@@ -62,6 +61,7 @@
import static org.hibernate.search.util.FilterCacheModeTypeHelper.cacheResults;
import org.hibernate.search.util.LoggerFactory;
import org.hibernate.transform.ResultTransformer;
+import org.hibernate.util.ReflectHelper;
/**
* Implementation of {@link org.hibernate.search.FullTextQuery}.
@@ -359,15 +359,22 @@
/**
* @return Calculates the number of <code>TopDocs</code> which should be retrieved as part of the query. If Hibernate's
- * pagination parameters are set returned value is <code>first + maxResults</code>. Otherwise <code>null</code> is
- * returned.
+ * pagination parameters are set returned value is <code>first + maxResults</code>. Otherwise <code>null</code> is
+ * returned.
*/
private Integer calculateTopDocsRetrievalSize() {
if ( maxResults == null ) {
return null;
}
else {
- return first() + maxResults;
+ long tmpMaxResult = (long) first() + maxResults;
+ if ( tmpMaxResult >= Integer.MAX_VALUE ) {
+ // don't return just Integer.MAX_VALUE due to a bug in Lucene - see HSEARCH-330
+ return Integer.MAX_VALUE - 1;
+ }
+ else {
+ return (int) tmpMaxResult;
+ }
}
}
@@ -738,7 +745,9 @@
else {
TopDocs hits;
try {
- hits = getQueryHits( searcher, 1 ).topDocs; // Lucene enforces that at least one top doc will be retrieved.
+ hits = getQueryHits(
+ searcher, 1
+ ).topDocs; // Lucene enforces that at least one top doc will be retrieved.
resultSize = hits.totalHits;
}
catch ( IOException e ) {
15 years, 6 months