Hibernate SVN: r17856 - beanvalidation/tck/tags.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-10-28 05:53:54 -0400 (Wed, 28 Oct 2009)
New Revision: 17856
Added:
beanvalidation/tck/tags/v1_0_1_GA/
Log:
[maven-scm] copy for tag v1_0_1_GA
Copied: beanvalidation/tck/tags/v1_0_1_GA (from rev 17855, beanvalidation/tck/trunk)
15 years, 4 months
Hibernate SVN: r17854 - in beanvalidation/tck/trunk: src/main/docbook/en-US and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-10-28 05:51:51 -0400 (Wed, 28 Oct 2009)
New Revision: 17854
Modified:
beanvalidation/tck/trunk/pom.xml
beanvalidation/tck/trunk/src/main/docbook/en-US/installation.xml
Log:
let the release plugin also build the dist package. version update in docs
Modified: beanvalidation/tck/trunk/pom.xml
===================================================================
--- beanvalidation/tck/trunk/pom.xml 2009-10-27 19:58:19 UTC (rev 17853)
+++ beanvalidation/tck/trunk/pom.xml 2009-10-28 09:51:51 UTC (rev 17854)
@@ -55,11 +55,23 @@
<groupId>org.jboss.test-harness</groupId>
<artifactId>jboss-test-harness-api</artifactId>
<version>1.0.0</version>
+ <exclusions>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.jboss.test-harness</groupId>
<artifactId>jboss-test-harness</artifactId>
<version>1.0.0</version>
+ <exclusions>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
</dependencies>
@@ -209,7 +221,7 @@
<configuration>
<allowTimestampedSnapshots>true</allowTimestampedSnapshots>
<remoteTagging>true</remoteTagging>
- <goals>deploy</goals>
+ <goals>deploy org.jboss.maven.plugins:maven-jdocbook-plugin:2.2.0:resources org.jboss.maven.plugins:maven-jdocbook-plugin:2.2.0:generate assembly:assembly</goals>
</configuration>
</plugin>
<plugin>
Modified: beanvalidation/tck/trunk/src/main/docbook/en-US/installation.xml
===================================================================
--- beanvalidation/tck/trunk/src/main/docbook/en-US/installation.xml 2009-10-27 19:58:19 UTC (rev 17853)
+++ beanvalidation/tck/trunk/src/main/docbook/en-US/installation.xml 2009-10-28 09:51:51 UTC (rev 17854)
@@ -71,7 +71,7 @@
source into a subfolder ri. This will allow you to run the TCK against
Hibernate Validator.</para>
- <programlisting>svn co http://anonsvn.jboss.org/repos/hibernate/validator/tags/v4_0_0_GA ri</programlisting>
+ <programlisting>svn co http://anonsvn.jboss.org/repos/hibernate/validator/tags/v4_0_1_GA ri</programlisting>
<para>If you have downloaded the Hibernate Validator distribution, extract
it into a sibling folder named hibernate-validator. The resulting folder
15 years, 4 months
Hibernate SVN: r17853 - in core/trunk/envers/src: test/java/org/hibernate/envers/test/entities/onetomany and 3 other directories.
by hibernate-commits@lists.jboss.org
Author: adamw
Date: 2009-10-27 15:58:19 -0400 (Tue, 27 Oct 2009)
New Revision: 17853
Added:
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/serialization/
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/serialization/SerializingCollection.java
Modified:
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/proxy/CollectionProxy.java
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/proxy/ListProxy.java
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/proxy/SetProxy.java
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/proxy/SortedSetProxy.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/CollectionRefEdEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/CollectionRefIngEntity.java
core/trunk/envers/src/test/resources/testng.xml
Log:
HHH-4488:
- applying patch (making collection proxy serializable) + test
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/proxy/CollectionProxy.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/proxy/CollectionProxy.java 2009-10-27 19:53:14 UTC (rev 17852)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/proxy/CollectionProxy.java 2009-10-27 19:58:19 UTC (rev 17853)
@@ -23,6 +23,7 @@
*/
package org.hibernate.envers.entities.mapper.relation.lazy.proxy;
+import java.io.Serializable;
import java.util.Collection;
import java.util.Iterator;
@@ -31,8 +32,10 @@
/**
* @author Adam Warski (adam at warski dot org)
*/
-public abstract class CollectionProxy<U, T extends Collection<U>> implements Collection<U> {
- private org.hibernate.envers.entities.mapper.relation.lazy.initializor.Initializor<T> initializor;
+public abstract class CollectionProxy<U, T extends Collection<U>> implements Collection<U>, Serializable {
+ private static final long serialVersionUID = 8698249863871832402L;
+
+ private transient org.hibernate.envers.entities.mapper.relation.lazy.initializor.Initializor<T> initializor;
protected T delegate;
protected CollectionProxy() {
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/proxy/ListProxy.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/proxy/ListProxy.java 2009-10-27 19:53:14 UTC (rev 17852)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/proxy/ListProxy.java 2009-10-27 19:58:19 UTC (rev 17853)
@@ -33,7 +33,7 @@
/**
* @author Adam Warski (adam at warski dot org)
*/
-public class ListProxy<U> extends CollectionProxy<U, List<U>> implements List<U>, Serializable {
+public class ListProxy<U> extends CollectionProxy<U, List<U>> implements List<U> {
private static final long serialVersionUID = -5479232938279790987L;
public ListProxy() {
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/proxy/SetProxy.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/proxy/SetProxy.java 2009-10-27 19:53:14 UTC (rev 17852)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/proxy/SetProxy.java 2009-10-27 19:58:19 UTC (rev 17853)
@@ -29,7 +29,7 @@
/**
* @author Adam Warski (adam at warski dot org)
*/
-public class SetProxy<U> extends CollectionProxy<U, Set<U>> implements Set<U>, Serializable {
+public class SetProxy<U> extends CollectionProxy<U, Set<U>> implements Set<U> {
private static final long serialVersionUID = 131464133074137701L;
public SetProxy() {
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/proxy/SortedSetProxy.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/proxy/SortedSetProxy.java 2009-10-27 19:53:14 UTC (rev 17852)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/proxy/SortedSetProxy.java 2009-10-27 19:58:19 UTC (rev 17853)
@@ -25,12 +25,11 @@
import java.util.Comparator;
import java.util.SortedSet;
-import java.io.Serializable;
/**
* @author Adam Warski (adam at warski dot org)
*/
-public class SortedSetProxy<U> extends CollectionProxy<U, SortedSet<U>> implements SortedSet<U>, Serializable {
+public class SortedSetProxy<U> extends CollectionProxy<U, SortedSet<U>> implements SortedSet<U> {
private static final long serialVersionUID = 2092884107178125905L;
public SortedSetProxy() {
@@ -69,4 +68,4 @@
checkInit();
return delegate.last();
}
-}
\ No newline at end of file
+}
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/CollectionRefEdEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/CollectionRefEdEntity.java 2009-10-27 19:53:14 UTC (rev 17852)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/CollectionRefEdEntity.java 2009-10-27 19:58:19 UTC (rev 17853)
@@ -24,6 +24,7 @@
package org.hibernate.envers.test.entities.onetomany;
import java.util.Collection;
+import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;
@@ -35,7 +36,9 @@
* @author Adam Warski (adam at warski dot org)
*/
@Entity
-public class CollectionRefEdEntity {
+public class CollectionRefEdEntity implements Serializable {
+ private static final long serialVersionUID = -1694020123633796683L;
+
@Id
private Integer id;
@@ -46,7 +49,7 @@
@OneToMany(mappedBy="reference")
private Collection<CollectionRefIngEntity> reffering;
- public CollectionRefEdEntity() {
+ public CollectionRefEdEntity() {
}
public CollectionRefEdEntity(Integer id, String data) {
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/CollectionRefIngEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/CollectionRefIngEntity.java 2009-10-27 19:53:14 UTC (rev 17852)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/onetomany/CollectionRefIngEntity.java 2009-10-27 19:58:19 UTC (rev 17853)
@@ -29,12 +29,16 @@
import org.hibernate.envers.Audited;
+import java.io.Serializable;
+
/**
* ReferencIng entity
* @author Adam Warski (adam at warski dot org)
*/
@Entity
-public class CollectionRefIngEntity {
+public class CollectionRefIngEntity implements Serializable {
+ private static final long serialVersionUID = -9019967223928425707L;
+
@Id
private Integer id;
@@ -45,7 +49,7 @@
@ManyToOne
private CollectionRefEdEntity reference;
- public CollectionRefIngEntity() { }
+ public CollectionRefIngEntity() { }
public CollectionRefIngEntity(Integer id, String data, CollectionRefEdEntity reference) {
this.id = id;
Added: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/serialization/SerializingCollection.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/serialization/SerializingCollection.java (rev 0)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/serialization/SerializingCollection.java 2009-10-27 19:58:19 UTC (rev 17853)
@@ -0,0 +1,110 @@
+/*
+ * 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.envers.test.integration.serialization;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectOutputStream;
+import java.io.ByteArrayInputStream;
+import java.io.ObjectInputStream;
+import java.io.IOException;
+import javax.persistence.EntityManager;
+
+import org.hibernate.envers.test.AbstractEntityTest;
+import org.hibernate.envers.test.entities.onetomany.CollectionRefEdEntity;
+import org.hibernate.envers.test.entities.onetomany.CollectionRefIngEntity;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import org.hibernate.ejb.Ejb3Configuration;
+
+/**
+ * @author Adam Warski (adam at warski dot org)
+ */
+public class SerializingCollection extends AbstractEntityTest {
+ private Integer ed1_id;
+ private Integer ing1_id;
+
+ public void configure(Ejb3Configuration cfg) {
+ cfg.addAnnotatedClass(CollectionRefEdEntity.class);
+ cfg.addAnnotatedClass(CollectionRefIngEntity.class);
+ }
+
+ @BeforeClass(dependsOnMethods = "init")
+ public void initData() {
+ EntityManager em = getEntityManager();
+
+ CollectionRefEdEntity ed1 = new CollectionRefEdEntity(1, "data_ed_1");
+
+ CollectionRefIngEntity ing1 = new CollectionRefIngEntity(3, "data_ing_1", ed1);
+
+ // Revision 1
+ em.getTransaction().begin();
+
+ em.persist(ed1);
+ em.persist(ing1);
+
+ em.getTransaction().commit();
+
+ //
+
+ ed1_id = ed1.getId();
+ ing1_id = ing1.getId();
+ }
+
+ @Test
+ public void testDetach()throws Exception {
+ CollectionRefIngEntity ing1 = getEntityManager().find(CollectionRefIngEntity.class, ing1_id);
+ CollectionRefEdEntity rev1 = getAuditReader().find(CollectionRefEdEntity.class, ed1_id, 1);
+
+ // First forcing loading of the collection
+ assert rev1.getReffering().size() == 1;
+
+ // Now serializing and de-serializing the
+ rev1 = serializeDeserialize(rev1);
+
+ // And checking the colleciton again
+ assert rev1.getReffering().contains(ing1);
+ assert rev1.getReffering().size() == 1;
+
+ }
+
+ @SuppressWarnings({"unchecked"})
+ public static <T> T serializeDeserialize(T o) throws Exception {
+ if (o == null) return null;
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(o);
+ byte[] buffer = baos.toByteArray();
+ baos.close();
+
+ ByteArrayInputStream bais = new ByteArrayInputStream(buffer);
+ ObjectInputStream ois = new ObjectInputStream(bais);
+ return (T) ois.readObject();
+ }
+}
Modified: core/trunk/envers/src/test/resources/testng.xml
===================================================================
--- core/trunk/envers/src/test/resources/testng.xml 2009-10-27 19:53:14 UTC (rev 17852)
+++ core/trunk/envers/src/test/resources/testng.xml 2009-10-27 19:58:19 UTC (rev 17853)
@@ -54,6 +54,7 @@
<package name="org.hibernate.envers.test.integration.sameids" />
<package name="org.hibernate.envers.test.integration.secondary" />
<package name="org.hibernate.envers.test.integration.secondary.ids" />
+ <package name="org.hibernate.envers.test.integration.serialization" />
<package name="org.hibernate.envers.test.integration.superclass" />
</packages>
</test>
15 years, 4 months
Hibernate SVN: r17852 - core/trunk/envers/src/test/resources.
by hibernate-commits@lists.jboss.org
Author: adamw
Date: 2009-10-27 15:53:14 -0400 (Tue, 27 Oct 2009)
New Revision: 17852
Modified:
core/trunk/envers/src/test/resources/hibernate.test.cfg.xml
Log:
Diabling generation of the metamodel for tests as the generation breaks them
Modified: core/trunk/envers/src/test/resources/hibernate.test.cfg.xml
===================================================================
--- core/trunk/envers/src/test/resources/hibernate.test.cfg.xml 2009-10-27 19:27:02 UTC (rev 17851)
+++ core/trunk/envers/src/test/resources/hibernate.test.cfg.xml 2009-10-27 19:53:14 UTC (rev 17852)
@@ -17,6 +17,8 @@
<property name="connection.username">sa</property>
<property name="connection.password"></property>
+ <property name="hibernate.ejb.metamodel.generation">disabled</property>
+
<!--<property name="dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
<property name="connection.url">jdbc:mysql:///hibernate_tests?useUnicode=true&characterEncoding=UTF-8</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
15 years, 4 months
Hibernate SVN: r17851 - in search/trunk/src: main/java/org/hibernate/search/backend and 5 other directories.
by hibernate-commits@lists.jboss.org
Author: sannegrinovero
Date: 2009-10-27 15:27:02 -0400 (Tue, 27 Oct 2009)
New Revision: 17851
Added:
search/trunk/src/test/java/org/hibernate/search/test/similarity/IllegalSimilarityConfigurationTest.java
search/trunk/src/test/java/org/hibernate/search/test/similarity/LittleTrash.java
search/trunk/src/test/java/org/hibernate/search/test/similarity/ProperTrashExtension.java
search/trunk/src/test/java/org/hibernate/search/test/similarity/Sink.java
search/trunk/src/test/java/org/hibernate/search/test/similarity/SmallerCan.java
Modified:
search/trunk/src/main/docbook/en-US/modules/lucene-native.xml
search/trunk/src/main/java/org/hibernate/search/backend/Workspace.java
search/trunk/src/main/java/org/hibernate/search/backend/impl/lucene/works/AddWorkDelegate.java
search/trunk/src/main/java/org/hibernate/search/engine/DocumentBuilderContainedEntity.java
search/trunk/src/main/java/org/hibernate/search/engine/SearchFactoryImplementor.java
search/trunk/src/main/java/org/hibernate/search/impl/SearchFactoryImpl.java
search/trunk/src/test/java/org/hibernate/search/test/similarity/Trash.java
search/trunk/src/test/java/org/hibernate/search/test/util/FullTextSessionBuilder.java
Log:
HSEARCH-367 - Support only one kind of Similarity per index
Modified: search/trunk/src/main/docbook/en-US/modules/lucene-native.xml
===================================================================
--- search/trunk/src/main/docbook/en-US/modules/lucene-native.xml 2009-10-27 18:49:25 UTC (rev 17850)
+++ search/trunk/src/main/docbook/en-US/modules/lucene-native.xml 2009-10-27 19:27:02 UTC (rev 17851)
@@ -210,5 +210,11 @@
should be scored the same as documents with multiple occurrences. In this
case your custom implementation of the method <methodname>tf(float
freq)</methodname> should return 1.0.</para>
+
+ <warning><para>When two entities share the same index they must declare the
+ same <classname>Similarity</classname> implementation. Classes in the same
+ class hierarchy always share the index, so it's not allowed to override the
+ <classname>Similarity</classname> implementation in a subtype.</para></warning>
+
</section>
</chapter>
Modified: search/trunk/src/main/java/org/hibernate/search/backend/Workspace.java
===================================================================
--- search/trunk/src/main/java/org/hibernate/search/backend/Workspace.java 2009-10-27 18:49:25 UTC (rev 17850)
+++ search/trunk/src/main/java/org/hibernate/search/backend/Workspace.java 2009-10-27 19:27:02 UTC (rev 17851)
@@ -32,6 +32,7 @@
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.SimpleAnalyzer;
import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.search.Similarity;
import org.slf4j.Logger;
import org.hibernate.search.SearchException;
@@ -67,6 +68,7 @@
private final ReentrantLock lock;
private final Set<Class<?>> entitiesInDirectory;
private final LuceneIndexingParameters indexingParams;
+ private final Similarity similarity;
// variable state:
@@ -87,6 +89,7 @@
this.entitiesInDirectory = searchFactoryImplementor.getClassesInDirectoryProvider( provider );
this.indexingParams = searchFactoryImplementor.getIndexingParameters( directoryProvider );
this.lock = searchFactoryImplementor.getDirectoryProviderLock( provider );
+ this.similarity = searchFactoryImplementor.getSimilarity( directoryProvider );
}
public <T> DocumentBuilderIndexedEntity<T> getDocumentBuilder(Class<T> entity) {
@@ -126,7 +129,7 @@
lock.lock();
try {
//Needs to ensure the optimizerStrategy is accessed in threadsafe way
- synchronized (optimizerStrategy) {
+ synchronized ( optimizerStrategy ) {
optimizerStrategy.optimizationForced();
}
}
@@ -148,6 +151,7 @@
try {
writer = new IndexWriter( directoryProvider.getDirectory(), SIMPLE_ANALYZER, false, maxFieldLength ); // has been created at init time
indexingParams.applyToWriter( writer, batchmode );
+ writer.setSimilarity( similarity );
log.trace( "IndexWriter opened" );
}
catch ( IOException e ) {
Modified: search/trunk/src/main/java/org/hibernate/search/backend/impl/lucene/works/AddWorkDelegate.java
===================================================================
--- search/trunk/src/main/java/org/hibernate/search/backend/impl/lucene/works/AddWorkDelegate.java 2009-10-27 18:49:25 UTC (rev 17850)
+++ search/trunk/src/main/java/org/hibernate/search/backend/impl/lucene/works/AddWorkDelegate.java 2009-10-27 19:27:02 UTC (rev 17851)
@@ -29,7 +29,6 @@
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.index.IndexWriter;
-import org.apache.lucene.search.Similarity;
import org.slf4j.Logger;
import org.hibernate.search.SearchException;
@@ -42,7 +41,7 @@
import org.hibernate.search.util.ScopedAnalyzer;
/**
- * Stateless implementation that performs a <code>AddLuceneWork</code>.
+ * Stateless implementation that performs an <code>AddLuceneWork</code>.
*
* @author Emmanuel Bernard
* @author Hardy Ferentschik
@@ -67,8 +66,7 @@
DocumentBuilderIndexedEntity documentBuilder = workspace.getDocumentBuilder( entityType );
Map<String, String> fieldToAnalyzerMap = ( ( AddLuceneWork ) work ).getFieldToAnalyzerMap();
ScopedAnalyzer analyzer = ( ScopedAnalyzer ) documentBuilder.getAnalyzer();
- analyzer = updateAnalyzerMappings( analyzer, fieldToAnalyzerMap, workspace );
- Similarity similarity = documentBuilder.getSimilarity();
+ analyzer = updateAnalyzerMappings( analyzer, fieldToAnalyzerMap );
if ( log.isTraceEnabled() ) {
log.trace(
"add to Lucene index: {}#{}:{}",
@@ -76,9 +74,6 @@
);
}
try {
- //TODO the next two operations should be atomic to enable concurrent usage of IndexWriter
- // make a wrapping Similarity based on ThreadLocals? or have it autoselect implementation basing on entity?
- writer.setSimilarity( similarity );
writer.addDocument( work.getDocument(), analyzer );
workspace.incrementModificationCounter( 1 );
}
@@ -95,14 +90,13 @@
*
* @param scopedAnalyzer The scoped analyzer created at startup time.
* @param fieldToAnalyzerMap A map of <code>Document</code> field names for analyzer names. This map gets creates
- * when the Lucene <code>Document</code> gets created and uses the state of the entiy to index to determine analyzers
+ * when the Lucene <code>Document</code> gets created and uses the state of the entity to index to determine analyzers
* dynamically at index time.
- * @param workspace The current workspace.
* @return <code>scopedAnalyzer</code> in case <code>fieldToAnalyzerMap</code> is <code>null</code> or empty. Otherwise
* a clone of <code>scopedAnalyzer</code> is created where the analyzers get overriden according to <code>fieldToAnalyzerMap</code>.
*/
- private ScopedAnalyzer updateAnalyzerMappings(ScopedAnalyzer scopedAnalyzer, Map<String, String> fieldToAnalyzerMap, Workspace workspace) {
- // for backwards compatability
+ private ScopedAnalyzer updateAnalyzerMappings(ScopedAnalyzer scopedAnalyzer, Map<String, String> fieldToAnalyzerMap) {
+ // for backwards compatibility
if ( fieldToAnalyzerMap == null || fieldToAnalyzerMap.isEmpty() ) {
return scopedAnalyzer;
}
Modified: search/trunk/src/main/java/org/hibernate/search/engine/DocumentBuilderContainedEntity.java
===================================================================
--- search/trunk/src/main/java/org/hibernate/search/engine/DocumentBuilderContainedEntity.java 2009-10-27 18:49:25 UTC (rev 17850)
+++ search/trunk/src/main/java/org/hibernate/search/engine/DocumentBuilderContainedEntity.java 2009-10-27 19:27:02 UTC (rev 17851)
@@ -93,7 +93,7 @@
protected int level = 0;
protected int maxLevel = Integer.MAX_VALUE;
protected final ScopedAnalyzer analyzer = new ScopedAnalyzer();
- protected Similarity similarity;
+ protected Similarity similarity; //there is only 1 similarity per class hierarchy, and only 1 per index
protected boolean isRoot;
protected EntityState entityState;
@@ -214,7 +214,6 @@
checkForAnalyzerDiscriminator( clazz, propertiesMetadata );
// Get similarity
- //TODO: similarity form @IndexedEmbedded are not taken care of. Exception??
if ( isRoot ) {
checkForSimilarity( clazz );
}
@@ -585,7 +584,7 @@
}
}
- protected Float getBoost(XClass element) {
+ protected float getBoost(XClass element) {
float boost = 1.0f;
if ( element == null ) {
return boost;
@@ -631,7 +630,7 @@
}
/**
- * If we have a work instance we have to check whether the intance to be indexed is contained in any other indexed entities.
+ * If we have a work instance we have to check whether the instance to be indexed is contained in any other indexed entities.
*
* @param instance The instance to be indexed
* @param queue the current work queue
Modified: search/trunk/src/main/java/org/hibernate/search/engine/SearchFactoryImplementor.java
===================================================================
--- search/trunk/src/main/java/org/hibernate/search/engine/SearchFactoryImplementor.java 2009-10-27 18:49:25 UTC (rev 17850)
+++ search/trunk/src/main/java/org/hibernate/search/engine/SearchFactoryImplementor.java 2009-10-27 19:27:02 UTC (rev 17851)
@@ -28,6 +28,7 @@
import java.util.Set;
import java.util.concurrent.locks.ReentrantLock;
+import org.apache.lucene.search.Similarity;
import org.hibernate.search.SearchFactory;
import org.hibernate.search.backend.BackendQueueProcessorFactory;
import org.hibernate.search.backend.LuceneIndexingParameters;
@@ -88,4 +89,6 @@
Set<Class<?>> getIndexedTypesPolymorphic(Class<?>[] classes);
BatchBackend makeBatchBackend(MassIndexerProgressMonitor progressMonitor);
+
+ Similarity getSimilarity(DirectoryProvider<?> directoryProvider);
}
Modified: search/trunk/src/main/java/org/hibernate/search/impl/SearchFactoryImpl.java
===================================================================
--- search/trunk/src/main/java/org/hibernate/search/impl/SearchFactoryImpl.java 2009-10-27 18:49:25 UTC (rev 17850)
+++ search/trunk/src/main/java/org/hibernate/search/impl/SearchFactoryImpl.java 2009-10-27 19:27:02 UTC (rev 17851)
@@ -40,6 +40,7 @@
import java.util.concurrent.locks.ReentrantLock;
import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.search.Similarity;
import org.slf4j.Logger;
import org.hibernate.annotations.common.reflection.ReflectionManager;
@@ -159,6 +160,7 @@
for ( DocumentBuilderContainedEntity builder : documentBuildersContainedEntities.values() ) {
builder.postInitialize( indexedClasses );
}
+ fillSimilarityMapping();
this.worker = WorkerFactory.createWorker( cfg, this );
this.readerProvider = ReaderProviderFactory.createReaderProvider( cfg, this );
this.filterCachingStrategy = buildFilterCachingStrategy( cfg.getProperties() );
@@ -169,6 +171,24 @@
this.barrier = 1; //write barrier
}
+ private void fillSimilarityMapping() {
+ for ( DirectoryProviderData directoryConfiguration : dirProviderData.values() ) {
+ for (Class<?> indexedType : directoryConfiguration.classes) {
+ DocumentBuilderIndexedEntity<?> documentBuilder = documentBuildersIndexedEntities.get( indexedType );
+ Similarity similarity = documentBuilder.getSimilarity();
+ Similarity prevSimilarity = directoryConfiguration.similarity;
+ if ( prevSimilarity != null && ! prevSimilarity.getClass().equals( similarity.getClass() ) ) {
+ throw new SearchException( "Multiple entities are sharing the same index but are declaring an " +
+ "inconsistent Similarity. When overrriding default Similarity make sure that all types sharing a same index " +
+ "declare the same Similarity implementation." );
+ }
+ else {
+ directoryConfiguration.similarity = similarity;
+ }
+ }
+ }
+ }
+
private ReflectionManager getReflectionManager(SearchConfiguration cfg) {
ReflectionManager reflectionManager = cfg.getReflectionManager();
if ( reflectionManager == null ) {
@@ -421,7 +441,7 @@
return analyzer;
}
- public Analyzer getAnalyzer(Class clazz) {
+ public Analyzer getAnalyzer(Class<?> clazz) {
if ( clazz == null ) {
throw new IllegalArgumentException( "A class has to be specified for retrieving a scoped analyzer" );
}
@@ -534,7 +554,8 @@
private static class DirectoryProviderData {
public final ReentrantLock dirLock = new ReentrantLock();
public OptimizerStrategy optimizerStrategy;
- public Set<Class<?>> classes = new HashSet<Class<?>>( 2 );
+ public final Set<Class<?>> classes = new HashSet<Class<?>>( 2 );
+ public Similarity similarity = null;
}
public ReentrantLock getDirectoryProviderLock(DirectoryProvider<?> dp) {
@@ -623,4 +644,13 @@
return idexedClasses;
}
}
+
+ public Similarity getSimilarity(DirectoryProvider<?> provider) {
+ if ( barrier != 0 ) {
+ } //read barrier
+ Similarity similarity = dirProviderData.get( provider ).similarity;
+ if ( similarity == null ) throw new SearchException( "Assertion error: a similarity should be defined for each provider" );
+ return similarity;
+ }
+
}
Added: search/trunk/src/test/java/org/hibernate/search/test/similarity/IllegalSimilarityConfigurationTest.java
===================================================================
--- search/trunk/src/test/java/org/hibernate/search/test/similarity/IllegalSimilarityConfigurationTest.java (rev 0)
+++ search/trunk/src/test/java/org/hibernate/search/test/similarity/IllegalSimilarityConfigurationTest.java 2009-10-27 19:27:02 UTC (rev 17851)
@@ -0,0 +1,102 @@
+/* $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
+ */
+package org.hibernate.search.test.similarity;
+
+import junit.framework.TestCase;
+
+import org.hibernate.search.test.util.FullTextSessionBuilder;
+
+public class IllegalSimilarityConfigurationTest extends TestCase {
+
+ public void testValidConfiguration() {
+ boolean configurationIsLegal = true;
+ try {
+ FullTextSessionBuilder builder = new FullTextSessionBuilder()
+ .addAnnotatedClass(Can.class)
+ .addAnnotatedClass(Trash.class).build();
+ builder.close();
+ } catch (Exception e) {
+ configurationIsLegal = false;
+ }
+ assertTrue( "A valid configuration could not be started.", configurationIsLegal );
+ }
+
+ public void testInconsistentSimilarityInClassHierarchy() {
+ boolean configurationIsLegal = true;
+ try {
+ FullTextSessionBuilder builder = new FullTextSessionBuilder()
+ .addAnnotatedClass( Trash.class )
+ .addAnnotatedClass( LittleTrash.class ).build();
+ builder.close();
+ } catch (Exception e) {
+ configurationIsLegal = false;
+ }
+ assertFalse( "Invalid Similarity declared, should have thrown an exception: same similarity"
+ + " must be used across class hierarchy", configurationIsLegal );
+ }
+
+ public void testInconsistentSimilarityInClassSharingAnIndex() {
+ boolean configurationIsLegal = true;
+ try {
+ FullTextSessionBuilder builder = new FullTextSessionBuilder()
+ .addAnnotatedClass( Trash.class )
+ .addAnnotatedClass( Sink.class ).build();
+ builder.close();
+ } catch (Exception e) {
+ configurationIsLegal = false;
+ }
+ assertFalse( "Invalid Similarity declared, should have thrown an exception: two entities"
+ + "sharing the same index are using a different similarity", configurationIsLegal );
+}
+
+ public void testImplicitSimilarityInheritanceIsValid() {
+ boolean configurationIsLegal = true;
+ try {
+ FullTextSessionBuilder builder = new FullTextSessionBuilder()
+ .addAnnotatedClass( Trash.class )
+ .addAnnotatedClass( ProperTrashExtension.class ).build();
+ builder.close();
+ } catch (Exception e) {
+ configurationIsLegal = false;
+ }
+ assertTrue( "Valid configuration could not be built", configurationIsLegal );
+}
+
+ public void testInvalidToOverrideParentsSimilarity() {
+ boolean configurationIsLegal = true;
+ try {
+ FullTextSessionBuilder builder = new FullTextSessionBuilder()
+ .addAnnotatedClass( Can.class )
+ .addAnnotatedClass( SmallerCan.class ).build();
+ builder.close();
+ } catch (Exception e) {
+ configurationIsLegal = false;
+ }
+ assertFalse( "Invalid Similarity declared, should have thrown an exception: child entity"
+ + " is overriding parent's Similarity", configurationIsLegal );
+ }
+
+}
+
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/similarity/IllegalSimilarityConfigurationTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ LF
Added: search/trunk/src/test/java/org/hibernate/search/test/similarity/LittleTrash.java
===================================================================
--- search/trunk/src/test/java/org/hibernate/search/test/similarity/LittleTrash.java (rev 0)
+++ search/trunk/src/test/java/org/hibernate/search/test/similarity/LittleTrash.java 2009-10-27 19:27:02 UTC (rev 17851)
@@ -0,0 +1,41 @@
+/* $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
+ */
+package org.hibernate.search.test.similarity;
+
+import javax.persistence.Entity;
+
+import org.hibernate.search.annotations.Similarity;
+
+/**
+ * @author Sanne Grinovero
+ */
+@Entity
+@Similarity(impl = DummySimilarity2.class)
+public class LittleTrash extends Trash {
+
+ //extends Trash, but declares a different similarity
+
+}
+
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/similarity/LittleTrash.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ LF
Added: search/trunk/src/test/java/org/hibernate/search/test/similarity/ProperTrashExtension.java
===================================================================
--- search/trunk/src/test/java/org/hibernate/search/test/similarity/ProperTrashExtension.java (rev 0)
+++ search/trunk/src/test/java/org/hibernate/search/test/similarity/ProperTrashExtension.java 2009-10-27 19:27:02 UTC (rev 17851)
@@ -0,0 +1,36 @@
+/* $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
+ */
+package org.hibernate.search.test.similarity;
+
+import org.hibernate.search.annotations.Indexed;
+
+@Indexed
+//Is inheriting: @Similarity(impl = DummySimilarity.class)
+public class ProperTrashExtension extends Trash {
+
+ //only needing a different type for testing purposes
+
+}
+
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/similarity/ProperTrashExtension.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ LF
Added: search/trunk/src/test/java/org/hibernate/search/test/similarity/Sink.java
===================================================================
--- search/trunk/src/test/java/org/hibernate/search/test/similarity/Sink.java (rev 0)
+++ search/trunk/src/test/java/org/hibernate/search/test/similarity/Sink.java 2009-10-27 19:27:02 UTC (rev 17851)
@@ -0,0 +1,67 @@
+/* $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
+ */
+package org.hibernate.search.test.similarity;
+
+import javax.persistence.Id;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Entity;
+
+import org.hibernate.search.annotations.Indexed;
+import org.hibernate.search.annotations.DocumentId;
+import org.hibernate.search.annotations.Field;
+import org.hibernate.search.annotations.Similarity;
+
+/**
+ * @author Sanne Grinovero
+ */
+@Entity
+@Indexed(index="garbageIndex")
+@Similarity(impl = DummySimilarity2.class)
+public class Sink {
+ @Id
+ @DocumentId
+ @GeneratedValue
+ private Integer id;
+
+ @Field
+ 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;
+ }
+}
+
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/similarity/Sink.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ LF
Added: search/trunk/src/test/java/org/hibernate/search/test/similarity/SmallerCan.java
===================================================================
--- search/trunk/src/test/java/org/hibernate/search/test/similarity/SmallerCan.java (rev 0)
+++ search/trunk/src/test/java/org/hibernate/search/test/similarity/SmallerCan.java 2009-10-27 19:27:02 UTC (rev 17851)
@@ -0,0 +1,40 @@
+/* $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
+ */
+package org.hibernate.search.test.similarity;
+
+import javax.persistence.Entity;
+
+import org.hibernate.search.annotations.Indexed;
+import org.hibernate.search.annotations.Similarity;
+
+@Entity
+@Indexed
+@Similarity(impl = DummySimilarity2.class)
+public class SmallerCan extends Can {
+
+ //illegal type: can't override a parent defined Similarity
+
+}
+
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/similarity/SmallerCan.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ LF
Modified: search/trunk/src/test/java/org/hibernate/search/test/similarity/Trash.java
===================================================================
--- search/trunk/src/test/java/org/hibernate/search/test/similarity/Trash.java 2009-10-27 18:49:25 UTC (rev 17850)
+++ search/trunk/src/test/java/org/hibernate/search/test/similarity/Trash.java 2009-10-27 19:27:02 UTC (rev 17851)
@@ -37,7 +37,7 @@
* @author Emmanuel Bernard
*/
@Entity
-@Indexed
+@Indexed(index="garbageIndex")
@Similarity(impl = DummySimilarity.class)
public class Trash {
@Id
Modified: search/trunk/src/test/java/org/hibernate/search/test/util/FullTextSessionBuilder.java
===================================================================
--- search/trunk/src/test/java/org/hibernate/search/test/util/FullTextSessionBuilder.java 2009-10-27 18:49:25 UTC (rev 17850)
+++ search/trunk/src/test/java/org/hibernate/search/test/util/FullTextSessionBuilder.java 2009-10-27 19:27:02 UTC (rev 17851)
@@ -50,7 +50,7 @@
private static final Logger log = org.hibernate.search.util.LoggerFactory.make();
- private static File indexDir;
+ private static final File indexDir;
private AnnotationConfiguration cfg;
private SessionFactory sessionFactory;
15 years, 4 months
Hibernate SVN: r17850 - in core/trunk/entitymanager: src/main/java/org/hibernate/ejb/metamodel and 1 other directories.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2009-10-27 14:49:25 -0400 (Tue, 27 Oct 2009)
New Revision: 17850
Modified:
core/trunk/entitymanager/pom.xml
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/MetadataContext.java
core/trunk/entitymanager/src/test/java/org/hibernate/ejb/criteria/CriteriaCompilingTest.java
Log:
HHH-4202 - Implement JPA 2.0 metamodel APIs
Modified: core/trunk/entitymanager/pom.xml
===================================================================
--- core/trunk/entitymanager/pom.xml 2009-10-27 15:05:44 UTC (rev 17849)
+++ core/trunk/entitymanager/pom.xml 2009-10-27 18:49:25 UTC (rev 17850)
@@ -1,32 +1,37 @@
-<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
<modelVersion>4.0.0</modelVersion>
+
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
<version>3.5.0-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
+
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<packaging>jar</packaging>
+
<name>Hibernate Entitity Manager</name>
<description>Hibernate Entitity Manager</description>
+
<!-- Annotations and Commons-Annotations both use the ANN JIRA key -->
<issueManagement>
<system>jira</system>
<url>http://opensource.atlassian.com/projects/hibernate/browse/ANN</url>
</issueManagement>
+
<dependencies>
<dependency>
- <groupId>org.hibernate</groupId>
+ <groupId>${project.groupId}</groupId>
<artifactId>hibernate-core</artifactId>
- <version>${version}</version>
+ <version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.hibernate</groupId>
+ <groupId>${project.groupId}</groupId>
<artifactId>hibernate-annotations</artifactId>
- <version>${version}</version>
+ <version>${project.version}</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
@@ -41,26 +46,41 @@
<artifactId>jpa-api</artifactId>
</dependency>
<dependency>
- <groupId>org.hibernate</groupId>
+ <!--
+ Only really needed for the antrun plugin defined below (which in turn is only really needed
+ to work around a missing feature on the compile plugin; lovely no?). However I have not
+ found a way to declare this dependency local to the antrun plugin and then reference it
+ from the <javac/>'s <classpath/> :(
+ -->
+ <groupId>${project.groupId}</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
- <version>1.0.0-Alpha1-SNAPSHOT</version>
+ <version>1.0.0-SNAPSHOT</version>
<scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <!-- Use the jpa-api defined here, crossing fingers they match up signature-wise -->
+ <groupId>org.hibernate.java-persistence</groupId>
+ <artifactId>jpa-api</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
</dependencies>
+
<dependencyManagement>
<dependencies>
<dependency>
- <groupId>org.hibernate</groupId>
+ <groupId>${project.groupId}</groupId>
<artifactId>hibernate-core</artifactId>
- <version>${version}</version>
+ <version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.hibernate</groupId>
+ <groupId>${project.groupId}</groupId>
<artifactId>hibernate-annotations</artifactId>
- <version>${version}</version>
+ <version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
+
<build>
<testResources>
<testResource>
@@ -70,8 +90,8 @@
<testResource>
<filtering>true</filtering>
<directory>src/test/bundles</directory>
- <targetPath>../bundles</targetPath>
- </testResource>
+ <targetPath>../bundles</targetPath>
+ </testResource>
</testResources>
<plugins>
<plugin>
@@ -84,73 +104,52 @@
<configuration>
<tasks>
<echo>processing JPA annotations</echo>
- <property name="target.dir" value="target/generated-jpamodel-classes"/>
+ <property name="target.dir" value="${project.build.directory}/generated-src/jpamodelgen"/>
<mkdir dir="${target.dir}"/>
- <javac srcdir="src/test/java" destdir="${target.dir}" failonerror="false" excludes="test/**" fork="true" executable="${jdk16_home}/bin/javac" target="1.5">
+ <javac srcdir="${project.build.testSourceDirectory}"
+ destdir="${target.dir}"
+ failonerror="false"
+ fork="true"
+ executable="${jdk16_home}/bin/javac"
+ target="1.5">
<compilerarg value="-proc:only"/>
<classpath>
<path refid="maven.test.classpath"/>
</classpath>
</javac>
</tasks>
- <sourceRoot>generate</sourceRoot>
+ <testSourceRoot>${project.build.directory}/generated-src/jpamodelgen</testSourceRoot>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
- <dependencies>
- <dependency>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant</artifactId>
- <version>1.7.0</version>
- </dependency>
- </dependencies>
</plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>package-tests</id>
+ <phase>process-test-classes</phase>
+ <configuration>
+ <tasks>
+ <property name="package.dir" value="${basedir}/target/test-packages" />
+ <property name="package.tmp.dir" value="${basedir}/target/tmp" />
+ <property name="classes.dir" value="${project.build.directory}/test-classes" />
+ <property name="testresources.dir" value="${basedir}/target/bundles" />
+ <ant antfile="${basedir}/build.xml">
+ <target name="package" />
+ </ant>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
<plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <version>1.3</version>
- <executions>
- <execution>
- <id>add-source</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-test-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>target/generated-jpamodel-classes</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>package-tests</id>
- <phase>process-test-classes</phase>
- <configuration>
- <tasks>
- <property name="package.dir" value="${basedir}/target/test-packages"/>
- <property name="package.tmp.dir" value="${basedir}/target/tmp"/>
- <property name="classes.dir" value="${project.build.directory}/test-classes"/>
- <property name="testresources.dir" value="${basedir}/target/bundles"/>
- <ant antfile="${basedir}/build.xml">
- <target name="package"/>
- </ant>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
@@ -170,79 +169,77 @@
</execution>
</executions>
</plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <forkMode>pertest</forkMode>
- <additionalClasspathElements>
- <additionalClasspathElement>${basedir}/target/test-packages/cfgxmlpar.par</additionalClasspathElement>
- <additionalClasspathElement>${basedir}/target/test-packages/defaultpar.par</additionalClasspathElement>
- <additionalClasspathElement>${basedir}/target/test-packages/excludehbmpar.par</additionalClasspathElement>
- <additionalClasspathElement>${basedir}/target/test-packages/explicitpar.par</additionalClasspathElement>
- <additionalClasspathElement>${basedir}/target/test-packages/explodedpar.par</additionalClasspathElement>
- <additionalClasspathElement>${basedir}/target/test-packages/externaljar.jar</additionalClasspathElement>
- <additionalClasspathElement>${basedir}/target/test-packages/nesteddir.ear</additionalClasspathElement>
- <additionalClasspathElement>${basedir}/target/test-packages/nestedjar.ear</additionalClasspathElement>
- <additionalClasspathElement>${basedir}/target/test-packages/overridenpar.jar</additionalClasspathElement>
- <additionalClasspathElement>${basedir}/target/test-packages/space par.par</additionalClasspathElement>
- <additionalClasspathElement>${basedir}/target/test-packages/war.war</additionalClasspathElement>
- </additionalClasspathElements>
- </configuration>
- </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <forkMode>pertest</forkMode>
+ <additionalClasspathElements>
+ <additionalClasspathElement>${basedir}/target/test-packages/cfgxmlpar.par</additionalClasspathElement>
+ <additionalClasspathElement>${basedir}/target/test-packages/defaultpar.par</additionalClasspathElement>
+ <additionalClasspathElement>${basedir}/target/test-packages/excludehbmpar.par</additionalClasspathElement>
+ <additionalClasspathElement>${basedir}/target/test-packages/explicitpar.par</additionalClasspathElement>
+ <additionalClasspathElement>${basedir}/target/test-packages/explodedpar.par</additionalClasspathElement>
+ <additionalClasspathElement>${basedir}/target/test-packages/externaljar.jar</additionalClasspathElement>
+ <additionalClasspathElement>${basedir}/target/test-packages/nesteddir.ear</additionalClasspathElement>
+ <additionalClasspathElement>${basedir}/target/test-packages/nestedjar.ear</additionalClasspathElement>
+ <additionalClasspathElement>${basedir}/target/test-packages/overridenpar.jar</additionalClasspathElement>
+ <additionalClasspathElement>${basedir}/target/test-packages/space par.par</additionalClasspathElement>
+ <additionalClasspathElement>${basedir}/target/test-packages/war.war</additionalClasspathElement>
+ </additionalClasspathElements>
+ </configuration>
+ </plugin>
</plugins>
</build>
+
<profiles>
- <profile>
+ <profile>
<id>doc</id>
<build>
<plugins>
<plugin>
<groupId>org.jboss.maven.plugins</groupId>
<artifactId>maven-jdocbook-plugin</artifactId>
- <version>2.2.0</version>
+ <version>2.1.0</version>
<extensions>true</extensions>
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jdocbook-style</artifactId>
- <version>2.0.0</version>
+ <version>1.0.2</version>
<type>jdocbook-style</type>
</dependency>
</dependencies>
<configuration>
<sourceDocumentName>master.xml</sourceDocumentName>
- <sourceDirectory>${basedir}/src/main/docbook</sourceDirectory>
- <masterTranslation>en</masterTranslation>
+ <sourceDirectory>${basedir}/src/main/docbook/en</sourceDirectory>
+ <masterTranslation>en-US</masterTranslation>
<imageResource>
<directory>${basedir}/src/main/docbook/en/images</directory>
</imageResource>
<formats>
<format>
<formatName>pdf</formatName>
- <stylesheetResource>classpath:/xslt/org/hibernate/jdocbook/xslt/pdf.xsl</stylesheetResource>
- <finalName>hibernate_reference.pdf</finalName>
+ <stylesheetResource>classpath:/xslt/hibernate/pdf/main-pdf.xsl</stylesheetResource>
+ <finalName>hibernate-validator-legacy-guide.pdf</finalName>
</format>
<format>
<formatName>html_single</formatName>
- <stylesheetResource>classpath:/xslt/org/hibernate/jdocbook/xslt/xhtml-single.xsl
- </stylesheetResource>
+ <stylesheetResource>classpath:/xslt/hibernate/html/main-single.xsl
+ </stylesheetResource>
<finalName>index.html</finalName>
</format>
<format>
<formatName>html</formatName>
- <stylesheetResource>classpath:/xslt/org/hibernate/jdocbook/xslt/xhtml.xsl
- </stylesheetResource>
+ <stylesheetResource>classpath:/xslt/hibernate/html/main-chunk.xsl
+ </stylesheetResource>
<finalName>index.html</finalName>
</format>
</formats>
<options>
<xincludeSupported>true</xincludeSupported>
- <xmlTransformerType>saxon</xmlTransformerType>
- <!-- needed for uri-resolvers; can be ommitted if using 'current' uri scheme -->
- <!-- could also locate the docbook dependency and inspect its version... -->
- <docbookVersion>1.72.0</docbookVersion>
<localeSeparator>-</localeSeparator>
+ <useRelativeImageUris>true</useRelativeImageUris>
</options>
</configuration>
<executions>
@@ -259,5 +256,6 @@
</plugins>
</build>
</profile>
- </profiles>
+ </profiles>
+
</project>
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/MetadataContext.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/MetadataContext.java 2009-10-27 15:05:44 UTC (rev 17849)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/MetadataContext.java 2009-10-27 18:49:25 UTC (rev 17850)
@@ -30,6 +30,7 @@
import java.util.Set;
import javax.persistence.metamodel.Attribute;
import javax.persistence.metamodel.SingularAttribute;
+import javax.persistence.MappedSuperclass;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Property;
@@ -40,6 +41,10 @@
* <p/>
* This contextual information includes data needing to be processed in a second pass as well as
* cross-references into the built metamodel classes.
+ * <p/>
+ * At the end of the day, clients are interested in the {@link #getEntityTypeMap} and {@link #getEmbeddableTypeMap}
+ * results, which represent all the registered {@link #registerEntityType entities} and
+ * {@link #registerEmbeddedableType embeddabled} respectively.
*
* @author Steve Ebersole
* @author Emmanuel Bernard
@@ -66,6 +71,29 @@
}
/**
+ * Retrieves the {@link Class java type} to {@link EntityType} map.
+ *
+ * @return The {@link Class java type} to {@link EntityType} map.
+ */
+ public Map<Class<?>, EntityTypeImpl<?>> getEntityTypeMap() {
+ return Collections.unmodifiableMap( entityTypes );
+ }
+
+ public Map<Class<?>, EmbeddableTypeImpl<?>> getEmbeddableTypeMap() {
+ return Collections.unmodifiableMap( embeddables );
+ }
+
+ /*package*/ void registerEntityType(PersistentClass persistentClass, EntityTypeImpl<?> entityType) {
+ entityTypes.put( entityType.getBindableJavaType(), entityType );
+ entityTypesByEntityName.put( persistentClass.getEntityName(), entityType );
+ entityTypesByPersistentClass.put( persistentClass, entityType );
+ }
+
+ /*package*/ void registerEmbeddedableType(EmbeddableTypeImpl<?> embeddableType) {
+ embeddables.put( embeddableType.getJavaType(), embeddableType );
+ }
+
+ /**
* Given a Hibernate {@link PersistentClass}, locate the corresponding JPA {@link org.hibernate.type.EntityType}
* implementation. May retur null if the given {@link PersistentClass} has not yet been processed.
*
@@ -98,29 +126,6 @@
return entityTypesByEntityName.get( entityName );
}
- /**
- * Retrieves the {@link Class java type} to {@link EntityType} map.
- *
- * @return The {@link Class java type} to {@link EntityType} map.
- */
- public Map<Class<?>, EntityTypeImpl<?>> getEntityTypeMap() {
- return Collections.unmodifiableMap( entityTypes );
- }
-
- /*package*/ void registerEntityType(PersistentClass persistentClass, EntityTypeImpl<?> entityType) {
- entityTypes.put( entityType.getBindableJavaType(), entityType );
- entityTypesByEntityName.put( persistentClass.getEntityName(), entityType );
- entityTypesByPersistentClass.put( persistentClass, entityType );
- }
-
- /*package*/ void registerEmbeddedableType(EmbeddableTypeImpl<?> embeddableType) {
- embeddables.put( embeddableType.getJavaType(), embeddableType );
- }
-
- public Map<Class<?>, EmbeddableTypeImpl<?>> getEmbeddableTypeMap() {
- return Collections.unmodifiableMap( embeddables );
- }
-
@SuppressWarnings({ "unchecked" })
public void wrapUp() {
// IMPL NOTE : entityTypesByPersistentClass is a insertion-ordered map, where the insertion order
@@ -135,7 +140,7 @@
entry.getValue().getBuilder().addAttribute( attribute );
}
entry.getValue().lock();
- // todo : find the X_ style metamodel classes, if present, and inject
+ populateStaticMetamodel( entry.getValue() );
}
}
@@ -171,4 +176,34 @@
return attributes;
}
+ private <X> void populateStaticMetamodel(AbstractManagedType<X> managedType) {
+ final Class<X> managedTypeClass = managedType.getJavaType();
+ final String metamodelClassName = managedTypeClass.getName() + "_";
+ try {
+ final Class metamodelClass = Class.forName( metamodelClassName, true, managedTypeClass.getClassLoader() );
+ // we found the class; so populate it...
+ registerAttributes( metamodelClass, managedType );
+ }
+ catch ( ClassNotFoundException ignore ) {
+ // nothing to do...
+ }
+
+ // todo : this does not account for @MappeSuperclass, mainly because this is not being tracked in our
+ // internal metamodel as populated from the annotatios properly
+ AbstractManagedType<? super X> superType = managedType.getSupertype();
+ if ( superType != null ) {
+ populateStaticMetamodel( superType );
+ }
+ }
+
+ private final Set<Class> processedMetamodelClasses = new HashSet<Class>();
+
+ private <X> void registerAttributes(Class metamodelClass, AbstractManagedType<X> managedType) {
+ if ( processedMetamodelClasses.add( metamodelClass ) ) {
+ return;
+ }
+
+ // push the attributes on to the metamodel class...
+ }
+
}
Modified: core/trunk/entitymanager/src/test/java/org/hibernate/ejb/criteria/CriteriaCompilingTest.java
===================================================================
--- core/trunk/entitymanager/src/test/java/org/hibernate/ejb/criteria/CriteriaCompilingTest.java 2009-10-27 15:05:44 UTC (rev 17849)
+++ core/trunk/entitymanager/src/test/java/org/hibernate/ejb/criteria/CriteriaCompilingTest.java 2009-10-27 18:49:25 UTC (rev 17850)
@@ -29,6 +29,11 @@
import javax.persistence.criteria.Join;
import org.hibernate.ejb.test.TestCase;
+import org.hibernate.ejb.test.callbacks.VideoSystem;
+import org.hibernate.ejb.test.callbacks.Television;
+import org.hibernate.ejb.test.callbacks.RemoteControl;
+import org.hibernate.ejb.test.inheritance.Fruit;
+import org.hibernate.ejb.test.inheritance.Strawberry;
/**
* TODO : javadoc
@@ -41,7 +46,14 @@
Customer.class,
Item.class,
Order.class,
- Product.class
+ Product.class,
+ // @Inheritance
+ Fruit.class,
+ Strawberry.class,
+ // @MappedSuperclass
+ VideoSystem.class,
+ Television.class,
+ RemoteControl.class
};
}
15 years, 4 months
Hibernate SVN: r17849 - in core/trunk/annotations/src: test/java/org/hibernate/test/annotations and 1 other directories.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-10-27 11:05:44 -0400 (Tue, 27 Oct 2009)
New Revision: 17849
Added:
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclass/
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclass/DomainAdmin.java
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclass/DomainAdminId.java
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclass/IdClassCompositePKTest.java
Modified:
core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationBinder.java
Log:
HHH-4528 - Applied patch (with minor cleanup)
Modified: core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationBinder.java
===================================================================
--- core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationBinder.java 2009-10-27 14:22:44 UTC (rev 17848)
+++ core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationBinder.java 2009-10-27 15:05:44 UTC (rev 17849)
@@ -127,6 +127,7 @@
import org.hibernate.annotations.common.reflection.ReflectionManager;
import org.hibernate.annotations.common.reflection.XAnnotatedElement;
import org.hibernate.annotations.common.reflection.XClass;
+import org.hibernate.annotations.common.reflection.XMethod;
import org.hibernate.annotations.common.reflection.XPackage;
import org.hibernate.annotations.common.reflection.XProperty;
import org.hibernate.cfg.annotations.CollectionBinder;
@@ -714,9 +715,10 @@
//process idclass if any
Set<String> idProperties = new HashSet<String>();
IdClass idClass = null;
+ XClass current = null;
if ( !inheritanceState.hasParents ) {
//look for idClass
- XClass current = inheritanceState.clazz;
+ current = inheritanceState.clazz;
InheritanceState state = inheritanceState;
do {
current = state.clazz;
@@ -740,6 +742,9 @@
PropertyData inferredData = new PropertyPreloadedData(
entityBinder.getPropertyAccessor(), "id", compositeClass
);
+ PropertyData baseInferredData = new PropertyPreloadedData(
+ entityBinder.getPropertyAccessor(), "id", current
+ );
HashMap<String, IdGenerator> localGenerators = new HashMap<String, IdGenerator>();
boolean ignoreIdAnnotations = entityBinder.isIgnoreIdAnnotations();
entityBinder.setIgnoreIdAnnotations( true );
@@ -747,6 +752,7 @@
generatorType,
generator,
inferredData,
+ baseInferredData,
null,
propertyHolder,
localGenerators,
@@ -762,6 +768,7 @@
Component mapper = fillComponent(
propertyHolder,
inferredData,
+ baseInferredData,
propertyAnnotated,
propertyAccessor, false,
entityBinder,
@@ -1941,6 +1948,17 @@
EntityBinder entityBinder,
boolean isComponentEmbedded, boolean isIdentifierMapper, boolean inSecondPass, ExtendedMappings mappings
) {
+
+ return fillComponent(propertyHolder, inferredData, null, propertyAnnotated, propertyAccessor, isNullable, entityBinder, isComponentEmbedded, isIdentifierMapper, inSecondPass, mappings);
+ }
+
+ public static Component fillComponent(
+ PropertyHolder propertyHolder, PropertyData inferredData, PropertyData baseInferredData,
+ boolean propertyAnnotated, String propertyAccessor, boolean isNullable,
+ EntityBinder entityBinder,
+ boolean isComponentEmbedded, boolean isIdentifierMapper, boolean inSecondPass, ExtendedMappings mappings
+ ) {
+
/**
* inSecondPass can only be used to apply right away the second pass of a composite-element
* Because it's a value type, there is no bidirectional association, hence second pass
@@ -1963,8 +1981,29 @@
comp, subpath,
inferredData, propertyHolder, mappings
);
+
List<PropertyData> classElements = new ArrayList<PropertyData>();
XClass returnedClassOrElement = inferredData.getClassOrElement();
+
+ List<PropertyData> baseClassElements = null;
+ XClass baseReturnedClassOrElement;
+ PropertyHolder baseSubHolder;
+ if(baseInferredData != null)
+ {
+ baseSubHolder = PropertyHolderBuilder.buildPropertyHolder(
+ comp, subpath,
+ inferredData, propertyHolder, mappings
+ );
+ baseClassElements = new ArrayList<PropertyData>();
+ baseReturnedClassOrElement = baseInferredData.getClassOrElement();
+ bindTypeDefs(baseReturnedClassOrElement, mappings);
+ addElementsOfAClass(
+ baseClassElements,
+ baseSubHolder,
+ propertyAnnotated,
+ propertyAccessor, baseReturnedClassOrElement, mappings
+ );
+ }
//embeddable elements can have type defs
bindTypeDefs(returnedClassOrElement, mappings);
@@ -1986,6 +2025,16 @@
);
superClass = superClass.getSuperclass();
}
+ if(baseClassElements != null)
+ {
+ if(!hasIdClassAnnotations(inferredData.getPropertyClass()))
+ {
+ for(int i=0; i < classElements.size(); i++)
+ {
+ classElements.set(i, baseClassElements.get(i)); //this works since they are in the same order
+ }
+ }
+ }
for (PropertyData propertyAnnotatedElement : classElements) {
processElementAnnotations(
subHolder, isNullable ?
@@ -2008,6 +2057,20 @@
String propertyAccessor, EntityBinder entityBinder, boolean isEmbedded,
boolean isIdentifierMapper, ExtendedMappings mappings
) {
+
+ bindId(generatorType, generatorName, inferredData, null, columns, propertyHolder, localGenerators, isComposite, isPropertyAnnotated, propertyAccessor, entityBinder, isEmbedded, isIdentifierMapper, mappings);
+ }
+
+ private static void bindId(
+ String generatorType, String generatorName, PropertyData inferredData,
+ PropertyData baseInferredData, Ejb3Column[] columns, PropertyHolder propertyHolder,
+ Map<String, IdGenerator> localGenerators,
+ boolean isComposite,
+ boolean isPropertyAnnotated,
+ String propertyAccessor, EntityBinder entityBinder, boolean isEmbedded,
+ boolean isIdentifierMapper, ExtendedMappings mappings
+ ) {
+
/*
* Fill simple value and property since and Id is a property
*/
@@ -2025,7 +2088,7 @@
SimpleValue id;
if ( isComposite ) {
id = fillComponent(
- propertyHolder, inferredData, isPropertyAnnotated, propertyAccessor,
+ propertyHolder, inferredData, baseInferredData, isPropertyAnnotated, propertyAccessor,
false, entityBinder, isEmbedded, isIdentifierMapper, false, mappings
);
Component componentId = (Component) id;
@@ -2474,4 +2537,32 @@
}
return inheritanceStatePerClass;
}
+
+ private static boolean hasIdClassAnnotations(XClass idClass)
+ {
+ if(idClass.getAnnotation(Embeddable.class) != null)
+ return true;
+
+ List<XProperty> properties = idClass.getDeclaredProperties( XClass.ACCESS_FIELD );
+ for ( XProperty property : properties ) {
+ if ( property.isAnnotationPresent( Column.class ) || property.isAnnotationPresent( OneToMany.class ) ||
+ property.isAnnotationPresent( ManyToOne.class ) || property.isAnnotationPresent( Id.class ) ||
+ property.isAnnotationPresent( GeneratedValue.class ) || property.isAnnotationPresent( OneToOne.class ) ||
+ property.isAnnotationPresent( ManyToMany.class )
+ ) {
+ return true;
+ }
+ }
+ List<XMethod> methods = idClass.getDeclaredMethods();
+ for ( XMethod method : methods ) {
+ if ( method.isAnnotationPresent( Column.class ) || method.isAnnotationPresent( OneToMany.class ) ||
+ method.isAnnotationPresent( ManyToOne.class ) || method.isAnnotationPresent( Id.class ) ||
+ method.isAnnotationPresent( GeneratedValue.class ) || method.isAnnotationPresent( OneToOne.class ) ||
+ method.isAnnotationPresent( ManyToMany.class )
+ ) {
+ return true;
+ }
+ }
+ return false;
+ }
}
Added: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclass/DomainAdmin.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclass/DomainAdmin.java (rev 0)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclass/DomainAdmin.java 2009-10-27 15:05:44 UTC (rev 17849)
@@ -0,0 +1,84 @@
+// $Id$
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.hibernate.test.annotations.idclass;
+
+import java.io.Serializable;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.NamedNativeQuery;
+import javax.persistence.Table;
+
+
+/**
+ * A DomainAdmin.
+ *
+ * @author <a href="mailto:stale.pedersen@jboss.org">Stale W. Pedersen</a>
+ */
+@Entity
+@Table(name = "domainadmin")
+(a)IdClass(DomainAdminId.class)
+@NamedNativeQuery(name = "DomainAdmin.testQuery",
+ query = "select * from domainadmin da where da.domain_name = 'org'",
+ resultClass = org.hibernate.test.annotations.idclass.DomainAdmin.class)
+public class DomainAdmin implements Serializable {
+
+ @Id
+ @Column(name = "domain_name")
+ private String domainName;
+
+ @Id
+ @Column(name = "admin_user")
+ private String adminUser;
+
+ @Column(name = "nick_name")
+ private String nickName;
+
+ public DomainAdmin() {
+ }
+
+ public String getDomainName() {
+ return domainName;
+ }
+
+ public void setDomainName(String domainName) {
+ this.domainName = domainName;
+ }
+
+ public String getAdminUser() {
+ return adminUser;
+ }
+
+ public void setAdminUser(String adminUser) {
+ this.adminUser = adminUser;
+ }
+
+ public String getNickName() {
+ return nickName;
+ }
+
+ public void setNickName(String nickName) {
+ this.nickName = nickName;
+ }
+}
\ No newline at end of file
Property changes on: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclass/DomainAdmin.java
___________________________________________________________________
Name: svn:keywords
+ Id
Added: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclass/DomainAdminId.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclass/DomainAdminId.java (rev 0)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclass/DomainAdminId.java 2009-10-27 15:05:44 UTC (rev 17849)
@@ -0,0 +1,73 @@
+// $Id$
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.hibernate.test.annotations.idclass;
+
+import java.io.Serializable;
+
+/**
+ * A DomainAdminId.
+ *
+ * @author <a href="mailto:stale.pedersen@jboss.org">Stale W. Pedersen</a>
+ */
+@SuppressWarnings("serial")
+public class DomainAdminId implements Serializable {
+
+ private String domainName;
+
+ private String adminUser;
+
+ public DomainAdminId() {
+ }
+
+ public DomainAdminId(String domainName, String adminUser) {
+ this.domainName = domainName;
+ this.adminUser = adminUser;
+ }
+
+ public String getDomainName() {
+ return domainName;
+ }
+
+ public void setDomainName(String domainName) {
+ this.domainName = domainName;
+ }
+
+ public String getAdminUser() {
+ return adminUser;
+ }
+
+ public void setAdminUser(String adminUser) {
+ this.adminUser = adminUser;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return ( ( o instanceof DomainAdminId ) && domainName.equals( ( ( DomainAdminId ) o ).getDomainName() ) &&
+ adminUser.equals( ( ( DomainAdminId ) o ).getAdminUser() ) );
+ }
+
+ @Override
+ public int hashCode() {
+ return ( domainName + adminUser ).hashCode();
+ }
+}
\ No newline at end of file
Property changes on: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclass/DomainAdminId.java
___________________________________________________________________
Name: svn:keywords
+ Id
Added: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclass/IdClassCompositePKTest.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclass/IdClassCompositePKTest.java (rev 0)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclass/IdClassCompositePKTest.java 2009-10-27 15:05:44 UTC (rev 17849)
@@ -0,0 +1,58 @@
+// $Id$
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.hibernate.test.annotations.idclass;
+
+import org.hibernate.Query;
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+import org.hibernate.test.annotations.TestCase;
+
+/**
+ * A IdClassTestCase.
+ *
+ * @author <a href="mailto:stale.pedersen@jboss.org">Stale W. Pedersen</a>
+ * @version $Revision: 1.1 $
+ */
+public class IdClassCompositePKTest extends TestCase {
+
+ public void testEntityMappningPropertiesAreNotIgnored() {
+ Session s = openSession();
+ Transaction tx = s.beginTransaction();
+ DomainAdmin da = new DomainAdmin();
+ da.setAdminUser( "admin" );
+ da.setDomainName( "org" );
+
+ s.persist( da );
+ Query q = s.getNamedQuery( "DomainAdmin.testQuery" );
+ assertEquals( 1, q.list().size() );
+
+ tx.rollback();
+ s.close();
+ }
+
+ protected Class[] getMappings() {
+ return new Class[] {
+ DomainAdmin.class
+ };
+ }
+}
Property changes on: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclass/IdClassCompositePKTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
15 years, 4 months
Hibernate SVN: r17848 - in jpamodelgen/trunk: src/test/java/test and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2009-10-27 10:22:44 -0400 (Tue, 27 Oct 2009)
New Revision: 17848
Modified:
jpamodelgen/trunk/
jpamodelgen/trunk/pom.xml
jpamodelgen/trunk/src/test/java/test/AccessTypeTest.java
jpamodelgen/trunk/src/test/java/test/QueryTest.java
Log:
updated to jpa-api 2.0-cr-1;
cleaned up pom and got it working on non-MacOS systems
Property changes on: jpamodelgen/trunk
___________________________________________________________________
Name: svn:ignore
- target
+ build
target
local
*.ipr
*.iws
*.iml
.classpath
.project
.settings
.nbattrs
*.log
*.properties
.clover
atlassian-ide-plugin.xml
Modified: jpamodelgen/trunk/pom.xml
===================================================================
--- jpamodelgen/trunk/pom.xml 2009-10-27 09:39:38 UTC (rev 17847)
+++ jpamodelgen/trunk/pom.xml 2009-10-27 14:22:44 UTC (rev 17848)
@@ -1,14 +1,45 @@
<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-jpamodelgen</artifactId>
- <version>1.0.0-Alpha1-SNAPSHOT</version>
- <name>JPA Model Generator</name>
+ <version>1.0.0-SNAPSHOT</version>
- <description> Annotation Processor to cenerate metadata model for JPA2 typesafe queries </description>
+ <name>JPA 2 Static-Metamodel Generator</name>
+ <description>Annotation Processor to generate JPA 2 static metamodel classes</description>
+ <inceptionYear>2009</inceptionYear>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.hibernate.java-persistence</groupId>
+ <artifactId>jpa-api</artifactId>
+ <version>2.0-cr-1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>5.8</version>
+ <classifier>jdk15</classifier>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <licenses>
+ <license>
+ <name>Apache License, Version 2.0</name>
+ <url>license.txt</url>
+ </license>
+ </licenses>
+
+ <scm>
+ <connection>scm:svn:https://svn.jboss.org/repos/hibernate/jpamodelgen/trunk</connection>
+ <url>http://fisheye.jboss.org/browse/Hibernate/jpamodelgen/trunk</url>
+ </scm>
+
<developers>
<developer>
<id>epbernard</id>
@@ -31,22 +62,9 @@
</developer>
</developers>
- <dependencies>
- <dependency>
- <groupId>org.hibernate.java-persistence</groupId>
- <artifactId>jpa-api</artifactId>
- <version>2.0.Beta3-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.testng</groupId>
- <artifactId>testng</artifactId>
- <version>5.8</version>
- <classifier>jdk15</classifier>
- <scope>test</scope>
- </dependency>
- </dependencies>
<build>
<defaultGoal>test</defaultGoal>
+
<resources>
<resource>
<directory>src/main/resources</directory>
@@ -55,6 +73,7 @@
<directory>src/main/xsd</directory>
</resource>
</resources>
+
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -75,53 +94,31 @@
<phase>process-test-resources</phase>
<configuration>
<tasks>
- <property name="target.dir" value="target/generated-query-classes"/>
+ <property name="build.compiler" value="extJavac"/>
+ <property name="target.dir" value="${project.build.directory}/generated-src/jpamodelgen"/>
<mkdir dir="${target.dir}"/>
- <javac srcdir="src/test/java" destdir="${target.dir}"
- failonerror="false" excludes="test/**">
+ <javac srcdir="${project.build.testSourceDirectory}"
+ destdir="${target.dir}"
+ failonerror="false"
+ excludes="test/**">
<compilerarg value="-proc:only"/>
<classpath>
<path refid="maven.test.classpath"/>
</classpath>
</javac>
</tasks>
- <sourceRoot>generate</sourceRoot>
+ <testSourceRoot>${project.build.directory}/generated-src/jpamodelgen</testSourceRoot>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
- <dependencies>
- <dependency>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant</artifactId>
- <version>1.7.0</version>
- </dependency>
- </dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <version>1.3</version>
- <executions>
- <execution>
- <id>add-source</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-test-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>target/generated-query-classes</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
+ <version>1.2</version>
<executions>
<execution>
<goals>
@@ -231,29 +228,32 @@
</configuration>
</plugin>
</plugins>
+
+ <extensions>
+ <!-- scm based deployments (jboss release repo) -->
+ <extension>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-scm</artifactId>
+ <version>1.0-beta-6</version>
+ </extension>
+ <extension>
+ <groupId>org.apache.maven.scm</groupId>
+ <artifactId>maven-scm-manager-plexus</artifactId>
+ <version>1.0</version>
+ </extension>
+ <extension>
+ <groupId>org.apache.maven.scm</groupId>
+ <artifactId>maven-scm-provider-svnexe</artifactId>
+ <version>1.0</version>
+ </extension>
+ </extensions>
</build>
- <inceptionYear>2009</inceptionYear>
-
- <licenses>
- <license>
- <name>Apache License, Version 2.0</name>
- <url>license.txt</url>
- </license>
- </licenses>
-
- <scm>
- <connection>scm:svn:https://svn.jboss.org/repos/hibernate/jpamodelgen/trunk</connection>
- <url>http://fisheye.jboss.org/browse/Hibernate/jpamodelgen/trunk</url>
- </scm>
-
<distributionManagement>
<repository>
- <!-- Copy the dist to the local checkout of the JBoss maven2 repo ${maven.repository.root} -->
- <!-- It is anticipated that ${maven.repository.root} be set in user's settings.xml -->
- <!-- todo : replace this with direct svn access once the svnkit providers are available -->
<id>repository.jboss.org</id>
- <url>file://${maven.repository.root}</url>
+ <name>JBoss Release Repository</name>
+ <url>scm:svn:https://svn.jboss.org/repos/repository.jboss.org/maven2</url>
</repository>
<snapshotRepository>
<id>snapshots.jboss.org</id>
Modified: jpamodelgen/trunk/src/test/java/test/AccessTypeTest.java
===================================================================
--- jpamodelgen/trunk/src/test/java/test/AccessTypeTest.java 2009-10-27 09:39:38 UTC (rev 17847)
+++ jpamodelgen/trunk/src/test/java/test/AccessTypeTest.java 2009-10-27 14:22:44 UTC (rev 17848)
@@ -17,11 +17,7 @@
*/
package test;
-import java.lang.reflect.Field;
-
import org.testng.annotations.Test;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
import org.testng.Assert;
/**
@@ -88,7 +84,7 @@
private boolean isFieldHere(String className, String fieldName) throws ClassNotFoundException {
Class<?> user_ = Class.forName( className );
try {
- final Field field = user_.getField( fieldName );
+ user_.getField( fieldName );
return true;
}
catch (NoSuchFieldException e) {
Modified: jpamodelgen/trunk/src/test/java/test/QueryTest.java
===================================================================
--- jpamodelgen/trunk/src/test/java/test/QueryTest.java 2009-10-27 09:39:38 UTC (rev 17847)
+++ jpamodelgen/trunk/src/test/java/test/QueryTest.java 2009-10-27 14:22:44 UTC (rev 17848)
@@ -21,13 +21,13 @@
import java.util.Date;
import java.util.Set;
import javax.persistence.Tuple;
+import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Expression;
import javax.persistence.criteria.Join;
import static javax.persistence.criteria.JoinType.INNER;
import javax.persistence.criteria.ListJoin;
import javax.persistence.criteria.Path;
-import javax.persistence.criteria.QueryBuilder;
import javax.persistence.criteria.Root;
import model.Item;
@@ -50,7 +50,7 @@
*/
public class QueryTest {
- QueryBuilder qb;
+ CriteriaBuilder qb;
public void test() {
CriteriaQuery<Tuple> q = qb.createTupleQuery();
15 years, 4 months
Hibernate SVN: r17847 - in core/trunk/entitymanager: src/main/docbook/en/images and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-10-27 05:39:38 -0400 (Tue, 27 Oct 2009)
New Revision: 17847
Removed:
core/trunk/entitymanager/src/main/docbook/en/images/hibernate_logo_a.png
Modified:
core/trunk/entitymanager/pom.xml
Log:
HHH-4530
Modified: core/trunk/entitymanager/pom.xml
===================================================================
--- core/trunk/entitymanager/pom.xml 2009-10-27 09:36:55 UTC (rev 17846)
+++ core/trunk/entitymanager/pom.xml 2009-10-27 09:39:38 UTC (rev 17847)
@@ -1,27 +1,22 @@
+<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
<modelVersion>4.0.0</modelVersion>
-
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
<version>3.5.0-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
-
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<packaging>jar</packaging>
-
<name>Hibernate Entitity Manager</name>
<description>Hibernate Entitity Manager</description>
-
<!-- Annotations and Commons-Annotations both use the ANN JIRA key -->
<issueManagement>
<system>jira</system>
<url>http://opensource.atlassian.com/projects/hibernate/browse/ANN</url>
</issueManagement>
-
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
@@ -50,9 +45,8 @@
<artifactId>hibernate-jpamodelgen</artifactId>
<version>1.0.0-Alpha1-SNAPSHOT</version>
<scope>test</scope>
- </dependency>
+ </dependency>
</dependencies>
-
<dependencyManagement>
<dependencies>
<dependency>
@@ -67,7 +61,6 @@
</dependency>
</dependencies>
</dependencyManagement>
-
<build>
<testResources>
<testResource>
@@ -77,8 +70,8 @@
<testResource>
<filtering>true</filtering>
<directory>src/test/bundles</directory>
- <targetPath>../bundles</targetPath>
- </testResource>
+ <targetPath>../bundles</targetPath>
+ </testResource>
</testResources>
<plugins>
<plugin>
@@ -93,8 +86,7 @@
<echo>processing JPA annotations</echo>
<property name="target.dir" value="target/generated-jpamodel-classes"/>
<mkdir dir="${target.dir}"/>
- <javac srcdir="src/test/java" destdir="${target.dir}"
- failonerror="false" excludes="test/**" fork="true" executable="${jdk16_home}/bin/javac" target="1.5">
+ <javac srcdir="src/test/java" destdir="${target.dir}" failonerror="false" excludes="test/**" fork="true" executable="${jdk16_home}/bin/javac" target="1.5">
<compilerarg value="-proc:only"/>
<classpath>
<path refid="maven.test.classpath"/>
@@ -135,30 +127,30 @@
</execution>
</executions>
</plugin>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>package-tests</id>
- <phase>process-test-classes</phase>
- <configuration>
- <tasks>
- <property name="package.dir" value="${basedir}/target/test-packages" />
- <property name="package.tmp.dir" value="${basedir}/target/tmp" />
- <property name="classes.dir" value="${project.build.directory}/test-classes" />
- <property name="testresources.dir" value="${basedir}/target/bundles" />
- <ant antfile="${basedir}/build.xml">
- <target name="package" />
- </ant>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
<plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>package-tests</id>
+ <phase>process-test-classes</phase>
+ <configuration>
+ <tasks>
+ <property name="package.dir" value="${basedir}/target/test-packages"/>
+ <property name="package.tmp.dir" value="${basedir}/target/tmp"/>
+ <property name="classes.dir" value="${project.build.directory}/test-classes"/>
+ <property name="testresources.dir" value="${basedir}/target/bundles"/>
+ <ant antfile="${basedir}/build.xml">
+ <target name="package"/>
+ </ant>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
@@ -178,77 +170,79 @@
</execution>
</executions>
</plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <forkMode>pertest</forkMode>
- <additionalClasspathElements>
- <additionalClasspathElement>${basedir}/target/test-packages/cfgxmlpar.par</additionalClasspathElement>
- <additionalClasspathElement>${basedir}/target/test-packages/defaultpar.par</additionalClasspathElement>
- <additionalClasspathElement>${basedir}/target/test-packages/excludehbmpar.par</additionalClasspathElement>
- <additionalClasspathElement>${basedir}/target/test-packages/explicitpar.par</additionalClasspathElement>
- <additionalClasspathElement>${basedir}/target/test-packages/explodedpar.par</additionalClasspathElement>
- <additionalClasspathElement>${basedir}/target/test-packages/externaljar.jar</additionalClasspathElement>
- <additionalClasspathElement>${basedir}/target/test-packages/nesteddir.ear</additionalClasspathElement>
- <additionalClasspathElement>${basedir}/target/test-packages/nestedjar.ear</additionalClasspathElement>
- <additionalClasspathElement>${basedir}/target/test-packages/overridenpar.jar</additionalClasspathElement>
- <additionalClasspathElement>${basedir}/target/test-packages/space par.par</additionalClasspathElement>
- <additionalClasspathElement>${basedir}/target/test-packages/war.war</additionalClasspathElement>
- </additionalClasspathElements>
- </configuration>
- </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <forkMode>pertest</forkMode>
+ <additionalClasspathElements>
+ <additionalClasspathElement>${basedir}/target/test-packages/cfgxmlpar.par</additionalClasspathElement>
+ <additionalClasspathElement>${basedir}/target/test-packages/defaultpar.par</additionalClasspathElement>
+ <additionalClasspathElement>${basedir}/target/test-packages/excludehbmpar.par</additionalClasspathElement>
+ <additionalClasspathElement>${basedir}/target/test-packages/explicitpar.par</additionalClasspathElement>
+ <additionalClasspathElement>${basedir}/target/test-packages/explodedpar.par</additionalClasspathElement>
+ <additionalClasspathElement>${basedir}/target/test-packages/externaljar.jar</additionalClasspathElement>
+ <additionalClasspathElement>${basedir}/target/test-packages/nesteddir.ear</additionalClasspathElement>
+ <additionalClasspathElement>${basedir}/target/test-packages/nestedjar.ear</additionalClasspathElement>
+ <additionalClasspathElement>${basedir}/target/test-packages/overridenpar.jar</additionalClasspathElement>
+ <additionalClasspathElement>${basedir}/target/test-packages/space par.par</additionalClasspathElement>
+ <additionalClasspathElement>${basedir}/target/test-packages/war.war</additionalClasspathElement>
+ </additionalClasspathElements>
+ </configuration>
+ </plugin>
</plugins>
</build>
-
<profiles>
- <profile>
+ <profile>
<id>doc</id>
<build>
<plugins>
<plugin>
<groupId>org.jboss.maven.plugins</groupId>
<artifactId>maven-jdocbook-plugin</artifactId>
- <version>2.1.0</version>
+ <version>2.2.0</version>
<extensions>true</extensions>
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jdocbook-style</artifactId>
- <version>1.0.2</version>
+ <version>2.0.0</version>
<type>jdocbook-style</type>
</dependency>
</dependencies>
<configuration>
<sourceDocumentName>master.xml</sourceDocumentName>
- <sourceDirectory>${basedir}/src/main/docbook/en</sourceDirectory>
- <masterTranslation>en-US</masterTranslation>
+ <sourceDirectory>${basedir}/src/main/docbook</sourceDirectory>
+ <masterTranslation>en</masterTranslation>
<imageResource>
<directory>${basedir}/src/main/docbook/en/images</directory>
</imageResource>
<formats>
<format>
<formatName>pdf</formatName>
- <stylesheetResource>classpath:/xslt/hibernate/pdf/main-pdf.xsl</stylesheetResource>
- <finalName>hibernate-validator-legacy-guide.pdf</finalName>
+ <stylesheetResource>classpath:/xslt/org/hibernate/jdocbook/xslt/pdf.xsl</stylesheetResource>
+ <finalName>hibernate_reference.pdf</finalName>
</format>
<format>
<formatName>html_single</formatName>
- <stylesheetResource>classpath:/xslt/hibernate/html/main-single.xsl
- </stylesheetResource>
+ <stylesheetResource>classpath:/xslt/org/hibernate/jdocbook/xslt/xhtml-single.xsl
+ </stylesheetResource>
<finalName>index.html</finalName>
</format>
<format>
<formatName>html</formatName>
- <stylesheetResource>classpath:/xslt/hibernate/html/main-chunk.xsl
- </stylesheetResource>
+ <stylesheetResource>classpath:/xslt/org/hibernate/jdocbook/xslt/xhtml.xsl
+ </stylesheetResource>
<finalName>index.html</finalName>
</format>
</formats>
<options>
<xincludeSupported>true</xincludeSupported>
+ <xmlTransformerType>saxon</xmlTransformerType>
+ <!-- needed for uri-resolvers; can be ommitted if using 'current' uri scheme -->
+ <!-- could also locate the docbook dependency and inspect its version... -->
+ <docbookVersion>1.72.0</docbookVersion>
<localeSeparator>-</localeSeparator>
- <useRelativeImageUris>true</useRelativeImageUris>
</options>
</configuration>
<executions>
@@ -265,6 +259,5 @@
</plugins>
</build>
</profile>
- </profiles>
-
+ </profiles>
</project>
Deleted: core/trunk/entitymanager/src/main/docbook/en/images/hibernate_logo_a.png
===================================================================
(Binary files differ)
15 years, 4 months