Hibernate SVN: r18583 - in core/trunk/annotations/src: test/java/org/hibernate/test/annotations/derivedidentities and 2 other directories.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2010-01-19 13:57:19 -0500 (Tue, 19 Jan 2010)
New Revision: 18583
Added:
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/derivedidentities/e4/
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/derivedidentities/e4/a/
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/derivedidentities/e4/a/DerivedIdentitySimpleParentSimpleDepTest.java
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/derivedidentities/e4/a/MedicalHistory.java
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/derivedidentities/e4/a/Person.java
Modified:
core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationBinder.java
core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationConfiguration.java
core/trunk/annotations/src/main/java/org/hibernate/cfg/ExtendedMappings.java
core/trunk/annotations/src/main/java/org/hibernate/cfg/PropertyContainer.java
Log:
HHH-4529 Support for basic @MapsId on simple id on both parent and derived (example 4.a). However I am losing the creation of the FK constraint.
Modified: core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationBinder.java
===================================================================
--- core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationBinder.java 2010-01-19 18:50:29 UTC (rev 18582)
+++ core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationBinder.java 2010-01-19 18:57:19 UTC (rev 18583)
@@ -56,6 +56,7 @@
import javax.persistence.ManyToOne;
import javax.persistence.MapKey;
import javax.persistence.MappedSuperclass;
+import javax.persistence.MapsId;
import javax.persistence.NamedNativeQueries;
import javax.persistence.NamedNativeQuery;
import javax.persistence.NamedQueries;
@@ -891,7 +892,7 @@
boolean hasIdentifier = false;
for ( int index = 0; index < deep; index++ ) {
- PropertyContainer properyContainer = new PropertyContainer( classesToProcess.get( index ) );
+ PropertyContainer properyContainer = new PropertyContainer( classesToProcess.get( index ), clazzToProcess );
boolean currentHasIdentifier = addElementsOfClass( elements, accessType, properyContainer, mappings );
hasIdentifier = hasIdentifier || currentHasIdentifier;
}
@@ -1116,7 +1117,7 @@
Collection<XProperty> properties = propertyContainer.getProperties( accessType );
for ( XProperty p : properties ) {
final boolean currentHasIdentifier = addProperty(
- propertyContainer.getXClass(), p, elements, accessType.getType(), mappings
+ propertyContainer, p, elements, accessType.getType(), mappings
);
hasIdentifier = hasIdentifier || currentHasIdentifier;
}
@@ -1124,9 +1125,11 @@
}
private static boolean addProperty(
- XClass declaringClass, XProperty property, List<PropertyData> annElts,
+ PropertyContainer propertyContainer, XProperty property, List<PropertyData> annElts,
String propertyAccessor, ExtendedMappings mappings
) {
+ final XClass declaringClass = propertyContainer.getDeclaringClass();
+ final XClass entity = propertyContainer.getEntityAtStake();
boolean hasIdentifier;
PropertyData propertyAnnotatedElement = new PropertyInferredData(
declaringClass, property, propertyAccessor,
@@ -1145,6 +1148,9 @@
annElts.add( propertyAnnotatedElement );
hasIdentifier = false;
}
+ if ( element.isAnnotationPresent( MapsId.class ) ) {
+ mappings.addPropertyAnnotatedWithMapsId( entity, propertyAnnotatedElement );
+ }
return hasIdentifier;
}
@@ -1166,7 +1172,7 @@
* ordering does not matter
*/
Ejb3Column[] columns = null;
- Ejb3JoinColumn[] joinColumns = null;
+
log.debug(
"Processing annotations of {}.{}", propertyHolder.getEntityName(), inferredData.getPropertyName()
);
@@ -1183,36 +1189,11 @@
}
return;
}
+ Ejb3JoinColumn[] joinColumns = buildExplicitJoinColumns(
+ propertyHolder, property, inferredData, entityBinder, mappings
+ );
- //process @JoinColumn(s) before @Column(s) to handle collection of entities properly
- {
- JoinColumn[] anns = null;
- if ( property.isAnnotationPresent( JoinColumn.class ) ) {
- anns = new JoinColumn[] { property.getAnnotation( JoinColumn.class ) };
- }
- else if ( property.isAnnotationPresent( JoinColumns.class ) ) {
- JoinColumns ann = property.getAnnotation( JoinColumns.class );
- anns = ann.value();
- int length = anns.length;
- if ( length == 0 ) {
- throw new AnnotationException( "Cannot bind an empty @JoinColumns" );
- }
- }
- if ( anns != null ) {
- joinColumns = Ejb3JoinColumn.buildJoinColumns(
- anns, null, entityBinder.getSecondaryTables(),
- propertyHolder, inferredData.getPropertyName(), mappings
- );
- }
- else if ( property.isAnnotationPresent( JoinColumnsOrFormulas.class ) ) {
- JoinColumnsOrFormulas ann = property.getAnnotation( JoinColumnsOrFormulas.class );
- joinColumns = Ejb3JoinColumn.buildJoinColumnsOrFormulas(
- ann, null, entityBinder.getSecondaryTables(),
- propertyHolder, inferredData.getPropertyName(), mappings
- );
- }
- }
if ( property.isAnnotationPresent( Column.class ) || property.isAnnotationPresent( Formula.class ) ) {
Column ann = property.getAnnotation( Column.class );
Formula formulaAnn = property.getAnnotation( Formula.class );
@@ -1234,30 +1215,9 @@
( property.isAnnotationPresent( ManyToOne.class )
|| property.isAnnotationPresent( OneToOne.class ) )
) {
- JoinTable joinTableAnn = propertyHolder.getJoinTable( property );
- if ( joinTableAnn != null ) {
- joinColumns = Ejb3JoinColumn.buildJoinColumns(
- joinTableAnn.inverseJoinColumns(), null, entityBinder.getSecondaryTables(),
- propertyHolder, inferredData.getPropertyName(), mappings
- );
- if ( StringHelper.isEmpty( joinTableAnn.name() ) ) {
- throw new AnnotationException(
- "JoinTable.name() on a @ToOne association has to be explicit: "
- + StringHelper.qualify( propertyHolder.getPath(), inferredData.getPropertyName() )
- );
- }
- }
- else {
- OneToOne oneToOneAnn = property.getAnnotation( OneToOne.class );
- String mappedBy = oneToOneAnn != null ?
- oneToOneAnn.mappedBy() :
- null;
- joinColumns = Ejb3JoinColumn.buildJoinColumns(
- (JoinColumn[]) null,
- mappedBy, entityBinder.getSecondaryTables(),
- propertyHolder, inferredData.getPropertyName(), mappings
- );
- }
+ joinColumns = buildDefaultJoinColumnsForXToOne(
+ propertyHolder, property, inferredData, entityBinder, mappings
+ );
}
else if ( joinColumns == null &&
( property.isAnnotationPresent( OneToMany.class )
@@ -1843,6 +1803,69 @@
}
}
+ private static Ejb3JoinColumn[] buildDefaultJoinColumnsForXToOne(PropertyHolder propertyHolder, XProperty property, PropertyData inferredData, EntityBinder entityBinder, ExtendedMappings mappings) {
+ Ejb3JoinColumn[] joinColumns;
+ JoinTable joinTableAnn = propertyHolder.getJoinTable( property );
+ if ( joinTableAnn != null ) {
+ joinColumns = Ejb3JoinColumn.buildJoinColumns(
+ joinTableAnn.inverseJoinColumns(), null, entityBinder.getSecondaryTables(),
+ propertyHolder, inferredData.getPropertyName(), mappings
+ );
+ if ( StringHelper.isEmpty( joinTableAnn.name() ) ) {
+ throw new AnnotationException(
+ "JoinTable.name() on a @ToOne association has to be explicit: "
+ + StringHelper.qualify( propertyHolder.getPath(), inferredData.getPropertyName() )
+ );
+ }
+ }
+ else {
+ OneToOne oneToOneAnn = property.getAnnotation( OneToOne.class );
+ String mappedBy = oneToOneAnn != null ?
+ oneToOneAnn.mappedBy() :
+ null;
+ joinColumns = Ejb3JoinColumn.buildJoinColumns(
+ ( JoinColumn[]) null,
+ mappedBy, entityBinder.getSecondaryTables(),
+ propertyHolder, inferredData.getPropertyName(), mappings
+ );
+ }
+ return joinColumns;
+ }
+
+ private static Ejb3JoinColumn[] buildExplicitJoinColumns(PropertyHolder propertyHolder, XProperty property, PropertyData inferredData, EntityBinder entityBinder, ExtendedMappings mappings) {
+ //process @JoinColumn(s) before @Column(s) to handle collection of entities properly
+ Ejb3JoinColumn[] joinColumns = null;
+ {
+ JoinColumn[] anns = null;
+
+ if ( property.isAnnotationPresent( JoinColumn.class ) ) {
+ anns = new JoinColumn[] { property.getAnnotation( JoinColumn.class ) };
+ }
+ else if ( property.isAnnotationPresent( JoinColumns.class ) ) {
+ JoinColumns ann = property.getAnnotation( JoinColumns.class );
+ anns = ann.value();
+ int length = anns.length;
+ if ( length == 0 ) {
+ throw new AnnotationException( "Cannot bind an empty @JoinColumns" );
+ }
+ }
+ if ( anns != null ) {
+ joinColumns = Ejb3JoinColumn.buildJoinColumns(
+ anns, null, entityBinder.getSecondaryTables(),
+ propertyHolder, inferredData.getPropertyName(), mappings
+ );
+ }
+ else if ( property.isAnnotationPresent( JoinColumnsOrFormulas.class ) ) {
+ JoinColumnsOrFormulas ann = property.getAnnotation( JoinColumnsOrFormulas.class );
+ joinColumns = Ejb3JoinColumn.buildJoinColumnsOrFormulas(
+ ann, null, entityBinder.getSecondaryTables(),
+ propertyHolder, inferredData.getPropertyName(), mappings
+ );
+ }
+ }
+ return joinColumns;
+ }
+
//TODO move that to collection binder?
private static void bindJoinedTableAssociation(
XProperty property, ExtendedMappings mappings, EntityBinder entityBinder,
@@ -1979,6 +2002,7 @@
inferredData, propertyHolder, mappings
);
+ final XClass entityXClass = inferredData.getPropertyClass();
List<PropertyData> classElements = new ArrayList<PropertyData>();
XClass returnedClassOrElement = inferredData.getClassOrElement();
@@ -1989,25 +2013,25 @@
baseClassElements = new ArrayList<PropertyData>();
baseReturnedClassOrElement = baseInferredData.getClassOrElement();
bindTypeDefs(baseReturnedClassOrElement, mappings);
- PropertyContainer propContainer = new PropertyContainer( baseReturnedClassOrElement );
+ PropertyContainer propContainer = new PropertyContainer( baseReturnedClassOrElement, entityXClass );
addElementsOfClass( baseClassElements, propertyAccessor, propContainer, mappings );
}
//embeddable elements can have type defs
bindTypeDefs(returnedClassOrElement, mappings);
- PropertyContainer propContainer = new PropertyContainer( returnedClassOrElement );
+ PropertyContainer propContainer = new PropertyContainer( returnedClassOrElement, entityXClass );
addElementsOfClass( classElements, propertyAccessor, propContainer, mappings);
//add elements of the embeddable superclass
- XClass superClass = inferredData.getPropertyClass().getSuperclass();
+ XClass superClass = entityXClass.getSuperclass();
while ( superClass != null && superClass.isAnnotationPresent( MappedSuperclass.class ) ) {
//FIXME: proper support of typevariables incl var resolved at upper levels
- propContainer = new PropertyContainer( superClass );
+ propContainer = new PropertyContainer( superClass, entityXClass );
addElementsOfClass( classElements, propertyAccessor, propContainer, mappings );
superClass = superClass.getSuperclass();
}
if ( baseClassElements != null ) {
- if ( !hasIdClassAnnotations( inferredData.getPropertyClass() ) ) {
+ if ( !hasIdClassAnnotations( entityXClass ) ) {
for ( int i = 0; i < classElements.size(); i++ ) {
classElements.set( i, baseClassElements.get( i ) ); //this works since they are in the same order
}
@@ -2082,6 +2106,22 @@
setupComponentTuplizer( property, componentId );
}
else {
+ final XClass persistentXClass;
+ try {
+ persistentXClass = mappings.getReflectionManager()
+ .classForName( persistentClassName, AnnotationBinder.class );
+ }
+ catch ( ClassNotFoundException e ) {
+ throw new AssertionFailure( "Persistence class name cannot be converted into a Class", e);
+ }
+ final PropertyData annotatedWithMapsId = mappings.getPropertyAnnotatedWithMapsId( persistentXClass, "" );
+ if ( annotatedWithMapsId != null ) {
+ columns = buildExplicitJoinColumns( propertyHolder, annotatedWithMapsId.getProperty(), annotatedWithMapsId, entityBinder, mappings );
+ if (columns == null) {
+ columns = buildDefaultJoinColumnsForXToOne( propertyHolder, annotatedWithMapsId.getProperty(), annotatedWithMapsId, entityBinder, mappings );
+ }
+ }
+
for (Ejb3Column column : columns) {
column.forceNotNull(); //this is an id
}
Modified: core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationConfiguration.java
===================================================================
--- core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationConfiguration.java 2010-01-19 18:50:29 UTC (rev 18582)
+++ core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationConfiguration.java 2010-01-19 18:57:19 UTC (rev 18583)
@@ -46,6 +46,7 @@
import javax.persistence.Embeddable;
import javax.persistence.Entity;
import javax.persistence.MappedSuperclass;
+import javax.persistence.MapsId;
import org.dom4j.Attribute;
import org.dom4j.Document;
@@ -64,6 +65,7 @@
import org.hibernate.HibernateException;
import org.hibernate.Interceptor;
import org.hibernate.MappingException;
+import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.annotations.AnyMetaDef;
import org.hibernate.annotations.common.reflection.MetadataProvider;
@@ -141,6 +143,7 @@
private transient ReflectionManager reflectionManager;
private boolean isDefaultProcessed = false;
private boolean isValidatorNotPresentLogged;
+ private Map<XClass,Map<String,PropertyData>> propertiesAnnotatedWithMapsId;
public AnnotationConfiguration() {
super();
@@ -279,6 +282,7 @@
namingStrategy = EJB3NamingStrategy.INSTANCE;
setEntityResolver( new EJB3DTDEntityResolver() );
anyMetaDefs = new HashMap<String, AnyMetaDef>();
+ propertiesAnnotatedWithMapsId = new HashMap<XClass, Map<String,PropertyData>>();
reflectionManager = new JavaReflectionManager();
( ( MetadataProviderInjector ) reflectionManager ).setMetadataProvider( new JPAMetadataProvider() );
@@ -1271,6 +1275,20 @@
return inSecondPass;
}
+ public PropertyData getPropertyAnnotatedWithMapsId(XClass entityType, String propertyName) {
+ final Map<String, PropertyData> map = propertiesAnnotatedWithMapsId.get( entityType );
+ return map == null ? null : map.get( propertyName );
+ }
+
+ public void addPropertyAnnotatedWithMapsId(XClass entityType, PropertyData property) {
+ Map<String, PropertyData> map = propertiesAnnotatedWithMapsId.get( entityType );
+ if (map == null) {
+ map = new HashMap<String, PropertyData>();
+ propertiesAnnotatedWithMapsId.put( entityType, map );
+ }
+ map.put( property.getProperty().getAnnotation( MapsId.class ).value(), property );
+ }
+
public IdGenerator getGenerator(String name) {
return getGenerator( name, null );
}
Modified: core/trunk/annotations/src/main/java/org/hibernate/cfg/ExtendedMappings.java
===================================================================
--- core/trunk/annotations/src/main/java/org/hibernate/cfg/ExtendedMappings.java 2010-01-19 18:50:29 UTC (rev 18582)
+++ core/trunk/annotations/src/main/java/org/hibernate/cfg/ExtendedMappings.java 2010-01-19 18:57:19 UTC (rev 18583)
@@ -171,4 +171,12 @@
public AnyMetaDef getAnyMetaDef(String name);
public boolean isInSecondPass();
+
+ /**
+ * Return the property annotated with @MapsId("propertyName") if any.
+ * Null otherwise
+ */
+ public PropertyData getPropertyAnnotatedWithMapsId(XClass entityType, String propertyName);
+
+ public void addPropertyAnnotatedWithMapsId(XClass entityType, PropertyData property);
}
\ No newline at end of file
Modified: core/trunk/annotations/src/main/java/org/hibernate/cfg/PropertyContainer.java
===================================================================
--- core/trunk/annotations/src/main/java/org/hibernate/cfg/PropertyContainer.java 2010-01-19 18:50:29 UTC (rev 18582)
+++ core/trunk/annotations/src/main/java/org/hibernate/cfg/PropertyContainer.java 2010-01-19 18:57:19 UTC (rev 18583)
@@ -1,4 +1,4 @@
-// $Id:$
+// $Id$
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
@@ -55,20 +55,26 @@
class PropertyContainer {
private static final Logger log = LoggerFactory.getLogger( AnnotationBinder.class );
+ private final XClass entityAtStake;
private final TreeMap<String, XProperty> fieldAccessMap;
private final TreeMap<String, XProperty> propertyAccessMap;
private final XClass xClass;
private final AccessType explicitClassDefinedAccessType;
- PropertyContainer(XClass clazz) {
+ PropertyContainer(XClass clazz, XClass entityAtStake) {
this.xClass = clazz;
+ this.entityAtStake = entityAtStake;
fieldAccessMap = initProperties( AccessType.FIELD );
propertyAccessMap = initProperties( AccessType.PROPERTY );
explicitClassDefinedAccessType = determineClassDefinedAccessStrategy();
checkForJpaAccess();
}
- public XClass getXClass() {
+ public XClass getEntityAtStake() {
+ return entityAtStake;
+ }
+
+ public XClass getDeclaringClass() {
return xClass;
}
Added: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/derivedidentities/e4/a/DerivedIdentitySimpleParentSimpleDepTest.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/derivedidentities/e4/a/DerivedIdentitySimpleParentSimpleDepTest.java (rev 0)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/derivedidentities/e4/a/DerivedIdentitySimpleParentSimpleDepTest.java 2010-01-19 18:57:19 UTC (rev 18583)
@@ -0,0 +1,42 @@
+package org.hibernate.test.annotations.derivedidentities.e4.a;
+
+import org.hibernate.Session;
+import org.hibernate.test.annotations.TestCase;
+import org.hibernate.test.annotations.derivedidentities.e1.b.Dependent;
+import org.hibernate.test.annotations.derivedidentities.e1.b.DependentId;
+import org.hibernate.test.annotations.derivedidentities.e1.b.Employee;
+import org.hibernate.test.util.SchemaUtil;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class DerivedIdentitySimpleParentSimpleDepTest extends TestCase {
+
+ public void testIt() throws Exception {
+ assertTrue( SchemaUtil.isColumnPresent( "MedicalHistory", "FK", getCfg() ) );
+ assertTrue( ! SchemaUtil.isColumnPresent( "MedicalHistory", "id", getCfg() ) );
+ Person e = new Person();
+ e.ssn = "aaa";
+ Session s = openSession( );
+ s.getTransaction().begin();
+ s.persist( e );
+ MedicalHistory d = new MedicalHistory();
+ d.patient = e;
+ d.id = "aaa"; //FIXME not needed when foreign is enabled
+ s.persist( d );
+ s.flush();
+ s.clear();
+ d = (MedicalHistory) s.get( MedicalHistory.class, d.id );
+ assertEquals( d.id, d.patient.ssn );
+ s.getTransaction().rollback();
+ s.close();
+ }
+
+ @Override
+ protected Class<?>[] getMappings() {
+ return new Class<?>[] {
+ MedicalHistory.class,
+ Person.class
+ };
+ }
+}
\ No newline at end of file
Added: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/derivedidentities/e4/a/MedicalHistory.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/derivedidentities/e4/a/MedicalHistory.java (rev 0)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/derivedidentities/e4/a/MedicalHistory.java 2010-01-19 18:57:19 UTC (rev 18583)
@@ -0,0 +1,20 @@
+package org.hibernate.test.annotations.derivedidentities.e4.a;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.MapsId;
+import javax.persistence.OneToOne;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@Entity
+public class MedicalHistory {
+ @Id
+ String id; // overriding not allowed ... // default join column name is overridden @MapsId
+ @JoinColumn(name = "FK")
+ @MapsId
+ @OneToOne
+ Person patient;
+}
Added: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/derivedidentities/e4/a/Person.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/derivedidentities/e4/a/Person.java (rev 0)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/derivedidentities/e4/a/Person.java 2010-01-19 18:57:19 UTC (rev 18583)
@@ -0,0 +1,13 @@
+package org.hibernate.test.annotations.derivedidentities.e4.a;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@Entity
+public class Person {
+ @Id
+ String ssn;
+}
\ No newline at end of file
15 years
Hibernate SVN: r18582 - in core/trunk/annotations/src/test/java/org/hibernate/test/annotations: idclassgeneratedvalue and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-01-19 13:50:29 -0500 (Tue, 19 Jan 2010)
New Revision: 18582
Added:
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclassgeneratedvalue/
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclassgeneratedvalue/IdClassGeneratedValueTest.java
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclassgeneratedvalue/Simple.java
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclassgeneratedvalue/Simple2.java
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclassgeneratedvalue/SimplePK.java
Log:
HHH-4552 - Support generated value within composite keys
Added: 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 (rev 0)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclassgeneratedvalue/IdClassGeneratedValueTest.java 2010-01-19 18:50:29 UTC (rev 18582)
@@ -0,0 +1,134 @@
+/*
+ * 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.test.annotations.idclassgeneratedvalue;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+import org.hibernate.test.annotations.TestCase;
+
+/**
+ * A test.
+ *
+ * @author <a href="mailto:stale.pedersen@jboss.org">Stale W. Pedersen</a>
+ */
+public class IdClassGeneratedValueTest extends TestCase {
+
+ @SuppressWarnings({ "unchecked" })
+ public void testBaseLine() {
+ Session s = openSession();
+ s.beginTransaction();
+ Simple s1 = new Simple( 1L, 2L, 10 );
+ s.persist( s1 );
+ Simple s2 = new Simple( 2L, 3L, 20 );
+ s.persist( s2 );
+ s.getTransaction().commit();
+ s.close();
+
+ s = openSession();
+ s.beginTransaction();
+ List<Simple> simpleList = s.createQuery( "select s from Simple s" ).list();
+ assertEquals( simpleList.size(), 2 );
+ s1 = (Simple) s.load( Simple.class, new SimplePK( 1L, 2L ) );
+ assertEquals( s1.getQuantity(), 10 );
+ s.clear();
+ s.createQuery( "delete Simple" ).executeUpdate();
+ s.getTransaction().commit();
+ s.close();
+ }
+
+ @SuppressWarnings({ "unchecked" })
+ public void testSingleGeneratedValue() {
+ Session s = openSession();
+ s.beginTransaction();
+ Simple2 s1 = new Simple2( 200L, 10 );
+ s.persist( s1 );
+ Long s1Id1 = s1.getId1();
+ Simple2 s2 = new Simple2( 300L, 20 );
+ s.persist( s2 );
+ s.getTransaction().commit();
+ s.close();
+
+ s = openSession();
+ s.beginTransaction();
+ List<Simple> simpleList = s.createQuery( "select s from Simple2 s" ).list();
+ assertEquals( simpleList.size(), 2 );
+ s1 = (Simple2) s.load( Simple2.class, new SimplePK( s1Id1, 2L ) );
+ assertEquals( s1.getQuantity(), 10 );
+ s.clear();
+ s.createQuery( "delete Simple2" ).executeUpdate();
+ s.getTransaction().commit();
+ 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[] getMappings() {
+ return new Class[] {
+// Customer.class,
+// CustomerInventory.class,
+// Item.class,
+ Simple.class,
+ Simple2.class
+ };
+ }
+}
Property changes on: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclassgeneratedvalue/IdClassGeneratedValueTest.java
___________________________________________________________________
Name: svn:executable
+ *
Added: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclassgeneratedvalue/Simple.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclassgeneratedvalue/Simple.java (rev 0)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclassgeneratedvalue/Simple.java 2010-01-19 18:50:29 UTC (rev 18582)
@@ -0,0 +1,77 @@
+/*
+ * 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.test.annotations.idclassgeneratedvalue;
+
+import java.io.Serializable;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.Table;
+
+import org.hibernate.annotations.GenericGenerator;
+
+/**
+ * A Simple entity class.
+ *
+ * @author <a href="mailto:stale.pedersen@jboss.org">Stale W. Pedersen</a>
+ */
+@Entity
+(a)IdClass(SimplePK.class)
+@SuppressWarnings("serial")
+public class Simple implements Serializable {
+ @Id
+ private Long id1;
+
+ @Id
+ private Long id2;
+
+ private int quantity;
+
+ public Simple() {
+ }
+
+ public Simple(Long id1, Long id2, int quantity) {
+ this.id1 = id1;
+ this.id2 = id2;
+ this.quantity = quantity;
+ }
+
+ public Long getId1() {
+ return id1;
+ }
+
+ public Long getId2() {
+ return id2;
+ }
+
+ public int getQuantity() {
+ return quantity;
+ }
+
+ public void setQuantity(int quantity) {
+ this.quantity = quantity;
+ }
+}
Added: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclassgeneratedvalue/Simple2.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclassgeneratedvalue/Simple2.java (rev 0)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclassgeneratedvalue/Simple2.java 2010-01-19 18:50:29 UTC (rev 18582)
@@ -0,0 +1,78 @@
+/*
+ * 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.test.annotations.idclassgeneratedvalue;
+
+import java.io.Serializable;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.Table;
+
+import org.hibernate.annotations.GenericGenerator;
+
+/**
+ * The {@link Simple} entity redone with a generated value {@link #id1} }as part of its
+ * composite pk
+ *
+ * @author <a href="mailto:stale.pedersen@jboss.org">Stale W. Pedersen</a>
+ */
+@Entity
+(a)IdClass(SimplePK.class)
+@SuppressWarnings("serial")
+public class Simple2 implements Serializable {
+ @Id
+ @GenericGenerator(name = "increment", strategy = "increment")
+ @GeneratedValue(generator = "increment")
+ private Long id1;
+
+ @Id
+ private Long id2;
+
+ private int quantity;
+
+ public Simple2() {
+ }
+
+ public Simple2(Long id, int quantity) {
+ this.id2 = id;
+ this.quantity = quantity;
+ }
+
+ public Long getId1() {
+ return id1;
+ }
+
+ public Long getId2() {
+ return id2;
+ }
+
+ public int getQuantity() {
+ return quantity;
+ }
+
+ public void setQuantity(int quantity) {
+ this.quantity = quantity;
+ }
+}
\ No newline at end of file
Added: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclassgeneratedvalue/SimplePK.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclassgeneratedvalue/SimplePK.java (rev 0)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/idclassgeneratedvalue/SimplePK.java 2010-01-19 18:50:29 UTC (rev 18582)
@@ -0,0 +1,85 @@
+/*
+ * 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.test.annotations.idclassgeneratedvalue;
+
+import java.io.Serializable;
+
+/**
+ * A SimplePK.
+ *
+ * @author <a href="mailto:stale.pedersen@jboss.org">Stale W. Pedersen</a>
+ */
+public class SimplePK implements Serializable {
+ private final Long id1;
+ private final Long id2;
+ // AnnotationBinder (incorrectly) requires this to be transient; see HHH-4819 and HHH-4820
+ private final transient int cachedHashCode;
+
+ private SimplePK() {
+ // required by Hibernate, though never used; see HHH-4818
+ id1 = null;
+ id2 = null;
+ cachedHashCode = super.hashCode();
+ }
+
+ public SimplePK(Long id1, Long id2) {
+ this.id1 = id1;
+ this.id2 = id2;
+ this.cachedHashCode = calculateHashCode();
+ }
+
+ private int calculateHashCode() {
+ int result = id1.hashCode();
+ result = 31 * result + id2.hashCode();
+ return result;
+ }
+
+ public Long getId1() {
+ return id1;
+ }
+
+ public Long getId2() {
+ return id2;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if ( this == o ) {
+ return true;
+ }
+ if ( o == null || getClass() != o.getClass() ) {
+ return false;
+ }
+
+ SimplePK simplePK = (SimplePK) o;
+
+ return id1.equals( simplePK.id1 )
+ && id2.equals( simplePK.id2 );
+ }
+
+ @Override
+ public int hashCode() {
+ return cachedHashCode;
+ }
+}
15 years
Hibernate SVN: r18581 - core/trunk/annotations/src/main/java/org/hibernate/cfg.
by hibernate-commits@lists.jboss.org
Author: smarlow(a)redhat.com
Date: 2010-01-19 10:43:00 -0500 (Tue, 19 Jan 2010)
New Revision: 18581
Modified:
core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationBinder.java
Log:
HHH-4725 implement orphanRemoval for OneToOne.
Modified: core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationBinder.java
===================================================================
--- core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationBinder.java 2010-01-19 14:34:11 UTC (rev 18580)
+++ core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationBinder.java 2010-01-19 15:43:00 UTC (rev 18581)
@@ -1455,7 +1455,7 @@
}
}
bindOneToOne(
- getCascadeStrategy( ann.cascade(), hibernateCascade, false),
+ getCascadeStrategy( ann.cascade(), hibernateCascade, ann.orphanRemoval()),
joinColumns,
ann.optional(),
getFetchMode( ann.fetch() ),
@@ -2147,6 +2147,10 @@
) {
//All FK columns should be in the same table
org.hibernate.mapping.ManyToOne value = new org.hibernate.mapping.ManyToOne( columns[0].getTable() );
+ // This is a @OneToOne mapped to a physical o.h.mapping.ManyToOne
+ if ( unique ) {
+ value.markAsLogicalOneToOne();
+ }
if ( isDefault( targetEntity, mappings ) ) {
value.setReferencedEntityName( inferredData.getClassOrElementName() );
}
15 years
Hibernate SVN: r18580 - search/trunk/src/test/java/org/hibernate/search/test/jpa.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2010-01-19 09:34:11 -0500 (Tue, 19 Jan 2010)
New Revision: 18580
Modified:
search/trunk/src/test/java/org/hibernate/search/test/jpa/JPATestCase.java
Log:
HSEARCH-448 - Updated JPATestCase
Modified: search/trunk/src/test/java/org/hibernate/search/test/jpa/JPATestCase.java
===================================================================
--- search/trunk/src/test/java/org/hibernate/search/test/jpa/JPATestCase.java 2010-01-19 04:26:20 UTC (rev 18579)
+++ search/trunk/src/test/java/org/hibernate/search/test/jpa/JPATestCase.java 2010-01-19 14:34:11 UTC (rev 18580)
@@ -34,6 +34,7 @@
import javax.persistence.Persistence;
import org.hibernate.cfg.Environment;
+import org.hibernate.ejb.AvailableSettings;
import org.hibernate.ejb.HibernatePersistence;
import org.hibernate.search.store.RAMDirectoryProvider;
import org.apache.lucene.analysis.StopAnalyzer;
@@ -101,23 +102,23 @@
ArrayList<Class> classes = new ArrayList<Class>();
classes.addAll( Arrays.asList( getAnnotatedClasses() ) );
- config.put( HibernatePersistence.LOADED_CLASSES, classes );
+ config.put( AvailableSettings.LOADED_CLASSES, classes );
for ( Map.Entry<Class, String> entry : getCachedClasses().entrySet() ) {
config.put(
- HibernatePersistence.CLASS_CACHE_PREFIX + "." + entry.getKey().getName(),
+ AvailableSettings.CLASS_CACHE_PREFIX + "." + entry.getKey().getName(),
entry.getValue()
);
}
for ( Map.Entry<String, String> entry : getCachedCollections().entrySet() ) {
config.put(
- HibernatePersistence.COLLECTION_CACHE_PREFIX + "." + entry.getKey(),
+ AvailableSettings.COLLECTION_CACHE_PREFIX + "." + entry.getKey(),
entry.getValue()
);
}
if ( getEjb3DD().length > 0 ) {
ArrayList<String> dds = new ArrayList<String>();
dds.addAll( Arrays.asList( getEjb3DD() ) );
- config.put( HibernatePersistence.XML_FILE_NAMES, dds );
+ config.put( AvailableSettings.XML_FILE_NAMES, dds );
}
//Search config
15 years
Hibernate SVN: r18579 - core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/persister/entity.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2010-01-18 23:26:20 -0500 (Mon, 18 Jan 2010)
New Revision: 18579
Modified:
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/persister/entity/UnionSubclassEntityPersister.java
Log:
JBPAPP-2276 HHH-3338 - Order of attributes in generated SQL query is dependent on Java version
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/persister/entity/UnionSubclassEntityPersister.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/persister/entity/UnionSubclassEntityPersister.java 2010-01-19 03:09:22 UTC (rev 18578)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/persister/entity/UnionSubclassEntityPersister.java 2010-01-19 04:26:20 UTC (rev 18579)
@@ -28,6 +28,7 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.LinkedHashSet;
import java.util.Map;
import java.util.ArrayList;
@@ -56,7 +57,7 @@
/**
* Implementation of the "table-per-concrete-class" or "roll-down" mapping
- * strategy for an entity and its inheritence hierarchy.
+ * strategy for an entity and its inheritance hierarchy.
*
* @author Gavin King
*/
@@ -390,7 +391,7 @@
);
}
- HashSet columns = new HashSet();
+ HashSet columns = new LinkedHashSet();
Iterator titer = model.getSubclassTableClosureIterator();
while ( titer.hasNext() ) {
Table table = (Table) titer.next();
15 years
Hibernate SVN: r18578 - core/trunk/entitymanager/src/main/java/org/hibernate/ejb.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-01-18 22:09:22 -0500 (Mon, 18 Jan 2010)
New Revision: 18578
Modified:
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/Ejb3Configuration.java
Log:
HHH-4669 - Implement JDBC driver properties support
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/Ejb3Configuration.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/Ejb3Configuration.java 2010-01-18 22:05:16 UTC (rev 18577)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/Ejb3Configuration.java 2010-01-19 03:09:22 UTC (rev 18578)
@@ -187,6 +187,24 @@
else if ( StringHelper.isNotEmpty( metadata.getNonJtaDatasource() ) ) {
this.setProperty( Environment.DATASOURCE, metadata.getNonJtaDatasource() );
}
+ else {
+ final String driver = (String) metadata.getProps().get( AvailableSettings.JDBC_DRIVER );
+ if ( StringHelper.isNotEmpty( driver ) ) {
+ this.setProperty( Environment.DRIVER, driver );
+ }
+ final String url = (String) metadata.getProps().get( AvailableSettings.JDBC_URL );
+ if ( StringHelper.isNotEmpty( url ) ) {
+ this.setProperty( Environment.URL, url );
+ }
+ final String user = (String) metadata.getProps().get( AvailableSettings.JDBC_USER );
+ if ( StringHelper.isNotEmpty( user ) ) {
+ this.setProperty( Environment.USER, user );
+ }
+ final String pass = (String) metadata.getProps().get( AvailableSettings.JDBC_PASSWORD );
+ if ( StringHelper.isNotEmpty( pass ) ) {
+ this.setProperty( Environment.PASS, pass );
+ }
+ }
defineTransactionType( metadata.getTransactionType(), workingVars );
if ( metadata.getClasses().size() > 0 ) {
workingVars.put( AvailableSettings.CLASS_NAMES, metadata.getClasses() );
15 years
Hibernate SVN: r18577 - in core/trunk/entitymanager/src: main/java/org/hibernate/ejb/packaging and 3 other directories.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-01-18 17:05:16 -0500 (Mon, 18 Jan 2010)
New Revision: 18577
Added:
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/AvailableSettings.java
Modified:
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/AbstractEntityManagerImpl.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/Ejb3Configuration.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/EntityManagerImpl.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/EventListenerConfigurator.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/HibernatePersistence.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/PersistenceXmlLoader.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/util/NamingHelper.java
core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/PackagedEntityManagerTest.java
core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/TestCase.java
core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/ejb3configuration/InterceptorTest.java
core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/ejb3configuration/TestCase.java
Log:
HHH-4816 - Cleanup JPA setting name constants
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/AbstractEntityManagerImpl.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/AbstractEntityManagerImpl.java 2010-01-18 21:27:25 UTC (rev 18576)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/AbstractEntityManagerImpl.java 2010-01-18 22:05:16 UTC (rev 18577)
@@ -73,7 +73,6 @@
import org.hibernate.proxy.HibernateProxy;
import org.hibernate.transaction.TransactionFactory;
import org.hibernate.transform.BasicTransformerAdapter;
-import org.hibernate.transform.ResultTransformer;
import org.hibernate.util.CollectionHelper;
import org.hibernate.util.JTAHelper;
@@ -85,8 +84,6 @@
@SuppressWarnings("unchecked")
public abstract class AbstractEntityManagerImpl implements HibernateEntityManagerImplementor, Serializable {
private static final Logger log = LoggerFactory.getLogger( AbstractEntityManagerImpl.class );
- private static final String PESSIMISTICLOCKSCOPE = "javax.persistence.lock.scope";
- private static final String PESSIMISTICLOCKTIMEOUT= "javax.persistence.lock.timeout";
private EntityManagerFactoryImpl entityManagerFactory;
protected transient TransactionImpl tx = new TransactionImpl( this );
@@ -688,12 +685,12 @@
lockOptions.setLockMode(getLockMode(lockModeType));
if ( properties != null ) {
// lockOptions scope will default to false (PessimisticLockScope.NORMAL)
- Object value = properties.get(PESSIMISTICLOCKSCOPE);
+ Object value = properties.get( AvailableSettings.LOCK_SCOPE );
if ( value instanceof String && PessimisticLockScope.valueOf((String) value) == PessimisticLockScope.EXTENDED) {
lockOptions.setScope(true);
}
// lockOptions timeout will default to LockOptions.FOREVER_WAIT
- value = properties.get(PESSIMISTICLOCKTIMEOUT);
+ value = properties.get( AvailableSettings.LOCK_TIMEOUT );
if ( value instanceof String ) {
int timeout = Integer.parseInt((String) value);
if ( timeout < 0 ) {
Added: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/AvailableSettings.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/AvailableSettings.java (rev 0)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/AvailableSettings.java 2010-01-18 22:05:16 UTC (rev 18577)
@@ -0,0 +1,241 @@
+/*
+ * 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.ejb;
+
+/**
+ * Defines the available HEM settings, both JPA-defined as well as Hibernate-specific
+ * <p/>
+ * NOTE : Does *not* include {@link org.hibernate.cfg.Environment} values.
+ *
+ * @author Steve Ebersole
+ */
+public class AvailableSettings {
+
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ // JPA defined settings
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ /**
+ * THe name of the {@link javax.persistence.spi.PersistenceProvider} implementor
+ * <p/>
+ * See JPA 2 sections 9.4.3 and 8.2.1.4
+ */
+ public static final String PROVIDER = "javax.persistence.provider";
+
+ /**
+ * The type of transactions supported by the entity managers.
+ * <p/>
+ * See JPA 2 sections 9.4.3 and 8.2.1.2
+ */
+ public static final String TRANSACTION_TYPE = "javax.persistence.transactionType";
+
+ /**
+ * The JNDI name of a JTA {@link javax.sql.DataSource}.
+ * <p/>
+ * See JPA 2 sections 9.4.3 and 8.2.1.5
+ */
+ public static final String JTA_DATASOURCE = "javax.persistence.jtaDataSource";
+
+ /**
+ * The JNDI name of a non-JTA {@link javax.sql.DataSource}.
+ * <p/>
+ * See JPA 2 sections 9.4.3 and 8.2.1.5
+ */
+ public static final String NON_JTA_DATASOURCE = "javax.persistence.nonJtaDataSource";
+
+ /**
+ * The name of a JDBC driver to use to connect to the database.
+ * <p/>
+ * Used in conjunction with {@link #JDBC_URL}, {@link #JDBC_USER} and {@link #JDBC_PASSWORD}
+ * to define how to make connections to the database in lieu of
+ * a datasource (either {@link #JTA_DATASOURCE} or {@link #NON_JTA_DATASOURCE}).
+ * <p/>
+ * See section 8.2.1.9
+ */
+ public static final String JDBC_DRIVER = "javax.persistence.jdbc.driver";
+
+ /**
+ * The JDBC connection url to use to connect to the database.
+ * <p/>
+ * Used in conjunction with {@link #JDBC_DRIVER}, {@link #JDBC_USER} and {@link #JDBC_PASSWORD}
+ * to define how to make connections to the database in lieu of
+ * a datasource (either {@link #JTA_DATASOURCE} or {@link #NON_JTA_DATASOURCE}).
+ * <p/>
+ * See section 8.2.1.9
+ */
+ public static final String JDBC_URL = "javax.persistence.jdbc.url";
+
+ /**
+ * The JDBC connection user name.
+ * <p/>
+ * Used in conjunction with {@link #JDBC_DRIVER}, {@link #JDBC_URL} and {@link #JDBC_PASSWORD}
+ * to define how to make connections to the database in lieu of
+ * a datasource (either {@link #JTA_DATASOURCE} or {@link #NON_JTA_DATASOURCE}).
+ * <p/>
+ * See section 8.2.1.9
+ */
+ public static final String JDBC_USER = "javax.persistence.jdbc.user";
+
+ /**
+ * The JDBC connection password.
+ * <p/>
+ * Used in conjunction with {@link #JDBC_DRIVER}, {@link #JDBC_URL} and {@link #JDBC_USER}
+ * to define how to make connections to the database in lieu of
+ * a datasource (either {@link #JTA_DATASOURCE} or {@link #NON_JTA_DATASOURCE}).
+ * <p/>
+ * See JPA 2 section 8.2.1.9
+ */
+ public static final String JDBC_PASSWORD = "javax.persistence.jdbc.password";
+
+ /**
+ * Used to indicate whether second-level (what JPA terms shared cache) caching is
+ * enabled as per the rules defined in JPA 2 section 3.1.7.
+ * <p/>
+ * See JPA 2 sections 9.4.3 and 8.2.1.7
+ */
+ public static final String SHARED_CACHE_MODE = "javax.persistence.sharedCache.mode";
+
+ /**
+ * Used to indicate what form of automatic validation is in effect as per rules defined
+ * in JPA 2 section 3.6.1.1
+ * <p/>
+ * See JPA 2 sections 9.4.3 and 8.2.1.8
+ */
+ public static final String VALIDATION_MODE = "javax.persistence.validation.mode";
+
+ /**
+ * Used to request (hint) a pessimistic lock scope.
+ * <p/>
+ * See JPA 2 sections 8.2.1.9 and 3.4.4.3
+ */
+ public static final String LOCK_SCOPE = "javax.persistence.lock.scope";
+
+ /**
+ * Used to request (hint) a pessimistic lock timeout (in milliseconds).
+ * <p/>
+ * See JPA 2 sections 8.2.1.9 and 3.4.4.3
+ */
+ public static final String LOCK_TIMEOUT = "javax.persistence.lock.timeout";
+
+ /**
+ * Used to coordinate with bean validators
+ * <p/>
+ * See JPA 2 section 8.2.1.9
+ */
+ public static final String PERSIST_VALIDATION_GROUP = "javax.persistence.validation.group.pre-persist";
+
+ /**
+ * Used to coordinate with bean validators
+ * <p/>
+ * See JPA 2 section 8.2.1.9
+ */
+ public static final String UPDATE_VALIDATION_GROUP = "javax.persistence.validation.group.pre-update";
+
+ /**
+ * Used to coordinate with bean validators
+ * <p/>
+ * See JPA 2 section 8.2.1.9
+ */
+ public static final String REMOVE_VALIDATION_GROUP = "javax.persistence.validation.group.pre-remove";
+
+
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ // Hibernate specific settings
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ /**
+ * JAR autodetection artifacts class, hbm
+ */
+ public static final String AUTODETECTION = "hibernate.archive.autodetection";
+ /**
+ * cfg.xml configuration file used
+ */
+ public static final String CFG_FILE = "hibernate.ejb.cfgfile";
+ /**
+ * Caching configuration should follow the following pattern
+ * hibernate.ejb.classcache.<fully.qualified.Classname> usage[, region]
+ * where usage is the cache strategy used and region the cache region name
+ */
+ public static final String CLASS_CACHE_PREFIX = "hibernate.ejb.classcache";
+ /**
+ * Caching configuration should follow the following pattern
+ * hibernate.ejb.collectioncache.<fully.qualified.Classname>.<role> usage[, region]
+ * where usage is the cache strategy used and region the cache region name
+ */
+ public static final String COLLECTION_CACHE_PREFIX = "hibernate.ejb.collectioncache";
+ /**
+ * Interceptor class name, the class has to have a no-arg constructor
+ * the interceptor instance is shared amongst all EntityManager of a given EntityManagerFactory
+ */
+ public static final String INTERCEPTOR = "hibernate.ejb.interceptor";
+ /**
+ * Interceptor class name, the class has to have a no-arg constructor
+ */
+ public static final String SESSION_INTERCEPTOR = "hibernate.ejb.interceptor.session_scoped";
+ /**
+ * Naming strategy class name, the class has to have a no-arg constructor
+ */
+ public static final String NAMING_STRATEGY = "hibernate.ejb.naming_strategy";
+ /**
+ * Event configuration should follow the following pattern
+ * hibernate.ejb.event.[eventType] f.q.c.n.EventListener1, f.q.c.n.EventListener12 ...
+ */
+ public static final String EVENT_LISTENER_PREFIX = "hibernate.ejb.event";
+ /**
+ * Enable the class file enhancement
+ */
+ public static final String USE_CLASS_ENHANCER = "hibernate.ejb.use_class_enhancer";
+ /**
+ * Whether or not discard persistent context on entityManager.close()
+ * The EJB3 compliant and default choice is false
+ */
+ public static final String DISCARD_PC_ON_CLOSE = "hibernate.ejb.discard_pc_on_close";
+ /**
+ * Consider this as experimental
+ * It is not recommended to set up this property, the configuration is stored
+ * in the JNDI in a serialized form
+ */
+ public static final String CONFIGURATION_JNDI_NAME = "hibernate.ejb.configuration_jndi_name";
+ /**
+ * List of classes names
+ * Internal use only
+ */
+ public static final String CLASS_NAMES = "hibernate.ejb.classes";
+ /**
+ * List of annotated packages
+ * Internal use only
+ */
+ public static final String PACKAGE_NAMES = "hibernate.ejb.packages";
+ /**
+ * List of classes names
+ * Internal use only
+ */
+ public static final String XML_FILE_NAMES = "hibernate.ejb.xml_files";
+ public static final String HBXML_FILES = "hibernate.hbmxml.files";
+ public static final String LOADED_CLASSES = "hibernate.ejb.loaded.classes";
+ public static final String JACC_CONTEXT_ID = "hibernate.jacc.ctx.id";
+ public static final String JACC_PREFIX = "hibernate.jacc";
+ public static final String JACC_ENABLED = "hibernate.jacc.enabled";
+ public static final String PERSISTENCE_UNIT_NAME = "hibernate.ejb.persistenceUnitName";
+}
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/Ejb3Configuration.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/Ejb3Configuration.java 2010-01-18 21:27:25 UTC (rev 18576)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/Ejb3Configuration.java 2010-01-18 22:05:16 UTC (rev 18577)
@@ -1,4 +1,4 @@
-// $Id:$
+// $Id$
/*
* Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
* indicated by the @author tags or express copyright attribution
@@ -178,7 +178,7 @@
log.debug( "Creating Factory: {}", metadata.getName() );
Map workingVars = new HashMap();
- workingVars.put( HibernatePersistence.PERSISTENCE_UNIT_NAME, metadata.getName() );
+ workingVars.put( AvailableSettings.PERSISTENCE_UNIT_NAME, metadata.getName() );
this.persistenceUnitName = metadata.getName();
if ( StringHelper.isNotEmpty( metadata.getJtaDatasource() ) ) {
@@ -189,22 +189,22 @@
}
defineTransactionType( metadata.getTransactionType(), workingVars );
if ( metadata.getClasses().size() > 0 ) {
- workingVars.put( HibernatePersistence.CLASS_NAMES, metadata.getClasses() );
+ workingVars.put( AvailableSettings.CLASS_NAMES, metadata.getClasses() );
}
if ( metadata.getPackages().size() > 0 ) {
- workingVars.put( HibernatePersistence.PACKAGE_NAMES, metadata.getPackages() );
+ workingVars.put( AvailableSettings.PACKAGE_NAMES, metadata.getPackages() );
}
if ( metadata.getMappingFiles().size() > 0 ) {
- workingVars.put( HibernatePersistence.XML_FILE_NAMES, metadata.getMappingFiles() );
+ workingVars.put( AvailableSettings.XML_FILE_NAMES, metadata.getMappingFiles() );
}
if ( metadata.getHbmfiles().size() > 0 ) {
- workingVars.put( HibernatePersistence.HBXML_FILES, metadata.getHbmfiles() );
+ workingVars.put( AvailableSettings.HBXML_FILES, metadata.getHbmfiles() );
}
if ( metadata.getValidationMode() != null) {
- workingVars.put( HibernatePersistence.VALIDATION_MODE, metadata.getValidationMode() );
+ workingVars.put( AvailableSettings.VALIDATION_MODE, metadata.getValidationMode() );
}
if ( metadata.getSharedCacheMode() != null) {
- workingVars.put( HibernatePersistence.SHARED_CACHE_MODE, metadata.getSharedCacheMode() );
+ workingVars.put( AvailableSettings.SHARED_CACHE_MODE, metadata.getSharedCacheMode() );
}
Properties props = new Properties();
props.putAll( metadata.getProps() );
@@ -410,7 +410,7 @@
}
integration = integration != null ? Collections.unmodifiableMap( integration ) : CollectionHelper.EMPTY_MAP;
- String provider = (String) integration.get( HibernatePersistence.PROVIDER );
+ String provider = (String) integration.get( AvailableSettings.PROVIDER );
if ( provider == null ) provider = info.getPersistenceProviderClassName();
if ( provider != null && ! provider.trim().startsWith( IMPLEMENTATION_NAME ) ) {
log.info( "Required a different provider: {}", provider );
@@ -435,7 +435,7 @@
try {
Map workingVars = new HashMap();
- workingVars.put( HibernatePersistence.PERSISTENCE_UNIT_NAME, info.getPersistenceUnitName() );
+ workingVars.put( AvailableSettings.PERSISTENCE_UNIT_NAME, info.getPersistenceUnitName() );
this.persistenceUnitName = info.getPersistenceUnitName();
List<String> entities = new ArrayList<String>( 50 );
if ( info.getManagedClassNames() != null ) entities.addAll( info.getManagedClassNames() );
@@ -473,38 +473,38 @@
addXMLEntities( xmlFiles, info, entities );
//FIXME send the appropriate entites.
- if ( "true".equalsIgnoreCase( properties.getProperty( HibernatePersistence.USE_CLASS_ENHANCER ) ) ) {
+ if ( "true".equalsIgnoreCase( properties.getProperty( AvailableSettings.USE_CLASS_ENHANCER ) ) ) {
info.addTransformer( new InterceptFieldClassFileTransformer( entities ) );
}
- workingVars.put( HibernatePersistence.CLASS_NAMES, entities );
- workingVars.put( HibernatePersistence.PACKAGE_NAMES, packages );
- workingVars.put( HibernatePersistence.XML_FILE_NAMES, xmlFiles );
- if ( hbmFiles.size() > 0 ) workingVars.put( HibernatePersistence.HBXML_FILES, hbmFiles );
+ workingVars.put( AvailableSettings.CLASS_NAMES, entities );
+ workingVars.put( AvailableSettings.PACKAGE_NAMES, packages );
+ workingVars.put( AvailableSettings.XML_FILE_NAMES, xmlFiles );
+ if ( hbmFiles.size() > 0 ) workingVars.put( AvailableSettings.HBXML_FILES, hbmFiles );
//validation-mode
final Object validationMode = info.getValidationMode();
if ( validationMode != null) {
- workingVars.put( HibernatePersistence.VALIDATION_MODE, validationMode );
+ workingVars.put( AvailableSettings.VALIDATION_MODE, validationMode );
}
//shared-cache-mode
final Object sharedCacheMode = info.getSharedCacheMode();
if ( sharedCacheMode != null) {
- workingVars.put( HibernatePersistence.SHARED_CACHE_MODE, sharedCacheMode );
+ workingVars.put( AvailableSettings.SHARED_CACHE_MODE, sharedCacheMode );
}
//datasources
Boolean isJTA = null;
boolean overridenDatasource = false;
- if ( integration.containsKey( HibernatePersistence.JTA_DATASOURCE ) ) {
- String dataSource = (String) integration.get( HibernatePersistence.JTA_DATASOURCE );
+ if ( integration.containsKey( AvailableSettings.JTA_DATASOURCE ) ) {
+ String dataSource = (String) integration.get( AvailableSettings.JTA_DATASOURCE );
overridenDatasource = true;
properties.setProperty( Environment.DATASOURCE, dataSource );
isJTA = Boolean.TRUE;
}
- if ( integration.containsKey( HibernatePersistence.NON_JTA_DATASOURCE ) ) {
- String dataSource = (String) integration.get( HibernatePersistence.NON_JTA_DATASOURCE );
+ if ( integration.containsKey( AvailableSettings.NON_JTA_DATASOURCE ) ) {
+ String dataSource = (String) integration.get( AvailableSettings.NON_JTA_DATASOURCE );
overridenDatasource = true;
properties.setProperty( Environment.DATASOURCE, dataSource );
if (isJTA == null) isJTA = Boolean.FALSE;
@@ -640,7 +640,7 @@
}
else {
throw new PersistenceException( getExceptionHeader() +
- HibernatePersistence.TRANSACTION_TYPE + " of the wrong class type"
+ AvailableSettings.TRANSACTION_TYPE + " of the wrong class type"
+ ": " + overridenTxType.getClass()
);
}
@@ -663,10 +663,10 @@
boolean detectClasses = false;
boolean detectHbm = false;
String detectSetting = overridenProperties != null ?
- (String) overridenProperties.get( HibernatePersistence.AUTODETECTION ) :
+ (String) overridenProperties.get( AvailableSettings.AUTODETECTION ) :
null;
detectSetting = detectSetting == null ?
- properties.getProperty( HibernatePersistence.AUTODETECTION) :
+ properties.getProperty( AvailableSettings.AUTODETECTION) :
detectSetting;
if ( detectSetting == null && excludeIfNotOverriden) {
//not overriden through HibernatePersistence.AUTODETECTION so we comply with the spec excludeUnlistedClasses
@@ -719,10 +719,10 @@
if ( workingVars != null ) {
props.putAll( workingVars );
//remove huge non String elements for a clean props
- props.remove( HibernatePersistence.CLASS_NAMES );
- props.remove( HibernatePersistence.PACKAGE_NAMES );
- props.remove( HibernatePersistence.HBXML_FILES );
- props.remove( HibernatePersistence.LOADED_CLASSES );
+ props.remove( AvailableSettings.CLASS_NAMES );
+ props.remove( AvailableSettings.PACKAGE_NAMES );
+ props.remove( AvailableSettings.HBXML_FILES );
+ props.remove( AvailableSettings.LOADED_CLASSES );
}
configure( props, workingVars );
return buildEntityManagerFactory();
@@ -767,7 +767,7 @@
}
private Class getSessionInterceptorClass(Properties properties) {
- String sessionInterceptorClassname = (String) properties.get( HibernatePersistence.SESSION_INTERCEPTOR );
+ String sessionInterceptorClassname = (String) properties.get( AvailableSettings.SESSION_INTERCEPTOR );
if ( StringHelper.isNotEmpty( sessionInterceptorClassname ) ) {
try {
Class interceptorClass = ReflectHelper.classForName( sessionInterceptorClassname, Ejb3Configuration.class );
@@ -776,15 +776,15 @@
}
catch (ClassNotFoundException e) {
throw new PersistenceException( getExceptionHeader() + "Unable to load "
- + HibernatePersistence.SESSION_INTERCEPTOR + ": " + sessionInterceptorClassname, e);
+ + AvailableSettings.SESSION_INTERCEPTOR + ": " + sessionInterceptorClassname, e);
}
catch (IllegalAccessException e) {
throw new PersistenceException( getExceptionHeader() + "Unable to instanciate "
- + HibernatePersistence.SESSION_INTERCEPTOR + ": " + sessionInterceptorClassname, e);
+ + AvailableSettings.SESSION_INTERCEPTOR + ": " + sessionInterceptorClassname, e);
}
catch (InstantiationException e) {
throw new PersistenceException( getExceptionHeader() + "Unable to instanciate "
- + HibernatePersistence.SESSION_INTERCEPTOR + ": " + sessionInterceptorClassname, e);
+ + AvailableSettings.SESSION_INTERCEPTOR + ": " + sessionInterceptorClassname, e);
}
}
else {
@@ -831,8 +831,8 @@
Properties preparedProperties = prepareProperties( properties, workingVars );
if ( workingVars == null ) workingVars = CollectionHelper.EMPTY_MAP;
- if ( preparedProperties.containsKey( HibernatePersistence.CFG_FILE ) ) {
- String cfgFileName = preparedProperties.getProperty( HibernatePersistence.CFG_FILE );
+ if ( preparedProperties.containsKey( AvailableSettings.CFG_FILE ) ) {
+ String cfgFileName = preparedProperties.getProperty( AvailableSettings.CFG_FILE );
cfg.configure( cfgFileName );
}
@@ -853,24 +853,24 @@
//had to be safe
if ( uncastObject != null && uncastObject instanceof String ) {
String propertyKey = (String) uncastObject;
- if ( propertyKey.startsWith( HibernatePersistence.CLASS_CACHE_PREFIX ) ) {
+ if ( propertyKey.startsWith( AvailableSettings.CLASS_CACHE_PREFIX ) ) {
setCacheStrategy( propertyKey, preparedProperties, true, workingVars );
}
- else if ( propertyKey.startsWith( HibernatePersistence.COLLECTION_CACHE_PREFIX ) ) {
+ else if ( propertyKey.startsWith( AvailableSettings.COLLECTION_CACHE_PREFIX ) ) {
setCacheStrategy( propertyKey, preparedProperties, false, workingVars );
}
- else if ( propertyKey.startsWith( HibernatePersistence.JACC_PREFIX )
- && ! ( propertyKey.equals( HibernatePersistence.JACC_CONTEXT_ID )
- || propertyKey.equals( HibernatePersistence.JACC_ENABLED ) ) ) {
+ else if ( propertyKey.startsWith( AvailableSettings.JACC_PREFIX )
+ && ! ( propertyKey.equals( AvailableSettings.JACC_CONTEXT_ID )
+ || propertyKey.equals( AvailableSettings.JACC_ENABLED ) ) ) {
jaccKeys.add( propertyKey );
}
}
}
- if ( preparedProperties.containsKey( HibernatePersistence.INTERCEPTOR )
+ if ( preparedProperties.containsKey( AvailableSettings.INTERCEPTOR )
&& ( cfg.getInterceptor() == null
|| cfg.getInterceptor().equals( defaultInterceptor ) ) ) {
//cfg.setInterceptor has precedence over configuration file
- String interceptorName = preparedProperties.getProperty( HibernatePersistence.INTERCEPTOR );
+ String interceptorName = preparedProperties.getProperty( AvailableSettings.INTERCEPTOR );
try {
Class interceptor = classForName( interceptorName );
cfg.setInterceptor( (Interceptor) interceptor.newInstance() );
@@ -896,11 +896,11 @@
);
}
}
- if ( preparedProperties.containsKey( HibernatePersistence.NAMING_STRATEGY )
+ if ( preparedProperties.containsKey( AvailableSettings.NAMING_STRATEGY )
&& ( cfg.getNamingStrategy() == null
|| cfg.getNamingStrategy().equals( defaultNamingStrategy ) ) ) {
//cfg.setNamingStrategy has precedence over configuration file
- String namingStrategyName = preparedProperties.getProperty( HibernatePersistence.NAMING_STRATEGY );
+ String namingStrategyName = preparedProperties.getProperty( AvailableSettings.NAMING_STRATEGY );
try {
Class namingStragegy = classForName( namingStrategyName );
cfg.setNamingStrategy( (NamingStrategy) namingStragegy.newInstance() );
@@ -941,36 +941,36 @@
if ( ! "true".equalsIgnoreCase( cfg.getProperty( Environment.AUTOCOMMIT ) ) ) {
log.warn( "{} = false break the EJB3 specification", Environment.AUTOCOMMIT );
}
- discardOnClose = preparedProperties.getProperty( HibernatePersistence.DISCARD_PC_ON_CLOSE )
+ discardOnClose = preparedProperties.getProperty( AvailableSettings.DISCARD_PC_ON_CLOSE )
.equals( "true" );
return this;
}
private void addClassesToSessionFactory(Map workingVars) {
- if ( workingVars.containsKey( HibernatePersistence.CLASS_NAMES ) ) {
+ if ( workingVars.containsKey( AvailableSettings.CLASS_NAMES ) ) {
Collection<String> classNames = (Collection<String>) workingVars.get(
- HibernatePersistence.CLASS_NAMES
+ AvailableSettings.CLASS_NAMES
);
addNamedAnnotatedClasses( this, classNames, workingVars );
}
//TODO apparently only used for Tests, get rid of it?
- if ( workingVars.containsKey( HibernatePersistence.LOADED_CLASSES ) ) {
- Collection<Class> classes = (Collection<Class>) workingVars.get( HibernatePersistence.LOADED_CLASSES );
+ if ( workingVars.containsKey( AvailableSettings.LOADED_CLASSES ) ) {
+ Collection<Class> classes = (Collection<Class>) workingVars.get( AvailableSettings.LOADED_CLASSES );
for ( Class clazz : classes ) {
cfg.addAnnotatedClass( clazz );
}
}
- if ( workingVars.containsKey( HibernatePersistence.PACKAGE_NAMES ) ) {
+ if ( workingVars.containsKey( AvailableSettings.PACKAGE_NAMES ) ) {
Collection<String> packages = (Collection<String>) workingVars.get(
- HibernatePersistence.PACKAGE_NAMES
+ AvailableSettings.PACKAGE_NAMES
);
for ( String pkg : packages ) {
cfg.addPackage( pkg );
}
}
- if ( workingVars.containsKey( HibernatePersistence.XML_FILE_NAMES ) ) {
+ if ( workingVars.containsKey( AvailableSettings.XML_FILE_NAMES ) ) {
Collection<String> xmlFiles = (Collection<String>) workingVars.get(
- HibernatePersistence.XML_FILE_NAMES
+ AvailableSettings.XML_FILE_NAMES
);
for ( String xmlFile : xmlFiles ) {
Boolean useMetaInf = null;
@@ -1002,9 +1002,9 @@
}
}
}
- if ( workingVars.containsKey( HibernatePersistence.HBXML_FILES ) ) {
+ if ( workingVars.containsKey( AvailableSettings.HBXML_FILES ) ) {
Collection<NamedInputStream> hbmXmlFiles = (Collection<NamedInputStream>) workingVars.get(
- HibernatePersistence.HBXML_FILES
+ AvailableSettings.HBXML_FILES
);
for ( NamedInputStream is : hbmXmlFiles ) {
try {
@@ -1043,9 +1043,9 @@
preparedProperties.setProperty( Environment.AUTOCOMMIT, "true" );
preparedProperties.setProperty( Environment.USE_IDENTIFIER_ROLLBACK, "false" );
preparedProperties.setProperty( Environment.FLUSH_BEFORE_COMPLETION, "false" );
- preparedProperties.setProperty( HibernatePersistence.DISCARD_PC_ON_CLOSE, "false" );
+ preparedProperties.setProperty( AvailableSettings.DISCARD_PC_ON_CLOSE, "false" );
if (cfgXmlResource != null) {
- preparedProperties.setProperty( HibernatePersistence.CFG_FILE, cfgXmlResource );
+ preparedProperties.setProperty( AvailableSettings.CFG_FILE, cfgXmlResource );
cfgXmlResource = null;
}
@@ -1061,7 +1061,7 @@
transactionType = PersistenceUnitTransactionType.RESOURCE_LOCAL;
}
defineTransactionType(
- preparedProperties.getProperty( HibernatePersistence.TRANSACTION_TYPE ),
+ preparedProperties.getProperty( AvailableSettings.TRANSACTION_TYPE ),
workingVars
);
boolean hasTxStrategy = StringHelper.isNotEmpty(
@@ -1094,8 +1094,8 @@
private void setCacheStrategy(String propertyKey, Map properties, boolean isClass, Map workingVars) {
String role = propertyKey.substring(
- ( isClass ? HibernatePersistence.CLASS_CACHE_PREFIX
- .length() : HibernatePersistence.COLLECTION_CACHE_PREFIX.length() )
+ ( isClass ? AvailableSettings.CLASS_CACHE_PREFIX
+ .length() : AvailableSettings.COLLECTION_CACHE_PREFIX.length() )
+ 1
);
//dot size added
@@ -1104,7 +1104,7 @@
if ( !params.hasMoreTokens() ) {
StringBuilder error = new StringBuilder( "Illegal usage of " );
error.append(
- isClass ? HibernatePersistence.CLASS_CACHE_PREFIX : HibernatePersistence.COLLECTION_CACHE_PREFIX
+ isClass ? AvailableSettings.CLASS_CACHE_PREFIX : AvailableSettings.COLLECTION_CACHE_PREFIX
);
error.append( ": " ).append( propertyKey ).append( " " ).append( value );
throw new PersistenceException( getExceptionHeader() + error.toString() );
@@ -1128,17 +1128,17 @@
private void addSecurity(List<String> keys, Map properties, Map workingVars) {
log.debug( "Adding security" );
- if ( !properties.containsKey( HibernatePersistence.JACC_CONTEXT_ID ) ) {
+ if ( !properties.containsKey( AvailableSettings.JACC_CONTEXT_ID ) ) {
throw new PersistenceException( getExceptionHeader() +
"Entities have been configured for JACC, but "
- + HibernatePersistence.JACC_CONTEXT_ID
+ + AvailableSettings.JACC_CONTEXT_ID
+ " has not been set"
);
}
- String contextId = (String) properties.get( HibernatePersistence.JACC_CONTEXT_ID );
+ String contextId = (String) properties.get( AvailableSettings.JACC_CONTEXT_ID );
setProperty( Environment.JACC_CONTEXTID, contextId );
- int roleStart = HibernatePersistence.JACC_PREFIX.length() + 1;
+ int roleStart = AvailableSettings.JACC_PREFIX.length() + 1;
for ( String key : keys ) {
JACCConfiguration jaccCfg = new JACCConfiguration( contextId );
@@ -1151,7 +1151,7 @@
}
catch (IndexOutOfBoundsException e) {
throw new PersistenceException( getExceptionHeader() +
- "Illegal usage of " + HibernatePersistence.JACC_PREFIX + ": " + key );
+ "Illegal usage of " + AvailableSettings.JACC_PREFIX + ": " + key );
}
}
}
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/EntityManagerImpl.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/EntityManagerImpl.java 2010-01-18 21:27:25 UTC (rev 18576)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/EntityManagerImpl.java 2010-01-18 22:05:16 UTC (rev 18577)
@@ -19,8 +19,6 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
-
-//$Id$
package org.hibernate.ejb;
import java.util.Map;
@@ -63,7 +61,7 @@
this.discardOnClose = discardOnClose;
Object localSessionInterceptor = null;
if (properties != null) {
- localSessionInterceptor = properties.get( HibernatePersistence.SESSION_INTERCEPTOR );
+ localSessionInterceptor = properties.get( AvailableSettings.SESSION_INTERCEPTOR );
}
if ( localSessionInterceptor != null ) {
if (localSessionInterceptor instanceof Class) {
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/EventListenerConfigurator.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/EventListenerConfigurator.java 2010-01-18 21:27:25 UTC (rev 18576)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/EventListenerConfigurator.java 2010-01-18 22:05:16 UTC (rev 18577)
@@ -19,8 +19,6 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
-
-//$Id$
package org.hibernate.ejb;
import java.beans.BeanInfo;
@@ -168,15 +166,15 @@
}
public void setProperties(Properties properties) {
- if ( properties.containsKey( HibernatePersistence.JACC_ENABLED ) ) {
+ if ( properties.containsKey( AvailableSettings.JACC_ENABLED ) ) {
isSecurity = true;
}
//override events if needed
Enumeration<?> enumeration = properties.propertyNames();
while ( enumeration.hasMoreElements() ) {
String name = (String) enumeration.nextElement();
- if ( name.startsWith( HibernatePersistence.EVENT_LISTENER_PREFIX ) ) {
- String type = name.substring( HibernatePersistence.EVENT_LISTENER_PREFIX.length() + 1 );
+ if ( name.startsWith( AvailableSettings.EVENT_LISTENER_PREFIX ) ) {
+ String type = name.substring( AvailableSettings.EVENT_LISTENER_PREFIX.length() + 1 );
StringTokenizer st = new StringTokenizer( properties.getProperty( name ), " ,", false );
List<String> listeners = new ArrayList<String>();
while ( st.hasMoreElements() ) {
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/HibernatePersistence.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/HibernatePersistence.java 2010-01-18 21:27:25 UTC (rev 18576)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/HibernatePersistence.java 2010-01-18 22:05:16 UTC (rev 18577)
@@ -1,4 +1,3 @@
-// $Id:$
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
@@ -39,110 +38,11 @@
*/
public class HibernatePersistence implements javax.persistence.spi.PersistenceProvider {
- /**
- * Provider
- */
- public static final String PROVIDER = "javax.persistence.provider";
- /**
- * transaction type
- */
- public static final String TRANSACTION_TYPE = "javax.persistence.transactionType";
- /**
- * JTA datasource name
- */
- public static final String JTA_DATASOURCE = "javax.persistence.jtaDataSource";
- /**
- * Non JTA datasource name
- */
- public static final String NON_JTA_DATASOURCE = "javax.persistence.nonJtaDataSource";
- /**
- * Validation mode
- */
- public static final String VALIDATION_MODE = "javax.persistence.validation.mode";
- /**
- * Shared cache mode
- */
- public static final String SHARED_CACHE_MODE = "javax.persistence.sharedCache.mode";
- /**
- * JAR autodetection artifacts class, hbm
- */
- public static final String AUTODETECTION = "hibernate.archive.autodetection";
- /**
- * cfg.xml configuration file used
- */
- public static final String CFG_FILE = "hibernate.ejb.cfgfile";
- /**
- * Caching configuration should follow the following pattern
- * hibernate.ejb.classcache.<fully.qualified.Classname> usage[, region]
- * where usage is the cache strategy used and region the cache region name
- */
- public static final String CLASS_CACHE_PREFIX = "hibernate.ejb.classcache";
- /**
- * Caching configuration should follow the following pattern
- * hibernate.ejb.collectioncache.<fully.qualified.Classname>.<role> usage[, region]
- * where usage is the cache strategy used and region the cache region name
- */
- public static final String COLLECTION_CACHE_PREFIX = "hibernate.ejb.collectioncache";
- /**
- * Interceptor class name, the class has to have a no-arg constructor
- * the interceptor instance is shared amongst all EntityManager of a given EntityManagerFactory
- */
- public static final String INTERCEPTOR = "hibernate.ejb.interceptor";
- /**
- * Interceptor class name, the class has to have a no-arg constructor
- */
- public static final String SESSION_INTERCEPTOR = "hibernate.ejb.interceptor.session_scoped";
- /**
- * Naming strategy class name, the class has to have a no-arg constructor
- */
- public static final String NAMING_STRATEGY = "hibernate.ejb.naming_strategy";
- /**
- * Event configuration should follow the following pattern
- * hibernate.ejb.event.[eventType] f.q.c.n.EventListener1, f.q.c.n.EventListener12 ...
- */
- public static final String EVENT_LISTENER_PREFIX = "hibernate.ejb.event";
- /**
- * Enable the class file enhancement
- */
- public static final String USE_CLASS_ENHANCER = "hibernate.ejb.use_class_enhancer";
- /**
- * Whether or not discard persistent context on entityManager.close()
- * The EJB3 compliant and default choice is false
- */
- public static final String DISCARD_PC_ON_CLOSE = "hibernate.ejb.discard_pc_on_close";
- /**
- * Consider this as experimental
- * It is not recommended to set up this property, the configuration is stored
- * in the JNDI in a serialized form
- */
- public static final String CONFIGURATION_JNDI_NAME = "hibernate.ejb.configuration_jndi_name";
-
//The following properties are for Internal use only
/**
* link to the alternative Hibernate configuration file
* Internal use only
*/
- /**
- * List of classes names
- * Internal use only
- */
- public static final String CLASS_NAMES = "hibernate.ejb.classes";
- /**
- * List of annotated packages
- * Internal use only
- */
- public static final String PACKAGE_NAMES = "hibernate.ejb.packages";
- /**
- * List of classes names
- * Internal use only
- */
- public static final String XML_FILE_NAMES = "hibernate.ejb.xml_files";
- public static final String HBXML_FILES = "hibernate.hbmxml.files";
- public static final String LOADED_CLASSES = "hibernate.ejb.loaded.classes";
- public static final String JACC_CONTEXT_ID = "hibernate.jacc.ctx.id";
- public static final String JACC_PREFIX = "hibernate.jacc";
- public static final String JACC_ENABLED = "hibernate.jacc.enabled";
- public static final String PERSISTENCE_UNIT_NAME = "hibernate.ejb.persistenceUnitName";
/**
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/PersistenceXmlLoader.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/PersistenceXmlLoader.java 2010-01-18 21:27:25 UTC (rev 18576)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/PersistenceXmlLoader.java 2010-01-18 22:05:16 UTC (rev 18577)
@@ -1,9 +1,10 @@
-// $Id:$
/*
- * Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -40,6 +41,10 @@
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
+import org.hibernate.ejb.AvailableSettings;
+import org.hibernate.ejb.util.ConfigurationHelper;
+import org.hibernate.util.StringHelper;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
@@ -51,10 +56,6 @@
import org.xml.sax.InputSource;
import org.xml.sax.SAXParseException;
-import org.hibernate.ejb.HibernatePersistence;
-import org.hibernate.ejb.util.ConfigurationHelper;
-import org.hibernate.util.StringHelper;
-
/**
* Handler for persistence.xml files.
*
@@ -179,20 +180,20 @@
PersistenceMetadata metadata = parsePersistenceUnit( element );
metadata.setVersion(version);
//override properties of metadata if needed
- if ( overrides.containsKey( HibernatePersistence.PROVIDER ) ) {
- String provider = (String) overrides.get( HibernatePersistence.PROVIDER );
+ if ( overrides.containsKey( AvailableSettings.PROVIDER ) ) {
+ String provider = (String) overrides.get( AvailableSettings.PROVIDER );
metadata.setProvider( provider );
}
- if ( overrides.containsKey( HibernatePersistence.TRANSACTION_TYPE ) ) {
- String transactionType = (String) overrides.get( HibernatePersistence.TRANSACTION_TYPE );
+ if ( overrides.containsKey( AvailableSettings.TRANSACTION_TYPE ) ) {
+ String transactionType = (String) overrides.get( AvailableSettings.TRANSACTION_TYPE );
metadata.setTransactionType( PersistenceXmlLoader.getTransactionType( transactionType ) );
}
- if ( overrides.containsKey( HibernatePersistence.JTA_DATASOURCE ) ) {
- String dataSource = (String) overrides.get( HibernatePersistence.JTA_DATASOURCE );
+ if ( overrides.containsKey( AvailableSettings.JTA_DATASOURCE ) ) {
+ String dataSource = (String) overrides.get( AvailableSettings.JTA_DATASOURCE );
metadata.setJtaDatasource( dataSource );
}
- if ( overrides.containsKey( HibernatePersistence.NON_JTA_DATASOURCE ) ) {
- String dataSource = (String) overrides.get( HibernatePersistence.NON_JTA_DATASOURCE );
+ if ( overrides.containsKey( AvailableSettings.NON_JTA_DATASOURCE ) ) {
+ String dataSource = (String) overrides.get( AvailableSettings.NON_JTA_DATASOURCE );
metadata.setNonJtaDatasource( dataSource );
}
/*
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/util/NamingHelper.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/util/NamingHelper.java 2010-01-18 21:27:25 UTC (rev 18576)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/util/NamingHelper.java 2010-01-18 22:05:16 UTC (rev 18577)
@@ -1,8 +1,10 @@
/*
- * Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
+ * 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 Middleware LLC.
+ * 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
@@ -30,8 +32,9 @@
import javax.naming.event.NamingExceptionEvent;
import javax.naming.event.NamingListener;
+import org.hibernate.ejb.AvailableSettings;
import org.hibernate.ejb.Ejb3Configuration;
-import org.hibernate.ejb.HibernatePersistence;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -45,7 +48,7 @@
/** bind the configuration to the JNDI */
public static void bind(Ejb3Configuration cfg) {
- String name = cfg.getHibernateConfiguration().getProperty( HibernatePersistence.CONFIGURATION_JNDI_NAME );
+ String name = cfg.getHibernateConfiguration().getProperty( AvailableSettings.CONFIGURATION_JNDI_NAME );
if ( name == null ) {
log.debug( "No JNDI name configured for binding Ejb3Configuration" );
}
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-01-18 21:27:25 UTC (rev 18576)
+++ core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/PackagedEntityManagerTest.java 2010-01-18 22:05:16 UTC (rev 18577)
@@ -1,4 +1,26 @@
-//$Id$
+/*
+ * 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.ejb.test;
import java.util.HashMap;
@@ -10,8 +32,8 @@
import javax.persistence.Persistence;
import javax.persistence.PersistenceException;
+import org.hibernate.ejb.AvailableSettings;
import org.hibernate.ejb.HibernateEntityManagerFactory;
-import org.hibernate.ejb.HibernatePersistence;
import org.hibernate.ejb.test.pack.cfgxmlpar.Morito;
import org.hibernate.ejb.test.pack.defaultpar.ApplicationServer;
import org.hibernate.ejb.test.pack.defaultpar.IncrementListener;
@@ -232,7 +254,7 @@
public void testOverridenPar() throws Exception {
HashMap properties = new HashMap();
- properties.put( HibernatePersistence.JTA_DATASOURCE, null );
+ properties.put( AvailableSettings.JTA_DATASOURCE, null );
Properties p=new Properties();
p.load( ConfigHelper.getResourceAsStream( "/overridenpar.properties" ) );
properties.putAll( p );
Modified: core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/TestCase.java
===================================================================
--- core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/TestCase.java 2010-01-18 21:27:25 UTC (rev 18576)
+++ core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/TestCase.java 2010-01-18 22:05:16 UTC (rev 18577)
@@ -1,4 +1,26 @@
-//$Id$
+/*
+ * 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.ejb.test;
import java.io.IOException;
@@ -16,6 +38,7 @@
import org.apache.commons.logging.LogFactory;
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.Dialect;
+import org.hibernate.ejb.AvailableSettings;
import org.hibernate.ejb.HibernatePersistence;
@@ -125,16 +148,16 @@
for ( Class clazz : getAnnotatedClasses() ) {
classes.add( clazz );
}
- config.put( HibernatePersistence.LOADED_CLASSES, classes );
+ config.put( AvailableSettings.LOADED_CLASSES, classes );
for ( Map.Entry<Class, String> entry : getCachedClasses().entrySet() ) {
config.put(
- HibernatePersistence.CLASS_CACHE_PREFIX + "." + entry.getKey().getName(),
+ AvailableSettings.CLASS_CACHE_PREFIX + "." + entry.getKey().getName(),
entry.getValue()
);
}
for ( Map.Entry<String, String> entry : getCachedCollections().entrySet() ) {
config.put(
- HibernatePersistence.COLLECTION_CACHE_PREFIX + "." + entry.getKey(),
+ AvailableSettings.COLLECTION_CACHE_PREFIX + "." + entry.getKey(),
entry.getValue()
);
}
@@ -143,7 +166,7 @@
for ( String dd : getEjb3DD() ) {
dds.add( dd );
}
- config.put( HibernatePersistence.XML_FILE_NAMES, dds );
+ config.put( AvailableSettings.XML_FILE_NAMES, dds );
}
return config;
}
Modified: core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/ejb3configuration/InterceptorTest.java
===================================================================
--- core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/ejb3configuration/InterceptorTest.java 2010-01-18 21:27:25 UTC (rev 18576)
+++ core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/ejb3configuration/InterceptorTest.java 2010-01-18 22:05:16 UTC (rev 18577)
@@ -1,10 +1,32 @@
-//$Id$
+/*
+ * 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.ejb.test.ejb3configuration;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
-import org.hibernate.ejb.HibernatePersistence;
+import org.hibernate.ejb.AvailableSettings;
import org.hibernate.ejb.test.Distributor;
import org.hibernate.ejb.test.Item;
@@ -35,7 +57,7 @@
}
public void testConfiguredInterceptor() {
- configuration.setProperty( HibernatePersistence.INTERCEPTOR, ExceptionInterceptor.class.getName() );
+ configuration.setProperty( AvailableSettings.INTERCEPTOR, ExceptionInterceptor.class.getName() );
EntityManagerFactory emf = configuration.createEntityManagerFactory();
EntityManager em = emf.createEntityManager();
Item i = new Item();
@@ -57,7 +79,7 @@
}
public void testConfiguredSessionInterceptor() {
- configuration.setProperty( HibernatePersistence.SESSION_INTERCEPTOR, LocalExceptionInterceptor.class.getName() );
+ configuration.setProperty( AvailableSettings.SESSION_INTERCEPTOR, LocalExceptionInterceptor.class.getName() );
configuration.setProperty( "aaaaaaaaaaaaaaaaaaaaa", "bbbbbbbbbbbbbbbbbbbb" );
EntityManagerFactory emf = configuration.createEntityManagerFactory();
EntityManager em = emf.createEntityManager();
@@ -80,7 +102,7 @@
}
public void testEmptyCreateEntityManagerFactoryAndPropertyUse() {
- configuration.setProperty( HibernatePersistence.INTERCEPTOR, ExceptionInterceptor.class.getName() );
+ configuration.setProperty( AvailableSettings.INTERCEPTOR, ExceptionInterceptor.class.getName() );
EntityManagerFactory emf = configuration.createEntityManagerFactory();
EntityManager em = emf.createEntityManager();
Item i = new Item();
Modified: core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/ejb3configuration/TestCase.java
===================================================================
--- core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/ejb3configuration/TestCase.java 2010-01-18 21:27:25 UTC (rev 18576)
+++ core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/ejb3configuration/TestCase.java 2010-01-18 22:05:16 UTC (rev 18577)
@@ -1,4 +1,26 @@
-//$Id$
+/*
+ * 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.ejb.test.ejb3configuration;
import java.io.IOException;
@@ -9,8 +31,8 @@
import javax.persistence.Persistence;
import org.hibernate.cfg.Environment;
+import org.hibernate.ejb.AvailableSettings;
import org.hibernate.ejb.Ejb3Configuration;
-import org.hibernate.ejb.HibernatePersistence;
/**
* @author Emmanuel Bernard
@@ -54,13 +76,13 @@
for ( Map.Entry<Class, String> entry : getCachedClasses().entrySet() ) {
configuration.setProperty(
- HibernatePersistence.CLASS_CACHE_PREFIX + "." + entry.getKey().getName(),
+ AvailableSettings.CLASS_CACHE_PREFIX + "." + entry.getKey().getName(),
entry.getValue()
);
}
for ( Map.Entry<String, String> entry : getCachedCollections().entrySet() ) {
configuration.setProperty(
- HibernatePersistence.COLLECTION_CACHE_PREFIX + "." + entry.getKey(),
+ AvailableSettings.COLLECTION_CACHE_PREFIX + "." + entry.getKey(),
entry.getValue()
);
}
15 years
Hibernate SVN: r18576 - core/trunk/envers/src/test/resources.
by hibernate-commits@lists.jboss.org
Author: adamw
Date: 2010-01-18 16:27:25 -0500 (Mon, 18 Jan 2010)
New Revision: 18576
Modified:
core/trunk/envers/src/test/resources/testng.xml
Log:
HHH-4793: enabling test after fixes in core/annotations
Modified: core/trunk/envers/src/test/resources/testng.xml
===================================================================
--- core/trunk/envers/src/test/resources/testng.xml 2010-01-18 19:17:27 UTC (rev 18575)
+++ core/trunk/envers/src/test/resources/testng.xml 2010-01-18 21:27:25 UTC (rev 18576)
@@ -46,14 +46,7 @@
<package name="org.hibernate.envers.test.integration.manytomany.ternary" />
<package name="org.hibernate.envers.test.integration.manytomany.unidirectional" />
<package name="org.hibernate.envers.test.integration.manytoone.unidirectional" />
- <package name="org.hibernate.envers.test.integration.naming">
- <!--
- disable temporarily to do 3.5.0-beta-3 release,
- see http://opensource.atlassian.com/projects/hibernate/browse/HHH-4790
- for details
- -->
- <exclude name="VersionsJoinTableRangeComponentNamingTest"/>
- </package>
+ <package name="org.hibernate.envers.test.integration.naming"/>
<package name="org.hibernate.envers.test.integration.naming.ids" />
<package name="org.hibernate.envers.test.integration.notinsertable" />
<package name="org.hibernate.envers.test.integration.notinsertable.manytoone" />
15 years
Hibernate SVN: r18575 - in core/trunk: annotations/src/main/java/org/hibernate/cfg/annotations and 4 other directories.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2010-01-18 14:17:27 -0500 (Mon, 18 Jan 2010)
New Revision: 18575
Modified:
core/trunk/annotations/pom.xml
core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/Version.java
core/trunk/core/pom.xml
core/trunk/entitymanager/pom.xml
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/Version.java
core/trunk/parent/pom.xml
Log:
HHH-4813 - annotation and entitymanager module should use the maven-injection-plugin to generate version string
Modified: core/trunk/annotations/pom.xml
===================================================================
--- core/trunk/annotations/pom.xml 2010-01-18 19:08:55 UTC (rev 18574)
+++ core/trunk/annotations/pom.xml 2010-01-18 19:17:27 UTC (rev 18575)
@@ -107,9 +107,26 @@
<artifactId>maven-test-ext-plugin</artifactId>
</plugin>
<plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-injection-plugin</artifactId>
+ <configuration>
+ <bytecodeInjections>
+ <bytecodeInjection>
+ <expression>${pom.version}</expression>
+ <targetMembers>
+ <methodBodyReturn>
+ <className>org.hibernate.cfg.annotations.Version</className>
+ <methodName>getVersionString</methodName>
+ </methodBodyReturn>
+ </targetMembers>
+ </bytecodeInjection>
+ </bytecodeInjections>
+ </configuration>
+ </plugin>
+ <plugin>
<groupId>org.twdata.maven</groupId>
<artifactId>maven-cli-plugin</artifactId>
- <version>0.6.3.CR2</version>
+ <version>0.6.4</version>
</plugin>
</plugins>
</build>
Modified: core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/Version.java
===================================================================
--- core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/Version.java 2010-01-18 19:08:55 UTC (rev 18574)
+++ core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/Version.java 2010-01-18 19:17:27 UTC (rev 18575)
@@ -1,3 +1,4 @@
+// $Id:$
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
@@ -23,8 +24,6 @@
*/
package org.hibernate.cfg.annotations;
-import java.util.Date;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -32,11 +31,14 @@
* @author Emmanuel Bernard
*/
public class Version {
- public static final String VERSION = "3.5.0." + new Date();
private static Logger log = LoggerFactory.getLogger( Version.class );
+ public static String getVersionString() {
+ return "[WORKING]";
+ }
+
static {
- log.info( "Hibernate Annotations {}", VERSION );
+ log.info( "Hibernate Annotations {}", getVersionString() );
}
public static void touch() {
Modified: core/trunk/core/pom.xml
===================================================================
--- core/trunk/core/pom.xml 2010-01-18 19:08:55 UTC (rev 18574)
+++ core/trunk/core/pom.xml 2010-01-18 19:17:27 UTC (rev 18575)
@@ -98,15 +98,6 @@
<plugin>
<groupId>org.jboss.maven.plugins</groupId>
<artifactId>maven-injection-plugin</artifactId>
- <version>1.0.2</version>
- <executions>
- <execution>
- <phase>compile</phase>
- <goals>
- <goal>bytecode</goal>
- </goals>
- </execution>
- </executions>
<configuration>
<bytecodeInjections>
<bytecodeInjection>
Modified: core/trunk/entitymanager/pom.xml
===================================================================
--- core/trunk/entitymanager/pom.xml 2010-01-18 19:08:55 UTC (rev 18574)
+++ core/trunk/entitymanager/pom.xml 2010-01-18 19:17:27 UTC (rev 18575)
@@ -86,6 +86,23 @@
</testResources>
<plugins>
<plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-injection-plugin</artifactId>
+ <configuration>
+ <bytecodeInjections>
+ <bytecodeInjection>
+ <expression>${pom.version}</expression>
+ <targetMembers>
+ <methodBodyReturn>
+ <className>org.hibernate.ejb.Version</className>
+ <methodName>getVersionString</methodName>
+ </methodBodyReturn>
+ </targetMembers>
+ </bytecodeInjection>
+ </bytecodeInjections>
+ </configuration>
+ </plugin>
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<!-- Define one configuration outside executions and without a phase in order to allow 'mvn antrun:run' -->
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/Version.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/Version.java 2010-01-18 19:08:55 UTC (rev 18574)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/Version.java 2010-01-18 19:17:27 UTC (rev 18575)
@@ -1,3 +1,4 @@
+// $Id:$
/*
* Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
* indicated by the @author tags or express copyright attribution
@@ -23,8 +24,6 @@
//$Id$
package org.hibernate.ejb;
-import java.util.Date;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -33,11 +32,14 @@
* @author Emmanuel Bernard
*/
public class Version {
- public static final String VERSION = "3.5.0." + new Date();
- private static final Logger log = LoggerFactory.getLogger( Version.class );
+ private static Logger log = LoggerFactory.getLogger( Version.class );
+ public static String getVersionString() {
+ return "[WORKING]";
+ }
+
static {
- log.info( "Hibernate EntityManager {}", VERSION );
+ log.info( "Hibernate EntityManager {}", getVersionString() );
}
public static void touch() {
Modified: core/trunk/parent/pom.xml
===================================================================
--- core/trunk/parent/pom.xml 2010-01-18 19:08:55 UTC (rev 18574)
+++ core/trunk/parent/pom.xml 2010-01-18 19:17:27 UTC (rev 18575)
@@ -323,6 +323,19 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-injection-plugin</artifactId>
+ <version>1.0.2</version>
+ <executions>
+ <execution>
+ <phase>compile</phase>
+ <goals>
+ <goal>bytecode</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</pluginManagement>
15 years
Hibernate SVN: r18574 - in search/trunk: src/main/java/org/hibernate/search and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2010-01-18 14:08:55 -0500 (Mon, 18 Jan 2010)
New Revision: 18574
Modified:
search/trunk/pom.xml
search/trunk/src/main/java/org/hibernate/search/Version.java
Log:
HSEARCH-447 Changed Version.java to use the maven-injection-plugin. Also made sure that all plugins explicitly specify a version.
Modified: search/trunk/pom.xml
===================================================================
--- search/trunk/pom.xml 2010-01-18 18:27:12 UTC (rev 18573)
+++ search/trunk/pom.xml 2010-01-18 19:08:55 UTC (rev 18574)
@@ -23,95 +23,95 @@
* Boston, MA 02110-1301 USA
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-search</artifactId>
- <version>3.2.0.Beta2-SNAPSHOT</version>
- <name>Hibernate Search</name>
- <description>Hibernate Search</description>
- <url>http://search.hibernate.org</url>
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-search</artifactId>
+ <version>3.2.0.Beta2-SNAPSHOT</version>
+ <name>Hibernate Search</name>
+ <description>Hibernate Search</description>
+ <url>http://search.hibernate.org</url>
- <issueManagement>
- <system>JIRA</system>
- <url>http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH</url>
- </issueManagement>
- <scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/hibernate/search/trunk</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/hibernate/search/trunk</developerConnection>
- <url>http://fisheye.jboss.com/browse/Hibernate/search/trunk</url>
- </scm>
+ <issueManagement>
+ <system>JIRA</system>
+ <url>http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH</url>
+ </issueManagement>
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/hibernate/search/trunk</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/hibernate/search/trunk</developerConnection>
+ <url>http://fisheye.jboss.com/browse/Hibernate/search/trunk</url>
+ </scm>
- <organization>
- <name>Hibernate</name>
- <url>http://www.hibernate.org</url>
- </organization>
+ <organization>
+ <name>Hibernate</name>
+ <url>http://www.hibernate.org</url>
+ </organization>
- <licenses>
- <license>
- <name>GNU Lesser General Public License</name>
- <url>http://www.gnu.org/licenses/lgpl-2.1.html</url>
- <comments>See discussion at http://hibernate.org/356.html for more details.</comments>
- </license>
- </licenses>
+ <licenses>
+ <license>
+ <name>GNU Lesser General Public License</name>
+ <url>http://www.gnu.org/licenses/lgpl-2.1.html</url>
+ <comments>See discussion at http://hibernate.org/356.html for more details.</comments>
+ </license>
+ </licenses>
- <ciManagement>
- <system>Hudson</system>
- <url>http://hudson.jboss.org/hudson/view/hibernate/job/hibernate-search-trunk/</url>
- </ciManagement>
- <inceptionYear>2006</inceptionYear>
- <developers>
- <developer>
- <id>epbernard</id>
- <name>Emmanuel Bernard</name>
- <email>emmanuel(a)hibernate.org</email>
- <url>http://in.relation.to/Bloggers/Emmanuel</url>
- </developer>
- <developer>
- <id>hardy.ferentschik</id>
- <name>Hardy Ferentschik</name>
- <url>http://in.relation.to/Bloggers/Hardy</url>
- </developer>
- <developer>
- <id>sannegrinovero</id>
- <name>Sanne Grinovero</name>
- <url>http://in.relation.to/Bloggers/Sanne</url>
- </developer>
- </developers>
+ <ciManagement>
+ <system>Hudson</system>
+ <url>http://hudson.jboss.org/hudson/view/hibernate/job/hibernate-search-trunk/</url>
+ </ciManagement>
+ <inceptionYear>2006</inceptionYear>
+ <developers>
+ <developer>
+ <id>epbernard</id>
+ <name>Emmanuel Bernard</name>
+ <email>emmanuel(a)hibernate.org</email>
+ <url>http://in.relation.to/Bloggers/Emmanuel</url>
+ </developer>
+ <developer>
+ <id>hardy.ferentschik</id>
+ <name>Hardy Ferentschik</name>
+ <url>http://in.relation.to/Bloggers/Hardy</url>
+ </developer>
+ <developer>
+ <id>sannegrinovero</id>
+ <name>Sanne Grinovero</name>
+ <url>http://in.relation.to/Bloggers/Sanne</url>
+ </developer>
+ </developers>
- <mailingLists>
- <mailingList>
- <name>Hibernate Announcements</name>
- <post>hibernate-announce(a)lists.jboss.org</post>
- <subscribe>https://lists.jboss.org/mailman/listinfo/hibernate-announce</subscribe>
- <unsubscribe>https://lists.jboss.org/mailman/listinfo/hibernate-announce</unsubscribe>
- <archive>http://lists.jboss.org/pipermail/hibernate-dev/</archive>
- </mailingList>
- <mailingList>
- <name>Hibernate Commit Notificatons</name>
- <post>hibernate-commits(a)lists.jboss.org</post>
- <subscribe>https://lists.jboss.org/mailman/listinfo/hibernate-commits</subscribe>
- <unsubscribe>https://lists.jboss.org/mailman/listinfo/hibernate-commits</unsubscribe>
- <archive>http://lists.jboss.org/pipermail/hibernate-commits/</archive>
- </mailingList>
- <mailingList>
- <name>Hibernate Developers</name>
- <post>hibernate-dev(a)lists.jboss.org</post>
- <subscribe>https://lists.jboss.org/mailman/listinfo/hibernate-dev</subscribe>
- <unsubscribe>https://lists.jboss.org/mailman/listinfo/hibernate-dev</unsubscribe>
- <archive>http://lists.jboss.org/pipermail/hibernate-dev/</archive>
- <otherArchives>
- <otherArchive>http://www.mail-archive.com/hibernate-dev%40lists.jboss.org/index.html</otherArchive>
- </otherArchives>
- </mailingList>
- <mailingList>
- <name>Hibernate Issue Notifications</name>
- <post>hibernate-issues(a)lists.jboss.org</post>
- <subscribe>https://lists.jboss.org/mailman/listinfo/hibernate-issues</subscribe>
- <unsubscribe>https://lists.jboss.org/mailman/listinfo/hibernate-issues</unsubscribe>
- <archive>http://lists.jboss.org/pipermail/hibernate-issues/</archive>
- </mailingList>
- </mailingLists>
+ <mailingLists>
+ <mailingList>
+ <name>Hibernate Announcements</name>
+ <post>hibernate-announce(a)lists.jboss.org</post>
+ <subscribe>https://lists.jboss.org/mailman/listinfo/hibernate-announce</subscribe>
+ <unsubscribe>https://lists.jboss.org/mailman/listinfo/hibernate-announce</unsubscribe>
+ <archive>http://lists.jboss.org/pipermail/hibernate-dev/</archive>
+ </mailingList>
+ <mailingList>
+ <name>Hibernate Commit Notificatons</name>
+ <post>hibernate-commits(a)lists.jboss.org</post>
+ <subscribe>https://lists.jboss.org/mailman/listinfo/hibernate-commits</subscribe>
+ <unsubscribe>https://lists.jboss.org/mailman/listinfo/hibernate-commits</unsubscribe>
+ <archive>http://lists.jboss.org/pipermail/hibernate-commits/</archive>
+ </mailingList>
+ <mailingList>
+ <name>Hibernate Developers</name>
+ <post>hibernate-dev(a)lists.jboss.org</post>
+ <subscribe>https://lists.jboss.org/mailman/listinfo/hibernate-dev</subscribe>
+ <unsubscribe>https://lists.jboss.org/mailman/listinfo/hibernate-dev</unsubscribe>
+ <archive>http://lists.jboss.org/pipermail/hibernate-dev/</archive>
+ <otherArchives>
+ <otherArchive>http://www.mail-archive.com/hibernate-dev%40lists.jboss.org/index.html</otherArchive>
+ </otherArchives>
+ </mailingList>
+ <mailingList>
+ <name>Hibernate Issue Notifications</name>
+ <post>hibernate-issues(a)lists.jboss.org</post>
+ <subscribe>https://lists.jboss.org/mailman/listinfo/hibernate-issues</subscribe>
+ <unsubscribe>https://lists.jboss.org/mailman/listinfo/hibernate-issues</unsubscribe>
+ <archive>http://lists.jboss.org/pipermail/hibernate-issues/</archive>
+ </mailingList>
+ </mailingLists>
<properties>
<slf4jVersion>1.5.8</slf4jVersion>
@@ -135,11 +135,6 @@
<artifactId>hibernate-commons-annotations</artifactId>
<version>${hibernateCommonsAnnotationVersion}</version>
</dependency>
- <!-- dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>ejb3-persistence</artifactId>
- <version>1.0.2.GA</version>
- </dependency -->
<dependency>
<groupId>org.hibernate.java-persistence</groupId>
<artifactId>jpa-api</artifactId>
@@ -196,6 +191,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
@@ -204,6 +200,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
<configuration>
<archive>
<manifestEntries>
@@ -219,6 +216,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.3</version>
<configuration>
<forkMode>once</forkMode>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
@@ -282,12 +280,14 @@
</format>
<format>
<formatName>html_single</formatName>
- <stylesheetResource>classpath:/xslt/org/hibernate/jdocbook/xslt/xhtml-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/org/hibernate/jdocbook/xslt/xhtml.xsl</stylesheetResource>
+ <stylesheetResource>classpath:/xslt/org/hibernate/jdocbook/xslt/xhtml.xsl
+ </stylesheetResource>
<finalName>index.html</finalName>
</format>
</formats>
@@ -329,6 +329,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.5</version>
<configuration>
<stylesheetfile>${basedir}/src/main/javadoc/jdstyle.css</stylesheetfile>
</configuration>
@@ -343,7 +344,9 @@
</executions>
</plugin>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2-beta-2</version>
<configuration>
<descriptors>
<descriptor>src/main/assembly/dist.xml</descriptor>
@@ -351,7 +354,9 @@
</configuration>
</plugin>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
+ <version>2.0-beta-9</version>
<configuration>
<releaseProfiles>release</releaseProfiles>
<goals>package javadoc:javadoc org.jboss.maven.plugins:maven-jdocbook-plugin:2.2.0:resources
@@ -359,6 +364,32 @@
</goals>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-injection-plugin</artifactId>
+ <version>1.0.2</version>
+ <executions>
+ <execution>
+ <phase>compile</phase>
+ <goals>
+ <goal>bytecode</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <bytecodeInjections>
+ <bytecodeInjection>
+ <expression>${pom.version}</expression>
+ <targetMembers>
+ <methodBodyReturn>
+ <className>org.hibernate.search.Version</className>
+ <methodName>getVersionString</methodName>
+ </methodBodyReturn>
+ </targetMembers>
+ </bytecodeInjection>
+ </bytecodeInjections>
+ </configuration>
+ </plugin>
</plugins>
<testResources>
<testResource>
@@ -410,8 +441,8 @@
<jdbc.driver>org.hsqldb.jdbcDriver</jdbc.driver>
<jdbc.url>jdbc:hsqldb:.</jdbc.url>
<jdbc.user>sa</jdbc.user>
- <jdbc.pass />
- <jdbc.isolation />
+ <jdbc.pass/>
+ <jdbc.isolation/>
</properties>
</profile>
<!--
@@ -438,7 +469,7 @@
<jdbc.url>jdbc:mysql://vmg08.mw.lab.eng.bos.redhat.com/searctru</jdbc.url>
<jdbc.user>searctru</jdbc.user>
<jdbc.pass>searctru</jdbc.pass>
- <jdbc.isolation />
+ <jdbc.isolation/>
</properties>
</profile>
@@ -458,7 +489,7 @@
<jdbc.url>jdbc:mysql://vmg02.mw.lab.eng.bos.redhat.com/searctru</jdbc.url>
<jdbc.user>searctru</jdbc.user>
<jdbc.pass>searctru</jdbc.pass>
- <jdbc.isolation />
+ <jdbc.isolation/>
</properties>
</profile>
@@ -475,10 +506,11 @@
<properties>
<db.dialect>org.hibernate.dialect.MySQL5Dialect</db.dialect>
<jdbc.driver>com.mysql.jdbc.Driver</jdbc.driver>
- <jdbc.url>jdbc:mysql:loadbalance://dev61.qa.atl2.redhat.com:3306,dev62.qa.atl2.redhat.com:3306/searctru</jdbc.url>
+ <jdbc.url>jdbc:mysql:loadbalance://dev61.qa.atl2.redhat.com:3306,dev62.qa.atl2.redhat.com:3306/searctru
+ </jdbc.url>
<jdbc.user>searctru</jdbc.user>
<jdbc.pass>searctru</jdbc.pass>
- <jdbc.isolation />
+ <jdbc.isolation/>
</properties>
</profile>
@@ -499,7 +531,7 @@
<jdbc.url>jdbc:postgresql://vmg01.mw.lab.eng.bos.redhat.com:5432:searctru</jdbc.url>
<jdbc.user>searctru</jdbc.user>
<jdbc.pass>searctru</jdbc.pass>
- <jdbc.isolation />
+ <jdbc.isolation/>
</properties>
</profile>
@@ -520,7 +552,7 @@
<jdbc.url>jdbc:postgresql://vmg03.mw.lab.eng.bos.redhat.com:5432:searctru</jdbc.url>
<jdbc.user>searctru</jdbc.user>
<jdbc.pass>searctru</jdbc.pass>
- <jdbc.isolation />
+ <jdbc.isolation/>
</properties>
</profile>
@@ -551,7 +583,7 @@
<jdbc.url>jdbc:db2://dev32.qa.atl.jboss.com:50000/jbossqa</jdbc.url>
<jdbc.user>searctru</jdbc.user>
<jdbc.pass>searctru</jdbc.pass>
- <jdbc.isolation />
+ <jdbc.isolation/>
</properties>
</profile>
@@ -576,7 +608,7 @@
<jdbc.url>jdbc:db2://dev67.qa.atl.jboss.com:50000/jbossqa</jdbc.url>
<jdbc.user>searctru</jdbc.user>
<jdbc.pass>searctru</jdbc.pass>
- <jdbc.isolation />
+ <jdbc.isolation/>
</properties>
</profile>
@@ -601,7 +633,7 @@
<jdbc.url>jdbc:db2://vmg06.mw.lab.eng.bos.redhat.com:50000/jbossqa</jdbc.url>
<jdbc.user>searctru</jdbc.user>
<jdbc.pass>searctru</jdbc.pass>
- <jdbc.isolation />
+ <jdbc.isolation/>
</properties>
</profile>
@@ -622,7 +654,7 @@
<jdbc.url>jdbc:oracle:thin:@dev20.qa.atl.jboss.com:1521:qa</jdbc.url>
<jdbc.user>searctru</jdbc.user>
<jdbc.pass>searctru</jdbc.pass>
- <jdbc.isolation />
+ <jdbc.isolation/>
</properties>
</profile>
@@ -643,7 +675,7 @@
<jdbc.url>jdbc:oracle:thin:@vmg05.mw.lab.eng.bos.redhat.com:1521:qaora10</jdbc.url>
<jdbc.user>searctru</jdbc.user>
<jdbc.pass>searctru</jdbc.pass>
- <jdbc.isolation />
+ <jdbc.isolation/>
</properties>
</profile>
@@ -663,7 +695,7 @@
<jdbc.url>jdbc:oracle:thin:@dev04.qa.atl2.redhat.com:1521:qaora11</jdbc.url>
<jdbc.user>searctru</jdbc.user>
<jdbc.pass>searctru</jdbc.pass>
- <jdbc.isolation />
+ <jdbc.isolation/>
</properties>
</profile>
@@ -680,10 +712,12 @@
<properties>
<db.dialect>org.hibernate.dialect.Oracle10gDialect</db.dialect>
<jdbc.driver>oracle.jdbc.driver.OracleDriver</jdbc.driver>
- <jdbc.url>jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(LOAD_BALANCE=ON)(ADDRESS=(PROTOCOL=TCP)(HOST=vmg24-vip.mw.lab.eng.bos.redhat.com)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=vmg25-vip.mw.lab.eng.bos.redhat.com)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=qarac.jboss)))</jdbc.url>
+ <jdbc.url>
+ jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(LOAD_BALANCE=ON)(ADDRESS=(PROTOCOL=TCP)(HOST=vmg24-vip.mw.lab.eng.bos.redhat.com)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=vmg25-vip.mw.lab.eng.bos.redhat.com)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=qarac.jboss)))
+ </jdbc.url>
<jdbc.user>searctru</jdbc.user>
<jdbc.pass>searctru</jdbc.pass>
- <jdbc.isolation />
+ <jdbc.isolation/>
</properties>
</profile>
@@ -703,7 +737,7 @@
<jdbc.url>jdbc:sybase:Tds:vmg07.mw.lab.eng.bos.redhat.com:5000/searctru</jdbc.url>
<jdbc.user>searctru</jdbc.user>
<jdbc.pass>searctru</jdbc.pass>
- <jdbc.isolation />
+ <jdbc.isolation/>
</properties>
</profile>
Modified: search/trunk/src/main/java/org/hibernate/search/Version.java
===================================================================
--- search/trunk/src/main/java/org/hibernate/search/Version.java 2010-01-18 18:27:12 UTC (rev 18573)
+++ search/trunk/src/main/java/org/hibernate/search/Version.java 2010-01-18 19:08:55 UTC (rev 18574)
@@ -28,16 +28,18 @@
/**
* @author Emmanuel Bernard
+ * @author Hardy Ferentschik
*/
public class Version {
-
- public static final String VERSION = "3.2.0.Beta1";
+ public static String getVersionString() {
+ return "[WORKING]";
+ }
+
static {
- LoggerFactory.make().info( "Hibernate Search {}", VERSION );
+ LoggerFactory.make().info( "Hibernate Search {}", getVersionString() );
}
public static void touch() {
}
-
}
15 years