Author: hardy.ferentschik
Date: 2010-09-22 09:28:23 -0400 (Wed, 22 Sep 2010)
New Revision: 20680
Added:
search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/id/Article.java
search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/id/DuplicateDocumentIdTest.java
search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/id/ExplicitIdTest.java
search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/id/Foo.java
Modified:
search/trunk/hibernate-search-solr-analyzers/pom.xml
search/trunk/hibernate-search/pom.xml
search/trunk/hibernate-search/src/main/java/org/hibernate/search/engine/AbstractLoader.java
search/trunk/hibernate-search/src/main/java/org/hibernate/search/engine/DocumentBuilderIndexedEntity.java
search/trunk/hibernate-search/src/main/java/org/hibernate/search/engine/DocumentExtractor.java
search/trunk/hibernate-search/src/main/java/org/hibernate/search/engine/EntityInfo.java
search/trunk/hibernate-search/src/main/java/org/hibernate/search/engine/LoaderHelper.java
search/trunk/hibernate-search/src/main/java/org/hibernate/search/engine/ObjectLoaderHelper.java
search/trunk/hibernate-search/src/main/java/org/hibernate/search/util/HibernateHelper.java
search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/id/ImplicitIdTest.java
Log:
HSEARCH-574
* Refactored ObjectLoaderHelper to verify wether the document id is also the entity id.
Depending on the outcome the entity is either loaded via session.load or via a Criteria
query
* Added a exception case for multiple @DocumentId annotation in the same entity
* Added tests for different document id scenarios
Modified: search/trunk/hibernate-search/pom.xml
===================================================================
--- search/trunk/hibernate-search/pom.xml 2010-09-22 13:27:42 UTC (rev 20679)
+++ search/trunk/hibernate-search/pom.xml 2010-09-22 13:28:23 UTC (rev 20680)
@@ -1,26 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2009, Red Hat, Inc. and/or its affiliates 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, Inc.
- *
- * 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
+ ~ Hibernate, Relational Persistence for Idiomatic Java
+ ~
+ ~ Copyright (c) 2010, Red Hat, Inc. and/or its affiliates 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, Inc.
+ ~
+ ~ 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
-->
<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">
<modelVersion>4.0.0</modelVersion>
Modified:
search/trunk/hibernate-search/src/main/java/org/hibernate/search/engine/AbstractLoader.java
===================================================================
---
search/trunk/hibernate-search/src/main/java/org/hibernate/search/engine/AbstractLoader.java 2010-09-22
13:27:42 UTC (rev 20679)
+++
search/trunk/hibernate-search/src/main/java/org/hibernate/search/engine/AbstractLoader.java 2010-09-22
13:28:23 UTC (rev 20680)
@@ -62,7 +62,9 @@
if ( takeTimings ) {
startTime = System.nanoTime();
}
+
List loadedObjects = executeLoad( entityInfos );
+
if ( takeTimings ) {
statisticsImplementor.objectLoadExecuted( loadedObjects.size(), System.nanoTime() -
startTime );
}
Modified:
search/trunk/hibernate-search/src/main/java/org/hibernate/search/engine/DocumentBuilderIndexedEntity.java
===================================================================
---
search/trunk/hibernate-search/src/main/java/org/hibernate/search/engine/DocumentBuilderIndexedEntity.java 2010-09-22
13:27:42 UTC (rev 20679)
+++
search/trunk/hibernate-search/src/main/java/org/hibernate/search/engine/DocumentBuilderIndexedEntity.java 2010-09-22
13:28:23 UTC (rev 20680)
@@ -42,11 +42,11 @@
import org.slf4j.Logger;
import org.hibernate.annotations.common.AssertionFailure;
-import org.hibernate.annotations.common.util.ReflectHelper;
import org.hibernate.annotations.common.reflection.ReflectionManager;
import org.hibernate.annotations.common.reflection.XClass;
import org.hibernate.annotations.common.reflection.XMember;
import org.hibernate.annotations.common.reflection.XProperty;
+import org.hibernate.annotations.common.util.ReflectHelper;
import org.hibernate.proxy.HibernateProxy;
import org.hibernate.search.SearchException;
import org.hibernate.search.analyzer.Discriminator;
@@ -182,13 +182,14 @@
if ( idAnnotation != null ) {
String attributeName = getIdAttributeName( member, idAnnotation );
if ( isRoot ) {
- if ( idKeywordName != null && explicitDocumentId ) {
- throw new AssertionFailure(
- "Two document id assigned: "
- + idKeywordName + " and " + attributeName
- );
+ if ( explicitDocumentId ) {
+ throw new SearchException( "More than one @DocumentId specified on entity
" + beanClass.getName() );
}
+ if ( idAnnotation instanceof DocumentId ) {
+ explicitDocumentId = true;
+ }
idKeywordName = prefix + attributeName;
+
FieldBridge fieldBridge = BridgeFactory.guessType( null, member, reflectionManager
);
if ( fieldBridge instanceof TwoWayFieldBridge ) {
idBridge = ( TwoWayFieldBridge ) fieldBridge;
@@ -244,17 +245,16 @@
// check for explicit DocumentId
DocumentId documentIdAnn = member.getAnnotation( DocumentId.class );
if ( documentIdAnn != null ) {
- explicitDocumentId = true;
idAnnotation = documentIdAnn;
}
// check for JPA @Id
- else if ( !explicitDocumentId && context.isJpaPresent() ) {
+ else if ( context.isJpaPresent() ) {
Annotation jpaId;
try {
@SuppressWarnings("unchecked")
Class<? extends Annotation> jpaIdClass =
org.hibernate.annotations.common.util.ReflectHelper
- .classForName( "javax.persistence.Id", ConfigContext.class );
+ .classForName( "javax.persistence.Id", ConfigContext.class );
jpaId = member.getAnnotation( jpaIdClass );
}
catch ( ClassNotFoundException e ) {
@@ -279,6 +279,7 @@
}
//TODO could we use T instead of EntityClass?
+
public void addWorkToQueue(Class<T> entityClass, T entity, Serializable id,
WorkType workType, List<LuceneWork> queue, SearchFactoryImplementor
searchFactoryImplementor) {
//TODO with the caller loop we are in a n^2: optimize it using a HashMap for work
recognition
@@ -407,7 +408,7 @@
LuceneOptions luceneOptions = new LuceneOptionsImpl(
Store.YES,
Field.Index.NOT_ANALYZED_NO_NORMS, Field.TermVector.NO, idBoost
- );
+ );
idBridge.set( idKeywordName, id, doc, luceneOptions );
// finally add all other document fields
@@ -590,13 +591,15 @@
/**
* Return the entity id if possible
* An IllegalStateException otherwise
- *
+ * <p/>
* If the id is provided, we can't extract it from the entity
*
* @return entity id
*/
public Serializable getId(Object entity) {
- if( entity == null || idGetter == null) throw new IllegalStateException( "Cannot
guess id form entity");
+ if ( entity == null || idGetter == null ) {
+ throw new IllegalStateException( "Cannot guess id form entity" );
+ }
return ( Serializable ) ReflectionHelper.getMemberValue( entity, idGetter );
}
@@ -611,6 +614,16 @@
.get( builderIndexedEntity.getIdKeywordName(), document );
}
+ public static String getDocumentIdName(SearchFactoryImplementor
searchFactoryImplementor, Class<?> clazz) {
+ DocumentBuilderIndexedEntity<?> builderIndexedEntity =
searchFactoryImplementor.getDocumentBuilderIndexedEntity(
+ clazz
+ );
+ if ( builderIndexedEntity == null ) {
+ throw new SearchException( "No Lucene configuration set up for: " +
clazz.getName() );
+ }
+ return builderIndexedEntity.getIdentifierName();
+ }
+
public static Object[] getDocumentFields(SearchFactoryImplementor
searchFactoryImplementor, Class<?> clazz, Document document, String[] fields) {
DocumentBuilderIndexedEntity<?> builderIndexedEntity =
searchFactoryImplementor.getDocumentBuilderIndexedEntity(
clazz
@@ -660,7 +673,7 @@
}
private static void processFieldsForProjection(PropertiesMetadata metadata, String[]
fields, Object[] result, Document document) {
- //process base fields
+ //process base fields
final int nbrFoEntityFields = metadata.fieldNames.size();
for ( int index = 0; index < nbrFoEntityFields; index++ ) {
populateResult(
@@ -673,7 +686,7 @@
);
}
- //process fields of embedded
+ //process fields of embedded
final int nbrOfEmbeddedObjects = metadata.embeddedPropertiesMetadata.size();
for ( int index = 0; index < nbrOfEmbeddedObjects; index++ ) {
//there is nothing we can do for collections
@@ -684,17 +697,17 @@
}
}
- //process class bridges
- final int nbrOfClassBridges = metadata.classBridges.size();
+ //process class bridges
+ final int nbrOfClassBridges = metadata.classBridges.size();
for ( int index = 0; index < nbrOfClassBridges; index++ ) {
populateResult(
- metadata.classNames.get(index),
- metadata.classBridges.get(index),
- metadata.classStores.get(index),
- fields,
- result,
- document
- );
+ metadata.classNames.get( index ),
+ metadata.classBridges.get( index ),
+ metadata.classStores.get( index ),
+ fields,
+ result,
+ document
+ );
}
}
@@ -710,23 +723,24 @@
public String objectToString(String fieldName, Object value) {
if ( fieldName == null ) {
- throw new AssertionFailure( "Field name should not be null");
+ throw new AssertionFailure( "Field name should not be null" );
}
if ( fieldName.equals( idKeywordName ) ) {
return idBridge.objectToString( value );
}
else {
FieldBridge bridge = getBridge( metadata, fieldName );
- if (bridge!=null) {
+ if ( bridge != null ) {
final Class<? extends FieldBridge> bridgeClass = bridge.getClass();
if ( TwoWayFieldBridge.class.isAssignableFrom( bridgeClass ) ) {
- return ( (TwoWayFieldBridge) bridge ).objectToString( value );
+ return ( ( TwoWayFieldBridge ) bridge ).objectToString( value );
}
else if ( StringBridge.class.isAssignableFrom( bridgeClass ) ) {
- return ( (StringBridge) bridge ).objectToString( value );
+ return ( ( StringBridge ) bridge ).objectToString( value );
}
- throw new SearchException( "FieldBridge " + bridgeClass + "does not
have a objectToString method: field "
- + fieldName + " in " + beanXClass
+ throw new SearchException(
+ "FieldBridge " + bridgeClass + "does not have a objectToString
method: field "
+ + fieldName + " in " + beanXClass
);
}
}
@@ -744,20 +758,26 @@
}
private FieldBridge getBridge(PropertiesMetadata metadata, String fieldName) {
- //process base fields
+ //process base fields
FieldBridge fieldBridge = getBridge( metadata.fieldNames, metadata.fieldBridges,
fieldName );
- if ( fieldBridge != null ) return fieldBridge;
+ if ( fieldBridge != null ) {
+ return fieldBridge;
+ }
//process fields of embedded
final int nbrOfEmbeddedObjects = metadata.embeddedPropertiesMetadata.size();
for ( int index = 0; index < nbrOfEmbeddedObjects; index++ ) {
fieldBridge = getBridge( metadata.embeddedPropertiesMetadata.get( index ), fieldName
);
- if ( fieldBridge != null ) return fieldBridge;
+ if ( fieldBridge != null ) {
+ return fieldBridge;
+ }
}
//process class bridges
fieldBridge = getBridge( metadata.classNames, metadata.classBridges, fieldName );
- if ( fieldBridge != null ) return fieldBridge;
+ if ( fieldBridge != null ) {
+ return fieldBridge;
+ }
return null;
}
@@ -777,11 +797,11 @@
return;
}
}
- for ( FieldBridge bridge : metadata.classBridges ) {
- if ( !( bridge instanceof TwoWayStringBridge || bridge instanceof
TwoWayString2FieldBridgeAdaptor ) ) {
- allowFieldSelectionInProjection = false;
- return;
- }
- }
+ for ( FieldBridge bridge : metadata.classBridges ) {
+ if ( !( bridge instanceof TwoWayStringBridge || bridge instanceof
TwoWayString2FieldBridgeAdaptor ) ) {
+ allowFieldSelectionInProjection = false;
+ return;
+ }
+ }
}
}
Modified:
search/trunk/hibernate-search/src/main/java/org/hibernate/search/engine/DocumentExtractor.java
===================================================================
---
search/trunk/hibernate-search/src/main/java/org/hibernate/search/engine/DocumentExtractor.java 2010-09-22
13:27:42 UTC (rev 20679)
+++
search/trunk/hibernate-search/src/main/java/org/hibernate/search/engine/DocumentExtractor.java 2010-09-22
13:28:23 UTC (rev 20680)
@@ -54,7 +54,12 @@
public DocumentExtractor(QueryHits queryHits, SearchFactoryImplementor
searchFactoryImplementor, String[] projection, Set<String> idFieldNames, boolean
allowFieldSelection) {
this.searchFactoryImplementor = searchFactoryImplementor;
- this.projection = projection;
+ if ( projection != null ) {
+ this.projection = projection.clone();
+ }
+ else {
+ this.projection = null;
+ }
this.queryHits = queryHits;
this.allowFieldSelection = allowFieldSelection;
initFieldSelection( projection, idFieldNames );
@@ -88,6 +93,7 @@
private EntityInfo extract(Document document) {
Class clazz = DocumentBuilderIndexedEntity.getDocumentClass( document );
+ String idName = DocumentBuilderIndexedEntity.getDocumentIdName(
searchFactoryImplementor, clazz );
Serializable id = DocumentBuilderIndexedEntity.getDocumentId( searchFactoryImplementor,
clazz, document );
Object[] projected = null;
if ( projection != null && projection.length > 0 ) {
@@ -95,7 +101,7 @@
searchFactoryImplementor, clazz, document, projection
);
}
- return new EntityInfo( clazz, id, projected );
+ return new EntityInfo( clazz, idName, id, projected );
}
public EntityInfo extract(int index) throws IOException {
Modified:
search/trunk/hibernate-search/src/main/java/org/hibernate/search/engine/EntityInfo.java
===================================================================
---
search/trunk/hibernate-search/src/main/java/org/hibernate/search/engine/EntityInfo.java 2010-09-22
13:27:42 UTC (rev 20679)
+++
search/trunk/hibernate-search/src/main/java/org/hibernate/search/engine/EntityInfo.java 2010-09-22
13:28:23 UTC (rev 20680)
@@ -1,26 +1,25 @@
-/* $Id$
- *
+/*
* Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2009, Red Hat, Inc. and/or its affiliates 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, Inc.
- *
- * 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
+ *
+ * Copyright (c) 2010, Red Hat, Inc. and/or its affiliates 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, Inc.
+ *
+ * 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.search.engine;
@@ -29,20 +28,43 @@
import java.util.List;
/**
+ * Wrapper class for the loading of a single entity.
*
* @author Emmanuel Bernard
+ * @author Hardy Ferentschik
*/
public class EntityInfo {
-
+ /**
+ * The entity class.
+ */
public final Class clazz;
+
+ /**
+ * The document id.
+ */
public final Serializable id;
+
+ /**
+ * The name of the document id property.
+ */
+ public final String idName;
+
+ /**
+ * Array of projected values. {@code null} in case there are no projections.
+ */
public final Object[] projection;
+
public final List<Integer> indexesOfThis = new LinkedList<Integer>();
-
- public EntityInfo(Class clazz, Serializable id, Object[] projection) {
+
+ public EntityInfo(Class clazz, String idName, Serializable id, Object[] projection) {
this.clazz = clazz;
+ this.idName = idName;
this.id = id;
- this.projection = projection;
+ if ( projection != null ) {
+ this.projection = projection.clone();
+ }
+ else {
+ this.projection = null;
+ }
}
-
}
Modified:
search/trunk/hibernate-search/src/main/java/org/hibernate/search/engine/LoaderHelper.java
===================================================================
---
search/trunk/hibernate-search/src/main/java/org/hibernate/search/engine/LoaderHelper.java 2010-09-22
13:27:42 UTC (rev 20679)
+++
search/trunk/hibernate-search/src/main/java/org/hibernate/search/engine/LoaderHelper.java 2010-09-22
13:28:23 UTC (rev 20680)
@@ -1,26 +1,25 @@
-/* $Id$
- *
+/*
* Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2009, Red Hat, Inc. and/or its affiliates 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, Inc.
- *
- * 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
+ *
+ * Copyright (c) 2010, Red Hat, Inc. and/or its affiliates 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, Inc.
+ *
+ * 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.search.engine;
@@ -37,13 +36,13 @@
private static final List<Class> objectNotFoundExceptions;
static {
- objectNotFoundExceptions = new ArrayList<Class>(2);
+ objectNotFoundExceptions = new ArrayList<Class>( 2 );
try {
objectNotFoundExceptions.add(
ReflectHelper.classForName( "org.hibernate.ObjectNotFoundException" )
);
}
- catch (ClassNotFoundException e) {
+ catch ( ClassNotFoundException e ) {
//leave it alone
}
try {
@@ -51,7 +50,7 @@
ReflectHelper.classForName( "javax.persistence.EntityNotFoundException" )
);
}
- catch (ClassNotFoundException e) {
+ catch ( ClassNotFoundException e ) {
//leave it alone
}
}
@@ -59,7 +58,7 @@
public static boolean isObjectNotFoundException(RuntimeException e) {
boolean objectNotFound = false;
Class exceptionClass = e.getClass();
- for ( Class clazz : objectNotFoundExceptions) {
+ for ( Class clazz : objectNotFoundExceptions ) {
if ( clazz.isAssignableFrom( exceptionClass ) ) {
objectNotFound = true;
break;
Modified:
search/trunk/hibernate-search/src/main/java/org/hibernate/search/engine/ObjectLoaderHelper.java
===================================================================
---
search/trunk/hibernate-search/src/main/java/org/hibernate/search/engine/ObjectLoaderHelper.java 2010-09-22
13:27:42 UTC (rev 20679)
+++
search/trunk/hibernate-search/src/main/java/org/hibernate/search/engine/ObjectLoaderHelper.java 2010-09-22
13:28:23 UTC (rev 20680)
@@ -1,26 +1,25 @@
-/* $Id$
- *
+/*
* Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2009, Red Hat, Inc. and/or its affiliates 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, Inc.
- *
- * 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
+ *
+ * Copyright (c) 2010, Red Hat, Inc. and/or its affiliates 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, Inc.
+ *
+ * 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.search.engine;
@@ -32,14 +31,17 @@
import org.slf4j.Logger;
import org.hibernate.Criteria;
+import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.criterion.Disjunction;
import org.hibernate.criterion.Restrictions;
+import org.hibernate.search.SearchException;
import org.hibernate.search.util.HibernateHelper;
import org.hibernate.search.util.LoggerFactory;
/**
* @author Emmanuel Bernard
+ * @author Hardy Ferentschik
*/
public class ObjectLoaderHelper {
@@ -47,15 +49,16 @@
private static final Logger log = LoggerFactory.make();
public static Object load(EntityInfo entityInfo, Session session) {
- //be sure to get an initialized object but save from ONFE and ENFE
- Object maybeProxy = session.load( entityInfo.clazz, entityInfo.id );
+ Object maybeProxy = executeLoad( entityInfo, session );
try {
HibernateHelper.initialize( maybeProxy );
}
- catch (RuntimeException e) {
+ catch ( RuntimeException e ) {
if ( LoaderHelper.isObjectNotFoundException( e ) ) {
- log.debug( "Object found in Search index but not in database: {} with id
{}",
- entityInfo.clazz, entityInfo.id );
+ log.debug(
+ "Object found in Search index but not in database: {} with id {}",
+ entityInfo.clazz, entityInfo.id
+ );
maybeProxy = null;
}
else {
@@ -69,22 +72,28 @@
Criteria criteria, Class<?> entityType,
SearchFactoryImplementor searchFactoryImplementor) {
final int maxResults = entityInfos.length;
- if ( maxResults == 0 ) return;
+ if ( maxResults == 0 ) {
+ return;
+ }
- Set<Class<?>> indexedEntities =
searchFactoryImplementor.getIndexedTypesPolymorphic( new Class<?>[]{entityType} );
- DocumentBuilderIndexedEntity<?> builder =
searchFactoryImplementor.getDocumentBuilderIndexedEntity(
indexedEntities.iterator().next() );
+ Set<Class<?>> indexedEntities =
searchFactoryImplementor.getIndexedTypesPolymorphic( new Class<?>[] { entityType }
);
+ DocumentBuilderIndexedEntity<?> builder =
searchFactoryImplementor.getDocumentBuilderIndexedEntity(
+ indexedEntities.iterator().next()
+ );
String idName = builder.getIdentifierName();
Disjunction disjunction = Restrictions.disjunction();
int loop = maxResults / MAX_IN_CLAUSE;
boolean exact = maxResults % MAX_IN_CLAUSE == 0;
- if ( !exact ) loop++;
- for (int index = 0; index < loop; index++) {
+ if ( !exact ) {
+ loop++;
+ }
+ for ( int index = 0; index < loop; index++ ) {
int max = index * MAX_IN_CLAUSE + MAX_IN_CLAUSE <= maxResults ?
index * MAX_IN_CLAUSE + MAX_IN_CLAUSE :
maxResults;
List<Serializable> ids = new ArrayList<Serializable>( max - index *
MAX_IN_CLAUSE );
- for (int entityInfoIndex = index * MAX_IN_CLAUSE; entityInfoIndex < max;
entityInfoIndex++) {
+ for ( int entityInfoIndex = index * MAX_IN_CLAUSE; entityInfoIndex < max;
entityInfoIndex++ ) {
ids.add( entityInfos[entityInfoIndex].id );
}
disjunction.add( Restrictions.in( idName, ids ) );
@@ -97,8 +106,8 @@
public static List returnAlreadyLoadedObjectsInCorrectOrder(EntityInfo[] entityInfos,
Session session) {
//mandatory to keep the same ordering
List result = new ArrayList( entityInfos.length );
- for (EntityInfo entityInfo : entityInfos) {
- Object element = session.load( entityInfo.clazz, entityInfo.id );
+ for ( EntityInfo entityInfo : entityInfos ) {
+ Object element = executeLoad( entityInfo, session );
if ( HibernateHelper.isInitialized( element ) ) {
//all existing elements should have been loaded by the query,
//the other ones are missing ones
@@ -106,11 +115,42 @@
}
else {
if ( log.isDebugEnabled() ) {
- log.debug( "Object found in Search index but not in database: {} with
{}",
- entityInfo.clazz, entityInfo.id );
+ log.debug(
+ "Object found in Search index but not in database: {} with {}",
+ entityInfo.clazz, entityInfo.id
+ );
}
}
}
return result;
}
+
+ private static Object executeLoad(EntityInfo entityInfo, Session session) {
+ Object maybeProxy;
+ String hibernateIdentifierProperty = session.getSessionFactory()
+ .getClassMetadata( entityInfo.clazz )
+ .getIdentifierPropertyName();
+
+ if ( entityInfo.idName.equals( hibernateIdentifierProperty ) ) {
+ //be sure to get an initialized object but save from ONFE and ENFE
+ maybeProxy = session.load( entityInfo.clazz, entityInfo.id );
+ }
+ else {
+ Criteria criteria = session.createCriteria( entityInfo.clazz );
+ criteria.add( Restrictions.eq( entityInfo.idName, entityInfo.id ) );
+ try {
+ maybeProxy = criteria.uniqueResult();
+ }
+ catch ( HibernateException e ) {
+ throw new SearchException(
+ "Loading entity of type " + entityInfo.clazz.getName() + " using
'"
+ + entityInfo.idName
+ + "' as document id and '"
+ + entityInfo.id
+ + "' as value was not unique"
+ );
+ }
+ }
+ return maybeProxy;
+ }
}
Modified:
search/trunk/hibernate-search/src/main/java/org/hibernate/search/util/HibernateHelper.java
===================================================================
---
search/trunk/hibernate-search/src/main/java/org/hibernate/search/util/HibernateHelper.java 2010-09-22
13:27:42 UTC (rev 20679)
+++
search/trunk/hibernate-search/src/main/java/org/hibernate/search/util/HibernateHelper.java 2010-09-22
13:28:23 UTC (rev 20680)
@@ -1,3 +1,27 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat, Inc. and/or its affiliates 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, Inc.
+ *
+ * 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.search.util;
import org.hibernate.Hibernate;
@@ -7,7 +31,8 @@
* @author Emmanuel Bernard
*/
public final class HibernateHelper {
- private HibernateHelper() {};
+ private HibernateHelper() {
+ }
/**
* Get the real class type.
Added:
search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/id/Article.java
===================================================================
--- search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/id/Article.java
(rev 0)
+++
search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/id/Article.java 2010-09-22
13:28:23 UTC (rev 20680)
@@ -0,0 +1,73 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat, Inc. and/or its affiliates 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, Inc.
+ *
+ * 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
+ */
+
+// $Id:$
+package org.hibernate.search.test.id;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+import org.hibernate.search.annotations.DocumentId;
+import org.hibernate.search.annotations.Field;
+import org.hibernate.search.annotations.Index;
+import org.hibernate.search.annotations.Indexed;
+import org.hibernate.search.annotations.Store;
+
+/**
+ * @author Hardy Ferentschik
+ */
+@Entity
+@Indexed
+public class Article {
+ @Id
+ @GeneratedValue
+ long articleId;
+
+ @DocumentId
+ int documentId;
+
+ @Field(index = Index.TOKENIZED, store = Store.NO)
+ String text;
+
+ public long getArticleId() {
+ return articleId;
+ }
+
+ public int getDocumentId() {
+ return documentId;
+ }
+
+ public void setDocumentId(int documentId) {
+ this.documentId = documentId;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+}
\ No newline at end of file
Added:
search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/id/DuplicateDocumentIdTest.java
===================================================================
---
search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/id/DuplicateDocumentIdTest.java
(rev 0)
+++
search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/id/DuplicateDocumentIdTest.java 2010-09-22
13:28:23 UTC (rev 20680)
@@ -0,0 +1,61 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat, Inc. and/or its affiliates 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, Inc.
+ *
+ * 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.search.test.id;
+
+import org.hibernate.HibernateException;
+import org.hibernate.search.test.SearchTestCase;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class DuplicateDocumentIdTest extends SearchTestCase {
+
+ public void setUp() {
+ // don't call super.setUp - we want to build the configuration in the test
+ }
+
+ /**
+ * Tests that an exception is thrown in case @DocumentId is specified on more than one
property
+ *
+ * @throws Exception in case the test fails.
+ */
+ public void testDuplicateDocumentId() throws Exception {
+ try {
+ buildConfiguration();
+ fail( "Building of configuration should fail, because Foo defines multiple
document ids." );
+ }
+ catch ( HibernateException e ) { // getting a HibernateException here, because the
listener registration fails
+ assertEquals(
+ "More than one @DocumentId specified on entity
org.hibernate.search.test.id.Foo",
+ e.getCause().getMessage()
+ );
+ }
+ }
+
+ protected Class<?>[] getAnnotatedClasses() {
+ return new Class[] {
+ Foo.class
+ };
+ }
+}
Added:
search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/id/ExplicitIdTest.java
===================================================================
---
search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/id/ExplicitIdTest.java
(rev 0)
+++
search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/id/ExplicitIdTest.java 2010-09-22
13:28:23 UTC (rev 20680)
@@ -0,0 +1,140 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat, Inc. and/or its affiliates 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, Inc.
+ *
+ * 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.search.test.id;
+
+import java.util.List;
+
+import org.apache.lucene.index.Term;
+import org.apache.lucene.search.TermQuery;
+
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+import org.hibernate.search.Search;
+import org.hibernate.search.SearchException;
+import org.hibernate.search.test.SearchTestCase;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class ExplicitIdTest extends SearchTestCase {
+
+ /**
+ * Tests that @DocumentId can be specified on a field other than the @Id annotated one.
See HSEARCH-574.
+ *
+ * @throws Exception in case the test fails.
+ */
+ public void testExplicitDocumentIdSingleResult() throws Exception {
+ Article hello = new Article();
+ hello.setDocumentId( 1 );
+ hello.setText( "Hello World" );
+
+ Session s = openSession();
+ Transaction tx = s.beginTransaction();
+ s.save( hello );
+ tx.commit();
+ s.clear();
+
+ tx = s.beginTransaction();
+ List results = Search.getFullTextSession( s ).createFullTextQuery(
+ new TermQuery( new Term( "text", "world" ) )
+ ).list();
+ assertEquals( 1, results.size() );
+ tx.commit();
+ s.close();
+ }
+
+ /**
+ * Tests that @DocumentId can be specified on a field other than the @Id annotated one.
See HSEARCH-574.
+ *
+ * @throws Exception in case the test fails.
+ */
+ public void testExplicitDocumentIdMultipleResults() throws Exception {
+ Article hello = new Article();
+ hello.setDocumentId( 1 );
+ hello.setText( "Hello World" );
+
+ Article goodbye = new Article();
+ goodbye.setDocumentId( 2 );
+ goodbye.setText( "Goodbye World" );
+
+ Session s = openSession();
+ Transaction tx = s.beginTransaction();
+ s.save( hello );
+ s.save( goodbye );
+ tx.commit();
+ s.clear();
+
+ tx = s.beginTransaction();
+ List results = Search.getFullTextSession( s ).createFullTextQuery(
+ new TermQuery( new Term( "text", "world" ) )
+ ).list();
+ assertEquals( 2, results.size() );
+ tx.commit();
+ s.close();
+ }
+
+ /**
+ * Tests that the document id must be unique
+ *
+ * @throws Exception in case the test fails.
+ */
+ public void testDocumentIdMustBeUnique() throws Exception {
+ Article hello = new Article();
+ hello.setDocumentId( 1 );
+ hello.setText( "Hello World" );
+
+ Article goodbye = new Article();
+ goodbye.setDocumentId( 1 );
+ goodbye.setText( "Goodbye World" );
+
+ Session s = openSession();
+ Transaction tx = s.beginTransaction();
+ s.save( hello );
+ s.save( goodbye );
+ tx.commit();
+ s.clear();
+
+ tx = s.beginTransaction();
+ try {
+ Search.getFullTextSession( s ).createFullTextQuery(
+ new TermQuery( new Term( "text", "world" ) )
+ ).list();
+ fail( "Test should fail, because document id is not unique." );
+ }
+ catch ( SearchException e ) {
+ assertEquals(
+ "Loading entity of type org.hibernate.search.test.id.Article using
'documentId' as document id and '1' as value was not unique",
+ e.getMessage()
+ );
+ }
+ tx.commit();
+ s.close();
+ }
+
+ protected Class<?>[] getAnnotatedClasses() {
+ return new Class[] {
+ Article.class
+ };
+ }
+}
Added: search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/id/Foo.java
===================================================================
--- search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/id/Foo.java
(rev 0)
+++
search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/id/Foo.java 2010-09-22
13:28:23 UTC (rev 20680)
@@ -0,0 +1,65 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat, Inc. and/or its affiliates 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, Inc.
+ *
+ * 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.search.test.id;
+
+import java.lang.annotation.Documented;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+import org.hibernate.search.annotations.DocumentId;
+import org.hibernate.search.annotations.Field;
+import org.hibernate.search.annotations.Index;
+import org.hibernate.search.annotations.Indexed;
+
+/**
+ * @author Hardy Ferentschik
+ */
+@Entity
+@Indexed
+public class Foo {
+ @Id
+ @DocumentId
+ private Integer id;
+
+ @DocumentId
+ private String name;
+
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
Modified:
search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/id/ImplicitIdTest.java
===================================================================
---
search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/id/ImplicitIdTest.java 2010-09-22
13:27:42 UTC (rev 20679)
+++
search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/id/ImplicitIdTest.java 2010-09-22
13:28:23 UTC (rev 20680)
@@ -1,26 +1,25 @@
-/* $Id$
- *
+/*
* Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2009, Red Hat, Inc. and/or its affiliates 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, Inc.
- *
- * 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
+ *
+ * Copyright (c) 2010, Red Hat, Inc. and/or its affiliates 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, Inc.
+ *
+ * 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.search.test.id;
Modified: search/trunk/hibernate-search-solr-analyzers/pom.xml
===================================================================
--- search/trunk/hibernate-search-solr-analyzers/pom.xml 2010-09-22 13:27:42 UTC (rev
20679)
+++ search/trunk/hibernate-search-solr-analyzers/pom.xml 2010-09-22 13:28:23 UTC (rev
20680)
@@ -1,26 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2009, Red Hat, Inc. and/or its affiliates 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, Inc.
- *
- * 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
+ ~ Hibernate, Relational Persistence for Idiomatic Java
+ ~
+ ~ Copyright (c) 2010, Red Hat, Inc. and/or its affiliates 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, Inc.
+ ~
+ ~ 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
-->
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"