Hibernate SVN: r18749 - core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclassgeneratedvalue.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-02-09 14:55:48 -0500 (Tue, 09 Feb 2010)
New Revision: 18749
Modified:
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclassgeneratedvalue/IdClassGeneratedValueTest.java
Log:
removed commented-out code
Modified: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclassgeneratedvalue/IdClassGeneratedValueTest.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclassgeneratedvalue/IdClassGeneratedValueTest.java 2010-02-09 19:54:39 UTC (rev 18748)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclassgeneratedvalue/IdClassGeneratedValueTest.java 2010-02-09 19:55:48 UTC (rev 18749)
@@ -109,49 +109,8 @@
s.close();
}
-// public void testComplexIdClass() {
-// Session s = openSession();
-// Transaction tx = s.beginTransaction();
-//
-// Customer c1 = new Customer(
-// "foo", "bar", "contact1", "100", new BigDecimal( 1000 ), new BigDecimal( 1000 ), new BigDecimal( 1000 )
-// );
-//
-// s.persist( c1 );
-// Item boat = new Item();
-// boat.setId( "1" );
-// boat.setName( "cruiser" );
-// boat.setPrice( new BigDecimal( 500 ) );
-// boat.setDescription( "a boat" );
-// boat.setCategory( 42 );
-//
-// s.persist( boat );
-// s.flush();
-// s.clear();
-//
-// c1.addInventory( boat, 10, new BigDecimal( 5000 ) );
-// s.merge( c1 );
-// s.flush();
-// s.clear();
-//
-// Customer c2 = (Customer) s.createQuery( "select c from Customer c" ).uniqueResult();
-//
-// List<CustomerInventory> inventory = c2.getInventories();
-//
-// assertEquals( 1, inventory.size() );
-// assertEquals( 10, inventory.get( 0 ).getQuantity() );
-//
-// tx.rollback();
-// s.close();
-//
-// assertTrue( true );
-// }
-
protected Class[] getAnnotatedClasses() {
return new Class[] {
-// Customer.class,
-// CustomerInventory.class,
-// Item.class,
Simple.class,
Simple2.class,
Multiple.class
16 years, 2 months
Hibernate SVN: r18748 - in core/trunk: core/src/main/java/org/hibernate/cfg and 2 other directories.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-02-09 14:54:39 -0500 (Tue, 09 Feb 2010)
New Revision: 18748
Added:
core/trunk/core/src/main/java/org/hibernate/id/IdentifierGeneratorAggregator.java
Modified:
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclassgeneratedvalue/Multiple.java
core/trunk/core/src/main/java/org/hibernate/cfg/Configuration.java
core/trunk/core/src/main/java/org/hibernate/id/CompositeNestedGeneratedValueGenerator.java
core/trunk/core/src/main/java/org/hibernate/mapping/Component.java
Log:
HHH-4894 - Process composite-id sub-generators PersistentIdentifierGenerator contract(s)
Modified: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclassgeneratedvalue/Multiple.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclassgeneratedvalue/Multiple.java 2010-02-09 19:22:10 UTC (rev 18747)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclassgeneratedvalue/Multiple.java 2010-02-09 19:54:39 UTC (rev 18748)
@@ -27,8 +27,10 @@
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.IdClass;
+import javax.persistence.SequenceGenerator;
import org.hibernate.annotations.GenericGenerator;
@@ -48,8 +50,8 @@
private Long id1;
@Id
- @GenericGenerator(name = "increment2", strategy = "increment")
- @GeneratedValue(generator = "increment2")
+ @GeneratedValue(generator = "MULTIPLE_SEQ", strategy = GenerationType.SEQUENCE)
+ @SequenceGenerator( name = "MULTIPLE_SEQ", sequenceName = "MULTIPLE_SEQ")
private Long id2;
@Id
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/Configuration.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/Configuration.java 2010-02-09 19:22:10 UTC (rev 18747)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/Configuration.java 2010-02-09 19:54:39 UTC (rev 18748)
@@ -67,6 +67,7 @@
import org.hibernate.SessionFactory;
import org.hibernate.SessionFactoryObserver;
import org.hibernate.DuplicateMappingException;
+import org.hibernate.id.IdentifierGeneratorAggregator;
import org.hibernate.tuple.entity.EntityTuplizerFactory;
import org.hibernate.dialect.Dialect;
import org.hibernate.dialect.MySQLDialect;
@@ -800,6 +801,9 @@
if ( ig instanceof PersistentIdentifierGenerator ) {
generators.put( ( (PersistentIdentifierGenerator) ig ).generatorKey(), ig );
}
+ else if ( ig instanceof IdentifierGeneratorAggregator ) {
+ ( (IdentifierGeneratorAggregator) ig ).registerPersistentGenerators( generators );
+ }
}
}
Modified: core/trunk/core/src/main/java/org/hibernate/id/CompositeNestedGeneratedValueGenerator.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/id/CompositeNestedGeneratedValueGenerator.java 2010-02-09 19:22:10 UTC (rev 18747)
+++ core/trunk/core/src/main/java/org/hibernate/id/CompositeNestedGeneratedValueGenerator.java 2010-02-09 19:54:39 UTC (rev 18748)
@@ -27,6 +27,7 @@
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import org.hibernate.HibernateException;
import org.hibernate.engine.SessionImplementor;
@@ -61,7 +62,7 @@
*
* @author Steve Ebersole
*/
-public class CompositeNestedGeneratedValueGenerator implements IdentifierGenerator, Serializable {
+public class CompositeNestedGeneratedValueGenerator implements IdentifierGenerator, Serializable, IdentifierGeneratorAggregator {
/**
* Contract for declaring how to locate the context for sub-value injection.
*/
@@ -91,6 +92,14 @@
* @param injectionContext The context into which the generated value can be injected
*/
public void execute(SessionImplementor session, Object incomingObject, Object injectionContext);
+
+ /**
+ * Register any sub generators which implement {@link PersistentIdentifierGenerator} by their
+ * {@link PersistentIdentifierGenerator#generatorKey generatorKey}.
+ *
+ * @param generatorMap The map of generators.
+ */
+ public void registerPersistentGenerators(Map generatorMap);
}
private final GenerationContextLocator generationContextLocator;
@@ -116,4 +125,14 @@
return context;
}
+ /**
+ * {@inheritDoc}
+ */
+ public void registerPersistentGenerators(Map generatorMap) {
+ final Iterator itr = generationPlans.iterator();
+ while ( itr.hasNext() ) {
+ final GenerationPlan plan = (GenerationPlan) itr.next();
+ plan.registerPersistentGenerators( generatorMap );
+ }
+ }
}
Added: core/trunk/core/src/main/java/org/hibernate/id/IdentifierGeneratorAggregator.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/id/IdentifierGeneratorAggregator.java (rev 0)
+++ core/trunk/core/src/main/java/org/hibernate/id/IdentifierGeneratorAggregator.java 2010-02-09 19:54:39 UTC (rev 18748)
@@ -0,0 +1,44 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. 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.id;
+
+import java.util.Map;
+
+/**
+ * Identifies {@link IdentifierGenerator generators} which potentially aggregate other
+ * {@link PersistentIdentifierGenerator} generators.
+ * <p/>
+ * Initially this is limited to {@link CompositeNestedGeneratedValueGenerator}
+ *
+ * @author Steve Ebersole
+ */
+public interface IdentifierGeneratorAggregator {
+ /**
+ * Register any sub generators which implement {@link PersistentIdentifierGenerator} by their
+ * {@link PersistentIdentifierGenerator#generatorKey generatorKey}.
+ *
+ * @param generatorMap The map of generators.
+ */
+ public void registerPersistentGenerators(Map generatorMap);
+}
Modified: core/trunk/core/src/main/java/org/hibernate/mapping/Component.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/Component.java 2010-02-09 19:22:10 UTC (rev 18747)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/Component.java 2010-02-09 19:54:39 UTC (rev 18748)
@@ -24,26 +24,19 @@
package org.hibernate.mapping;
import java.io.Serializable;
-import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import org.hibernate.EntityMode;
-import org.hibernate.HibernateException;
import org.hibernate.MappingException;
import org.hibernate.dialect.Dialect;
-import org.hibernate.engine.EntityEntry;
import org.hibernate.engine.SessionImplementor;
import org.hibernate.id.CompositeNestedGeneratedValueGenerator;
import org.hibernate.id.IdentifierGenerator;
+import org.hibernate.id.PersistentIdentifierGenerator;
import org.hibernate.id.factory.IdentifierGeneratorFactory;
-import org.hibernate.property.Getter;
-import org.hibernate.property.PropertyAccessor;
import org.hibernate.property.Setter;
import org.hibernate.tuple.component.ComponentMetamodel;
import org.hibernate.type.ComponentType;
@@ -444,6 +437,12 @@
final Object generatedValue = subGenerator.generate( session, incomingObject );
injector.set( injectionContext, generatedValue, session.getFactory() );
}
+
+ public void registerPersistentGenerators(Map generatorMap) {
+ if ( PersistentIdentifierGenerator.class.isInstance( subGenerator ) ) {
+ generatorMap.put( ( (PersistentIdentifierGenerator) subGenerator ).generatorKey(), subGenerator );
+ }
+ }
}
}
16 years, 2 months
Hibernate SVN: r18747 - core/trunk/annotations/src/test/java/org/hibernate/test/annotations/derivedidentities/e1/a.
by hibernate-commits@lists.jboss.org
Author: smarlow(a)redhat.com
Date: 2010-02-09 14:22:10 -0500 (Tue, 09 Feb 2010)
New Revision: 18747
Modified:
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/derivedidentities/e1/a/DerivedIdentitySimpleParentIdClassDepTest.java
Log:
HHH-4895 query against derived id doesn't return expected result
Modified: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/derivedidentities/e1/a/DerivedIdentitySimpleParentIdClassDepTest.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/derivedidentities/e1/a/DerivedIdentitySimpleParentIdClassDepTest.java 2010-02-09 17:31:18 UTC (rev 18746)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/derivedidentities/e1/a/DerivedIdentitySimpleParentIdClassDepTest.java 2010-02-09 19:22:10 UTC (rev 18747)
@@ -4,6 +4,8 @@
import org.hibernate.test.annotations.TestCase;
import org.hibernate.test.util.SchemaUtil;
+import java.util.List;
+
/**
* @author Emmanuel Bernard
*/
@@ -35,6 +37,31 @@
s.close();
}
+ public void testQueryNewEntityInPC() throws Exception {
+ Session s = openSession();
+ s.getTransaction().begin();
+ Employee e = new Employee( 1L, "Paula", "P" );
+ Dependent d = new Dependent( "LittleP", e );
+ d.setEmp(e);
+ s.persist( d );
+ s.persist( e );
+
+ // the following would work
+ // List depList = s.createQuery("Select d from Dependent d where d.name='LittleP'").list();
+
+ // the following query is not finding the entity 'd' added above
+ List depList = s.createQuery("Select d from Dependent d where d.name='LittleP' and d.emp.name='Paula'").list();
+ Object newDependent = null;
+ if (depList.size() > 0) {
+ newDependent = (Dependent) depList.get(0);
+ }
+ if (newDependent != d) {
+ fail("PC entity instance (" + d +") does not match returned query result value (" + newDependent);
+ }
+ s.getTransaction().rollback();
+ s.close();
+ }
+
@Override
protected Class<?>[] getAnnotatedClasses() {
return new Class<?>[] {
16 years, 2 months
Hibernate SVN: r18746 - branches/Branch_3_2/HibernateExt/tools/src/templates/hbm.
by hibernate-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2010-02-09 12:31:18 -0500 (Tue, 09 Feb 2010)
New Revision: 18746
Added:
branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/collection-tableattr.hbm.ftl
Modified:
branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/array.hbm.ftl
branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/bag.hbm.ftl
branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/idbag.hbm.ftl
branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/list.hbm.ftl
branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/map.hbm.ftl
branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/set.hbm.ftl
Log:
added multi catalog/schema generation support to the remaining collection types (array, bag, idbag, list, map)
Modified: branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/array.hbm.ftl
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/array.hbm.ftl 2010-02-09 13:00:22 UTC (rev 18745)
+++ branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/array.hbm.ftl 2010-02-09 17:31:18 UTC (rev 18746)
@@ -6,7 +6,7 @@
<array name="${property.name}"
<#if value.elementClassName?exists> element-class="${value.elementClassName}"</#if>
- table="${value.collectionTable.quotedName}"
+ <#include "collection-tableattr.hbm.ftl">
<#if property.cascade != "none">
cascade="${property.cascade}"
</#if>
Modified: branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/bag.hbm.ftl
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/bag.hbm.ftl 2010-02-09 13:00:22 UTC (rev 18745)
+++ branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/bag.hbm.ftl 2010-02-09 17:31:18 UTC (rev 18746)
@@ -3,7 +3,9 @@
<#assign elementValue = value.getElement()>
<#assign elementTag = c2h.getCollectionElementTag(property)>
- <bag name="${property.name}" table="${value.collectionTable.quotedName}" inverse="${value.inverse?string}"
+ <bag name="${property.name}"
+ <#include "collection-tableattr.hbm.ftl">
+ inverse="${value.inverse?string}"
lazy="${c2h.getCollectionLazy(value)}"
<#if property.cascade != "none">
cascade="${property.cascade}"
Added: branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/collection-tableattr.hbm.ftl
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/collection-tableattr.hbm.ftl (rev 0)
+++ branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/collection-tableattr.hbm.ftl 2010-02-09 17:31:18 UTC (rev 18746)
@@ -0,0 +1,7 @@
+table="${value.collectionTable.quotedName}"
+<#if value.collectionTable.catalog?exists && ((clazz.table.catalog?exists && clazz.table.catalog!=value.collectionTable.catalog) || (!clazz.table.catalog?exists && value.collectionTable.catalog?exists)) >
+catalog="${value.collectionTable.catalog}"
+</#if>
+<#if value.collectionTable.schema?exists && ((clazz.table.schema?exists && clazz.table.schema!=value.collectionTable.schema) || (!clazz.table.schema?exists && value.collectionTable.schema?exists)) >
+schema="${value.collectionTable.quotedSchema}"
+</#if>
\ No newline at end of file
Modified: branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/idbag.hbm.ftl
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/idbag.hbm.ftl 2010-02-09 13:00:22 UTC (rev 18745)
+++ branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/idbag.hbm.ftl 2010-02-09 17:31:18 UTC (rev 18746)
@@ -3,7 +3,8 @@
<#assign elementValue = value.getElement()>
<#assign elementTag = c2h.getCollectionElementTag(property)>
- <idbag name="${property.name}" table="${value.collectionTable.quotedName}"
+ <idbag name="${property.name}"
+ <#include "collection-tableattr.hbm.ftl">
lazy="${c2h.getCollectionLazy(value)}"
<#if property.cascade != "none">
cascade="${property.cascade}"
Modified: branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/list.hbm.ftl
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/list.hbm.ftl 2010-02-09 13:00:22 UTC (rev 18745)
+++ branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/list.hbm.ftl 2010-02-09 17:31:18 UTC (rev 18746)
@@ -4,11 +4,13 @@
<#assign indexValue = value.getIndex()>
<#assign elementTag = c2h.getCollectionElementTag(property)>
- <list name="${property.name}" inverse="${value.inverse?string}" table="${value.collectionTable.quotedName}"
+ <list name="${property.name}" inverse="${value.inverse?string}"
+ <#include "collection-tableattr.hbm.ftl">
lazy="${c2h.getCollectionLazy(value)}"
<#if property.cascade != "none">
cascade="${property.cascade}"
</#if>
+
<#if c2h.hasFetchMode(property)> fetch="${c2h.getFetchMode(property)}"</#if>>
<#assign metaattributable=property>
<#include "meta.hbm.ftl">
Modified: branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/map.hbm.ftl
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/map.hbm.ftl 2010-02-09 13:00:22 UTC (rev 18745)
+++ branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/map.hbm.ftl 2010-02-09 17:31:18 UTC (rev 18746)
@@ -4,7 +4,8 @@
<#assign indexValue = value.getIndex()>
<#assign elementTag = c2h.getCollectionElementTag(property)>
- <map name="${property.name}" table="${value.collectionTable.quotedName}"
+ <map name="${property.name}"
+ <#include "collection-tableattr.hbm.ftl">
lazy="${c2h.getCollectionLazy(value)}"
<#if property.cascade != "none">
cascade="${property.cascade}"
Modified: branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/set.hbm.ftl
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/set.hbm.ftl 2010-02-09 13:00:22 UTC (rev 18745)
+++ branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/set.hbm.ftl 2010-02-09 17:31:18 UTC (rev 18746)
@@ -3,16 +3,10 @@
<#assign elementValue = value.getElement()>
<#assign elementTag = c2h.getCollectionElementTag(property)>
- <set name="${property.name}"
+ <set name="${property.name}"
+ <#include "collection-tableattr.hbm.ftl">
inverse="${value.inverse?string}"
- lazy="${c2h.getCollectionLazy(value)}"
- table="${value.collectionTable.name}"
- <#if value.collectionTable.catalog?exists && ((clazz.table.catalog?exists && clazz.table.catalog!=value.collectionTable.catalog) || (!clazz.table.catalog?exists && value.collectionTable.catalog?exists)) >
- catalog="${value.collectionTable.catalog}"
- </#if>
- <#if value.collectionTable.schema?exists && ((clazz.table.schema?exists && clazz.table.schema!=value.collectionTable.schema) || (!clazz.table.schema?exists && value.collectionTable.schema?exists)) >
- schema="${value.collectionTable.quotedSchema}"
- </#if>
+ lazy="${c2h.getCollectionLazy(value)}"
<#if property.cascade != "none">
cascade="${property.cascade}"
</#if>
16 years, 2 months
Hibernate SVN: r18745 - in search/trunk/hibernate-search-archetype: src/test/java/example and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: sannegrinovero
Date: 2010-02-09 08:00:22 -0500 (Tue, 09 Feb 2010)
New Revision: 18745
Modified:
search/trunk/hibernate-search-archetype/pom.xml
search/trunk/hibernate-search-archetype/src/test/java/example/IndexAndSearchTest.java
Log:
HSEARCH-459 Update quickstart archetype (version definitions, test cleanup, use the massindexer)
Modified: search/trunk/hibernate-search-archetype/pom.xml
===================================================================
--- search/trunk/hibernate-search-archetype/pom.xml 2010-02-09 12:49:20 UTC (rev 18744)
+++ search/trunk/hibernate-search-archetype/pom.xml 2010-02-09 13:00:22 UTC (rev 18745)
@@ -1,12 +1,20 @@
<?xml version="1.0"?>
-<project>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search-quickstart</artifactId>
<packaging>jar</packaging>
- <version>3.2.0-Beta1</version>
+ <version>3.2.0-SNAPSHOT</version>
<name>A custom project</name>
<url>http://www.myorganization.org</url>
+
+ <properties>
+ <slf4jVersion>1.5.8</slf4jVersion>
+ <luceneVersion>2.9.1</luceneVersion> <!-- Remember to change code constants too: Version.LUCENE_29 -->
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
@@ -16,7 +24,7 @@
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
- <version>3.5.0-Beta-2</version>
+ <version>3.5.0-Beta-4</version>
</dependency>
<dependency>
<groupId>org.apache.solr</groupId>
@@ -59,41 +67,42 @@
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-snowball</artifactId>
- <version>2.4.1</version>
+ <version>${luceneVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-analyzers</artifactId>
- <version>2.4.1</version>
+ <version>${luceneVersion}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
- <version>1.4.2</version>
+ <version>${slf4jVersion}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
- <version>1.4.2</version>
+ <version>${slf4jVersion}</version>
</dependency>
<dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
- <version>1.8.0.2</version>
+ <version>1.8.0.10</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>4.4</version>
+ <version>4.7</version>
<scope>test</scope>
</dependency>
</dependencies>
+
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
- <version>2.0.2</version>
+ <version>2.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
Modified: search/trunk/hibernate-search-archetype/src/test/java/example/IndexAndSearchTest.java
===================================================================
--- search/trunk/hibernate-search-archetype/src/test/java/example/IndexAndSearchTest.java 2010-02-09 12:49:20 UTC (rev 18744)
+++ search/trunk/hibernate-search-archetype/src/test/java/example/IndexAndSearchTest.java 2010-02-09 13:00:22 UTC (rev 18745)
@@ -27,6 +27,7 @@
import org.apache.lucene.queryParser.MultiFieldQueryParser;
import org.apache.lucene.queryParser.ParseException;
import org.apache.lucene.queryParser.QueryParser;
+import org.apache.lucene.util.Version;
import org.hibernate.Session;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.search.FullTextSession;
@@ -113,16 +114,18 @@
private void index() {
FullTextSession ftSession = org.hibernate.search.Search.getFullTextSession((Session) em.getDelegate());
- List results = ftSession.createCriteria(Book.class).list();
- for (Object obj : results) {
- ftSession.index(obj);
- }
- ftSession.flushToIndexes();
+ try {
+ ftSession.createIndexer().startAndWait();
+ }
+ catch (InterruptedException e) {
+ log.error( "Was interrupted during indexing", e );
+ }
}
private void purge() {
FullTextSession ftSession = org.hibernate.search.Search.getFullTextSession((Session) em.getDelegate());
ftSession.purgeAll(Book.class);
+ ftSession.flushToIndexes();
}
private List<Book> search(String searchQuery) throws ParseException {
@@ -149,7 +152,7 @@
FullTextEntityManager ftEm = org.hibernate.search.jpa.Search.getFullTextEntityManager((EntityManager) em);
- QueryParser parser = new MultiFieldQueryParser(bookFields, ftEm.getSearchFactory().getAnalyzer("customanalyzer"),
+ QueryParser parser = new MultiFieldQueryParser(Version.LUCENE_29, bookFields, ftEm.getSearchFactory().getAnalyzer("customanalyzer"),
boostPerField);
org.apache.lucene.search.Query luceneQuery;
16 years, 2 months
Hibernate SVN: r18744 - in branches/Branch_3_2/HibernateExt/tools/src: test/org/hibernate/tool/ide/completion and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2010-02-09 07:49:20 -0500 (Tue, 09 Feb 2010)
New Revision: 18744
Modified:
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/ide/completion/HQLCodeAssist.java
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/ide/completion/ModelCompletionTest.java
Log:
Fix JBIDE-5810 QLCodeAssist doesn't split words correctly (patch from dgeraskov)
Modified: branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/ide/completion/HQLCodeAssist.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/ide/completion/HQLCodeAssist.java 2010-02-09 12:38:47 UTC (rev 18743)
+++ branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/ide/completion/HQLCodeAssist.java 2010-02-09 12:49:20 UTC (rev 18744)
@@ -1,5 +1,6 @@
package org.hibernate.tool.ide.completion;
+import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
@@ -10,6 +11,12 @@
private Configuration configuration;
private ConfigurationCompletion completion;
+ private static final char[] charSeparators;
+ static {
+ charSeparators = new char[]{',', '(', ')'};
+ Arrays.sort(charSeparators);
+ }
+
public HQLCodeAssist(Configuration configuration) {
this.configuration = configuration;
completion = new ConfigurationCompletion(configuration);
@@ -81,7 +88,7 @@
return configuration;
}
- public int findNearestWhiteSpace( CharSequence doc, int start ) {
+ public static int findNearestWhiteSpace( CharSequence doc, int start ) {
boolean loop = true;
int offset = 0;
@@ -89,7 +96,7 @@
int tmpOffset = start - 1;
while (loop && tmpOffset >= 0) {
char c = doc.charAt(tmpOffset);
- if(Character.isWhitespace(c)) {
+ if(isWhitespace(c)) {
loop = false;
} else {
tmpOffset--;
@@ -100,4 +107,9 @@
return offset;
}
+ private static boolean isWhitespace(char c) {
+ return Arrays.binarySearch(charSeparators, c) >= 0
+ || Character.isWhitespace(c);
+ }
+
}
Modified: branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/ide/completion/ModelCompletionTest.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/ide/completion/ModelCompletionTest.java 2010-02-09 12:38:47 UTC (rev 18743)
+++ branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/ide/completion/ModelCompletionTest.java 2010-02-09 12:49:20 UTC (rev 18744)
@@ -80,7 +80,7 @@
cc.getMatchingImports( "StoreC", hcc );
assertEquals("Invalid entity names count", 1, hcc.getCompletionProposals().length);
assertEquals("StoreCity should have been found", "StoreCity", hcc.getCompletionProposals()[0].getSimpleName());
-
+
hcc.clear();
cc.getMatchingImports( "NotThere", hcc );
assertTrue(hcc.getCompletionProposals().length==0);
@@ -266,9 +266,50 @@
assertNotNull(proposal.getShortEntityName());
assertNotNull(proposal.getEntityName());
//assertNotNull(proposal.getShortEntityName());
- }
+ }
+
+ c.clear();
+ query = "from Store, | ";
+ caretPosition = getCaretPosition(query);
+ hqlEval.codeComplete(query, caretPosition, c);
+
+ completionProposals = c.getCompletionProposals();
+
+ assertEquals(9, completionProposals.length);
+
}
+ public void testFromNonWhitespace() {
+ Collector c = new Collector();
+
+ IHQLCodeAssist hqlEval = new HQLCodeAssist(sf);
+
+ String query = null;
+ int caretPosition = -1;
+ HQLCompletionProposal[] completionProposals = null;
+
+ c.clear();
+ query = "from Store,| ";
+ caretPosition = getCaretPosition(query);
+ hqlEval.codeComplete(query, caretPosition, c);
+ completionProposals = c.getCompletionProposals();
+ assertEquals("should get results after a nonwhitespace separator", 9, completionProposals.length);
+
+ c.clear();
+ query = "from Store s where ";
+ caretPosition = getCaretPosition(query);
+ hqlEval.codeComplete(query, caretPosition, c);
+ completionProposals = c.getCompletionProposals();
+ assertTrue(completionProposals.length > 0);
+
+ c.clear();
+ query = "from Store s where (";
+ caretPosition = getCaretPosition(query);
+ hqlEval.codeComplete(query, caretPosition, c);
+ completionProposals = c.getCompletionProposals();
+ assertTrue(completionProposals.length > 0);
+
+ }
public void testBasicFromPartialEntityName() {
Collector c = new Collector();
16 years, 2 months
Hibernate SVN: r18743 - in branches/Branch_3_2/HibernateExt/tools: src/java/org/hibernate/cfg and 2 other directories.
by hibernate-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2010-02-09 07:38:47 -0500 (Tue, 09 Feb 2010)
New Revision: 18743
Added:
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/TernarySchemaTest.java
Modified:
branches/Branch_3_2/HibernateExt/tools/.classpath
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/cfg/JDBCBinder.java
branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/set.hbm.ftl
Log:
Fix JBIDE-5628, <set> now insert catalog/schema if different from parent entity.
Modified: branches/Branch_3_2/HibernateExt/tools/.classpath
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/.classpath 2010-02-09 12:16:09 UTC (rev 18742)
+++ branches/Branch_3_2/HibernateExt/tools/.classpath 2010-02-09 12:38:47 UTC (rev 18743)
@@ -27,7 +27,6 @@
<classpathentry kind="lib" path="/hibernate-3.2/lib/ant-1.6.5.jar"/>
<classpathentry kind="lib" path="/hibernate-3.2/lib/cglib-2.1.3.jar"/>
<classpathentry kind="lib" path="/hibernate-3.2/lib/junit-3.8.1.jar"/>
- <classpathentry kind="lib" path="/hibernate-3.2/jdbc/hsqldb.jar"/>
<classpathentry kind="lib" path="/hibernate-3.2/lib/ant-antlr-1.6.5.jar"/>
<classpathentry kind="lib" path="/hibernate-3.2/lib/ant-junit-1.6.5.jar"/>
<classpathentry kind="lib" path="/hibernate-3.2/lib/ant-launcher-1.6.5.jar"/>
@@ -51,7 +50,6 @@
<classpathentry kind="lib" path="/hibernate-3.2/lib/jboss-system.jar"/>
<classpathentry kind="lib" path="/hibernate-3.2/lib/jgroups-2.2.8.jar"/>
<classpathentry kind="lib" path="/hibernate-3.2/lib/jta.jar"/>
- <classpathentry kind="lib" path="/hibernate-3.2/lib/log4j-1.2.11.jar"/>
<classpathentry kind="lib" path="/hibernate-3.2/lib/oscache-2.1.jar"/>
<classpathentry kind="lib" path="/hibernate-3.2/lib/proxool-0.8.3.jar"/>
<classpathentry kind="lib" path="/hibernate-3.2/lib/swarmcache-1.0rc2.jar"/>
@@ -63,5 +61,7 @@
<classpathentry kind="lib" path="C:/work/products/slf4j-1.5.10/slf4j-log4j12-1.5.10.jar"/>
<classpathentry kind="lib" path="C:/work/products/hibernate-distribution-3.3.2.GA/lib/required/commons-collections-3.1.jar"/>
<classpathentry kind="lib" path="C:/work/products/hibernate-distribution-3.3.2.GA/hibernate3.jar" sourcepath="C:/work/products/hibernate-distribution-3.3.2.GA/project"/>
- <classpathentry kind="output" path="build/classes"/>
+ <classpathentry kind="lib" path="C:/work/products/apache-log4j-1.2.15/log4j-1.2.15.jar"/>
+ <classpathentry kind="lib" path="lib/jdbc/hsqldb.jar"/>
+ <classpathentry kind="output" path="build/eclipseclasses"/>
</classpath>
Modified: branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/cfg/JDBCBinder.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/cfg/JDBCBinder.java 2010-02-09 12:16:09 UTC (rev 18742)
+++ branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/cfg/JDBCBinder.java 2010-02-09 12:38:47 UTC (rev 18743)
@@ -150,9 +150,11 @@
continue;
}
+
RootClass rc = new RootClass();
TableIdentifier tableIdentifier = TableIdentifier.create(table);
String className = revengStrategy.tableToClassName( tableIdentifier );
+ log.debug("Building entity " + className + " based on " + tableIdentifier);
rc.setEntityName( className );
rc.setClassName( className );
rc.setProxyInterfaceName( rc.getEntityName() ); // TODO: configurable ?
Modified: branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/set.hbm.ftl
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/set.hbm.ftl 2010-02-09 12:16:09 UTC (rev 18742)
+++ branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/set.hbm.ftl 2010-02-09 12:38:47 UTC (rev 18743)
@@ -7,6 +7,12 @@
inverse="${value.inverse?string}"
lazy="${c2h.getCollectionLazy(value)}"
table="${value.collectionTable.name}"
+ <#if value.collectionTable.catalog?exists && ((clazz.table.catalog?exists && clazz.table.catalog!=value.collectionTable.catalog) || (!clazz.table.catalog?exists && value.collectionTable.catalog?exists)) >
+ catalog="${value.collectionTable.catalog}"
+ </#if>
+ <#if value.collectionTable.schema?exists && ((clazz.table.schema?exists && clazz.table.schema!=value.collectionTable.schema) || (!clazz.table.schema?exists && value.collectionTable.schema?exists)) >
+ schema="${value.collectionTable.quotedSchema}"
+ </#if>
<#if property.cascade != "none">
cascade="${property.cascade}"
</#if>
Added: branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/TernarySchemaTest.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/TernarySchemaTest.java (rev 0)
+++ branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/TernarySchemaTest.java 2010-02-09 12:38:47 UTC (rev 18743)
@@ -0,0 +1,159 @@
+/*
+ * Created on 2004-11-23
+ *
+ */
+package org.hibernate.tool.test.jdbc2cfg;
+
+import java.io.File;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.JDBCMetaDataConfiguration;
+import org.hibernate.cfg.reveng.DefaultReverseEngineeringStrategy;
+import org.hibernate.cfg.reveng.SchemaSelection;
+import org.hibernate.mapping.PersistentClass;
+import org.hibernate.mapping.Property;
+import org.hibernate.mapping.Set;
+import org.hibernate.tool.JDBCMetaDataBinderTestCase;
+import org.hibernate.tool.hbm2x.HibernateMappingExporter;
+import org.hibernate.tool.hbm2x.visitor.DefaultValueVisitor;
+
+/**
+ *
+ * Tests multi schema used in collections (set)'s. See JBIDE-5628.
+ *
+ * Excluded from default tests for now since it currently requires HSQLDB 2.0 since previous versions of hsqldb does not support cross-schema foreign key checks.
+ *
+ * @author max
+ *
+ */
+public class TernarySchemaTest extends JDBCMetaDataBinderTestCase {
+
+ /**
+ * @return
+ */
+ protected String[] getDropSQL() {
+ return new String[] {
+ "drop table plainuserroles",
+ "drop table plainrole",
+ "drop table thirdschema.userroles",
+ "drop table user",
+ "drop table otherschema.role",
+ "drop schema otherschema",
+ "drop schema thirdschema"};
+ }
+
+ /**
+ * @return
+ */
+ protected String[] getCreateSQL() {
+
+ return new String[] {
+ "create schema otherschema authorization dba",
+ "create schema thirdschema authorization dba",
+
+ "create table user ( id int not null, name varchar(20), primary key(id))",
+ "create table otherschema.role ( id int not null, name varchar(20), primary key(id))",
+ "create table thirdschema.userroles ( userid int not null, roleid int not null, primary key(userid, roleid))",
+ "alter table thirdschema.userroles add constraint toroles foreign key (roleid) references otherschema.role(id)",
+ "alter table thirdschema.userroles add constraint tousers foreign key (userid) references public.user(id)",
+
+ "create table plainrole ( id int not null, name varchar(20), primary key(id))",
+ "create table plainuserroles ( userid int not null, roleid int not null, primary key(userid, roleid))",
+ "alter table plainuserroles add constraint plaintoroles foreign key (roleid) references plainrole(id)",
+ "alter table plainuserroles add constraint plaintousers foreign key (userid) references user(id)",
+
+ };
+ }
+
+ public void testTernaryModel() throws SQLException {
+
+ assertMultiSchema(getConfiguration());
+
+ }
+
+ private void assertMultiSchema(Configuration cfg) {
+ assertHasNext("There should be three tables!", 5, cfg
+ .getTableMappings());
+
+ final PersistentClass role = cfg.getClassMapping("Role");
+ PersistentClass userroles = cfg.getClassMapping("Userroles");
+ PersistentClass user = cfg.getClassMapping("User");
+ PersistentClass plainRole = cfg.getClassMapping("Plainrole");
+
+
+ Property property = role.getProperty("users");
+ assertEquals(role.getTable().getSchema(), "OTHERSCHEMA");
+ assertNotNull(property);
+ property.getValue().accept(new DefaultValueVisitor(true) {
+ public Object accept(Set o) {
+ assertEquals(o.getCollectionTable().getSchema(), "THIRDSCHEMA");
+ return null;
+ }
+ });
+
+
+
+ property = plainRole.getProperty("users");
+ assertEquals(role.getTable().getSchema(), "OTHERSCHEMA");
+ assertNotNull(property);
+ property.getValue().accept(new DefaultValueVisitor(true) {
+ public Object accept(Set o) {
+ assertEquals(o.getCollectionTable().getSchema(), null);
+ return null;
+ }
+ });
+
+ }
+
+ public void testGeneration() {
+
+
+ cfg.buildMappings();
+
+ HibernateMappingExporter hme = new HibernateMappingExporter(cfg, getOutputDir());
+ hme.start();
+
+ assertFileAndExists( new File(getOutputDir(), "Role.hbm.xml") );
+ assertFileAndExists( new File(getOutputDir(), "User.hbm.xml") );
+ assertFileAndExists( new File(getOutputDir(), "Plainrole.hbm.xml") );
+
+ assertEquals(3, getOutputDir().listFiles().length);
+
+ Configuration configuration = new Configuration()
+ .addFile( new File(getOutputDir(), "Role.hbm.xml") )
+ .addFile( new File(getOutputDir(), "User.hbm.xml") )
+ .addFile( new File(getOutputDir(), "Plainrole.hbm.xml"));
+
+ configuration.buildMappings();
+
+ assertMultiSchema(configuration);
+ }
+
+ protected void configure(JDBCMetaDataConfiguration configuration) {
+
+ super.configure(configuration);
+ DefaultReverseEngineeringStrategy c = new DefaultReverseEngineeringStrategy() {
+ public List getSchemaSelections() {
+ List selections = new ArrayList();
+ selections.add(new SchemaSelection(null, "PUBLIC"));
+ selections.add(new SchemaSelection(null, "otherschema"));
+ selections.add(new SchemaSelection(null, "thirdschema"));
+ return selections;
+ }
+ };
+
+ configuration.setReverseEngineeringStrategy(c);
+ }
+
+
+ public static Test suite() {
+ return new TestSuite( TernarySchemaTest.class );
+ }
+
+}
16 years, 2 months
Hibernate SVN: r18742 - search/trunk.
by hibernate-commits@lists.jboss.org
Author: sannegrinovero
Date: 2010-02-09 07:16:09 -0500 (Tue, 09 Feb 2010)
New Revision: 18742
Modified:
search/trunk/pom.xml
Log:
had wrong version in root pom.xml
Modified: search/trunk/pom.xml
===================================================================
--- search/trunk/pom.xml 2010-02-09 12:03:41 UTC (rev 18741)
+++ search/trunk/pom.xml 2010-02-09 12:16:09 UTC (rev 18742)
@@ -27,7 +27,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search</artifactId>
- <version>3.2.0.Beta2-SNAPSHOT</version>
+ <version>3.2.0-SNAPSHOT</version>
<name>Hibernate Search</name>
<description>Hibernate Search</description>
<url>http://search.hibernate.org</url>
16 years, 2 months
Hibernate SVN: r18741 - in core/trunk: testing/src/main/java/org/hibernate/test/annotations and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2010-02-09 07:03:41 -0500 (Tue, 09 Feb 2010)
New Revision: 18741
Modified:
core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/PackagedEntityManagerTest.java
core/trunk/testing/src/main/java/org/hibernate/test/annotations/HibernateTestCase.java
Log:
HHH-4892 PackagedEntityManagerTest should not extend from the Hibernate test case. It extends now junit.framework.TestCase directly.
Modified: core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/PackagedEntityManagerTest.java
===================================================================
--- core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/PackagedEntityManagerTest.java 2010-02-09 10:18:09 UTC (rev 18740)
+++ core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/PackagedEntityManagerTest.java 2010-02-09 12:03:41 UTC (rev 18741)
@@ -66,13 +66,9 @@
* @author Gavin King
*/
@SuppressWarnings("unchecked")
-public class PackagedEntityManagerTest extends TestCase {
+public class PackagedEntityManagerTest extends junit.framework.TestCase {
private static ClassLoader originalClassLoader;
- public Class[] getAnnotatedClasses() {
- return new Class[] { Item.class, Distributor.class };
- }
-
@Override
protected void setUp() throws Exception {
originalClassLoader = Thread.currentThread().getContextClassLoader();
@@ -82,7 +78,9 @@
private ClassLoader buildCustomTCCL(ClassLoader parentClassLoader) throws MalformedURLException {
// get a URL reference to something we now is part of the classpath (us)
- URL myUrl = parentClassLoader.getResource( PackagedEntityManagerTest.class.getName().replace( '.', '/' ) + ".class" );
+ URL myUrl = parentClassLoader.getResource(
+ PackagedEntityManagerTest.class.getName().replace( '.', '/' ) + ".class"
+ );
File myPath = new File( myUrl.getFile() );
// navigate back to '/target'
File targetDir = myPath
@@ -97,7 +95,7 @@
for ( File testPackage : testPackagesDir.listFiles() ) {
urls.add( testPackage.toURL() );
}
- return new URLClassLoader( urls.toArray( new URL[ urls.size() ] ), parentClassLoader );
+ return new URLClassLoader( urls.toArray( new URL[urls.size()] ), parentClassLoader );
}
@Override
@@ -106,12 +104,6 @@
Thread.currentThread().setContextClassLoader( originalClassLoader );
}
- @Override
- protected void buildConfiguration() throws Exception {
- super.buildConfiguration();
- factory = Persistence.createEntityManagerFactory( "manager1" );
- }
-
public void testDefaultPar() throws Exception {
EntityManagerFactory emf = Persistence.createEntityManagerFactory( "defaultpar", new HashMap() );
EntityManager em = emf.createEntityManager();
@@ -226,7 +218,6 @@
emf.close();
}
-
public void testExcludeHbmPar() throws Exception {
EntityManagerFactory emf = null;
try {
@@ -317,7 +308,6 @@
emf.close();
}
-
public void testListeners() throws Exception {
EntityManagerFactory emf = Persistence.createEntityManagerFactory( "manager1", new HashMap() );
EntityManager em = emf.createEntityManager();
@@ -333,10 +323,9 @@
}
public void testExtendedEntityManager() {
-
+ EntityManagerFactory emf = Persistence.createEntityManagerFactory( "manager1", new HashMap() );
+ EntityManager em = emf.createEntityManager();
Item item = new Item( "Mouse", "Micro$oft mouse" );
-
- EntityManager em = getOrCreateEntityManager();
em.getTransaction().begin();
em.persist( item );
assertTrue( em.contains( item ) );
@@ -376,20 +365,21 @@
em.getTransaction().commit();
em.close();
-
+ emf.close();
}
public void testConfiguration() throws Exception {
+ EntityManagerFactory emf = Persistence.createEntityManagerFactory( "manager1", new HashMap() );
Item item = new Item( "Mouse", "Micro$oft mouse" );
Distributor res = new Distributor();
res.setName( "Bruce" );
item.setDistributors( new HashSet<Distributor>() );
item.getDistributors().add( res );
- Statistics stats = ( ( HibernateEntityManagerFactory ) factory ).getSessionFactory().getStatistics();
+ Statistics stats = ( ( HibernateEntityManagerFactory ) emf ).getSessionFactory().getStatistics();
stats.clear();
stats.setStatisticsEnabled( true );
- EntityManager em = getOrCreateEntityManager();
+ EntityManager em = emf.createEntityManager();
em.getTransaction().begin();
em.persist( res );
@@ -402,7 +392,7 @@
assertEquals( 1, stats.getSecondLevelCachePutCount() );
assertEquals( 0, stats.getSecondLevelCacheHitCount() );
- em = getOrCreateEntityManager();
+ em = emf.createEntityManager();
em.getTransaction().begin();
Item second = em.find( Item.class, item.getName() );
assertEquals( 1, second.getDistributors().size() );
@@ -410,7 +400,7 @@
em.getTransaction().commit();
em.close();
- em = getOrCreateEntityManager();
+ em = emf.createEntityManager();
em.getTransaction().begin();
second = em.find( Item.class, item.getName() );
assertEquals( 1, second.getDistributors().size() );
@@ -424,10 +414,12 @@
stats.clear();
stats.setStatisticsEnabled( false );
+ emf.close();
}
public void testExternalJar() throws Exception {
- EntityManager em = getOrCreateEntityManager();
+ EntityManagerFactory emf = Persistence.createEntityManagerFactory( "manager1", new HashMap() );
+ EntityManager em = emf.createEntityManager();
Scooter s = new Scooter();
s.setModel( "Abadah" );
s.setSpeed( 85l );
@@ -435,17 +427,19 @@
em.persist( s );
em.getTransaction().commit();
em.close();
- em = getOrCreateEntityManager();
+ em = emf.createEntityManager();
em.getTransaction().begin();
s = em.find( Scooter.class, s.getModel() );
assertEquals( new Long( 85 ), s.getSpeed() );
em.remove( s );
em.getTransaction().commit();
em.close();
+ emf.close();
}
public void testORMFileOnMainAndExplicitJars() throws Exception {
- EntityManager em = getOrCreateEntityManager();
+ EntityManagerFactory emf = Persistence.createEntityManagerFactory( "manager1", new HashMap() );
+ EntityManager em = emf.createEntityManager();
Seat seat = new Seat();
seat.setNumber( "3B" );
Airplane plane = new Airplane();
@@ -456,5 +450,6 @@
em.flush();
em.getTransaction().rollback();
em.close();
+ emf.close();
}
}
\ No newline at end of file
Modified: core/trunk/testing/src/main/java/org/hibernate/test/annotations/HibernateTestCase.java
===================================================================
--- core/trunk/testing/src/main/java/org/hibernate/test/annotations/HibernateTestCase.java 2010-02-09 10:18:09 UTC (rev 18740)
+++ core/trunk/testing/src/main/java/org/hibernate/test/annotations/HibernateTestCase.java 2010-02-09 12:03:41 UTC (rev 18741)
@@ -29,7 +29,6 @@
import java.lang.reflect.Modifier;
import java.sql.Connection;
import java.sql.SQLException;
-import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
@@ -126,7 +125,7 @@
t.fillInStackTrace();
}
closeResources();
- if ( failureExpected != null) {
+ if ( failureExpected != null ) {
StringBuilder builder = new StringBuilder();
if ( StringHelper.isNotEmpty( failureExpected.message() ) ) {
builder.append( failureExpected.message() );
16 years, 2 months
Hibernate SVN: r18740 - core/branches/Branch_3_3/documentation/manual.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2010-02-09 05:18:09 -0500 (Tue, 09 Feb 2010)
New Revision: 18740
Modified:
core/branches/Branch_3_3/documentation/manual/pom.xml
Log:
ues maven-jdocbook-plugin 2.2.2-SNAPSHOT due to MPJDOCBOOK-45
Modified: core/branches/Branch_3_3/documentation/manual/pom.xml
===================================================================
--- core/branches/Branch_3_3/documentation/manual/pom.xml 2010-02-09 09:30:47 UTC (rev 18739)
+++ core/branches/Branch_3_3/documentation/manual/pom.xml 2010-02-09 10:18:09 UTC (rev 18740)
@@ -28,7 +28,7 @@
<plugin>
<groupId>org.jboss.maven.plugins</groupId>
<artifactId>maven-jdocbook-plugin</artifactId>
- <version>2.2.1</version>
+ <version>2.2.2-SNAPSHOT</version>
<extensions>true</extensions>
<dependencies>
16 years, 2 months