Hibernate SVN: r15258 - in core/trunk: core/src/main/java/org/hibernate/impl and 5 other directories.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2008-10-07 11:54:42 -0400 (Tue, 07 Oct 2008)
New Revision: 15258
Added:
core/trunk/core/src/main/java/org/hibernate/EntityNameResolver.java
core/trunk/testsuite/src/test/java/org/hibernate/test/dynamicentity/tuplizer2/
core/trunk/testsuite/src/test/java/org/hibernate/test/dynamicentity/tuplizer2/Customer.hbm.xml
core/trunk/testsuite/src/test/java/org/hibernate/test/dynamicentity/tuplizer2/ImprovedTuplizerDynamicEntityTest.java
core/trunk/testsuite/src/test/java/org/hibernate/test/dynamicentity/tuplizer2/MyEntityInstantiator.java
core/trunk/testsuite/src/test/java/org/hibernate/test/dynamicentity/tuplizer2/MyEntityTuplizer.java
Modified:
core/trunk/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java
core/trunk/core/src/main/java/org/hibernate/impl/SessionImpl.java
core/trunk/core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java
core/trunk/core/src/main/java/org/hibernate/persister/entity/EntityPersister.java
core/trunk/core/src/main/java/org/hibernate/tuple/EntityModeToTuplizerMapping.java
core/trunk/core/src/main/java/org/hibernate/tuple/entity/AbstractEntityTuplizer.java
core/trunk/core/src/main/java/org/hibernate/tuple/entity/Dom4jEntityTuplizer.java
core/trunk/core/src/main/java/org/hibernate/tuple/entity/DynamicMapEntityTuplizer.java
core/trunk/core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java
core/trunk/core/src/main/java/org/hibernate/tuple/entity/EntityTuplizer.java
core/trunk/core/src/main/java/org/hibernate/tuple/entity/PojoEntityTuplizer.java
Log:
HHH-3515 : EntityNameResolver
Added: core/trunk/core/src/main/java/org/hibernate/EntityNameResolver.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/EntityNameResolver.java (rev 0)
+++ core/trunk/core/src/main/java/org/hibernate/EntityNameResolver.java 2008-10-07 15:54:42 UTC (rev 15258)
@@ -0,0 +1,42 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+/**
+ * Contract for resolving an entity-name from a given entity instance.
+ *
+ * @author Steve Ebersole
+ */
+public interface EntityNameResolver {
+ /**
+ * Given an entity instance, determine its entity-name.
+ *
+ * @param entity The entity instance.
+ *
+ * @return The corresponding entity-name, or null if this impl does not know how to perform resolution
+ * for the given entity instance.
+ */
+ public String resolveEntityName(Object entity);
+}
Modified: core/trunk/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java 2008-10-06 22:17:13 UTC (rev 15257)
+++ core/trunk/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java 2008-10-07 15:54:42 UTC (rev 15258)
@@ -39,6 +39,7 @@
import java.util.Map;
import java.util.Properties;
import java.util.Set;
+import java.util.LinkedHashSet;
import javax.naming.NamingException;
import javax.naming.Reference;
import javax.naming.StringRefAddr;
@@ -58,6 +59,8 @@
import org.hibernate.SessionFactory;
import org.hibernate.StatelessSession;
import org.hibernate.SessionFactoryObserver;
+import org.hibernate.EntityNameResolver;
+import org.hibernate.tuple.entity.EntityTuplizer;
import org.hibernate.cache.CacheKey;
import org.hibernate.cache.CollectionRegion;
import org.hibernate.cache.EntityRegion;
@@ -117,6 +120,7 @@
import org.hibernate.type.Type;
import org.hibernate.util.CollectionHelper;
import org.hibernate.util.ReflectHelper;
+import org.hibernate.util.EmptyIterator;
/**
@@ -177,6 +181,7 @@
private final transient EntityNotFoundDelegate entityNotFoundDelegate;
private final transient SQLFunctionRegistry sqlFunctionRegistry;
private final transient SessionFactoryObserver observer;
+ private final transient HashMap entityNameResolvers = new HashMap();
private final QueryPlanCache queryPlanCache = new QueryPlanCache( this );
@@ -325,11 +330,15 @@
// after *all* persisters and named queries are registered
Iterator iter = entityPersisters.values().iterator();
while ( iter.hasNext() ) {
- ( (EntityPersister) iter.next() ).postInstantiate();
+ final EntityPersister persister = ( ( EntityPersister ) iter.next() );
+ persister.postInstantiate();
+ registerEntityNameResolvers( persister );
+
}
iter = collectionPersisters.values().iterator();
while ( iter.hasNext() ) {
- ( (CollectionPersister) iter.next() ).postInstantiate();
+ final CollectionPersister persister = ( ( CollectionPersister ) iter.next() );
+ persister.postInstantiate();
}
//JNDI + Serialization:
@@ -458,6 +467,41 @@
this.observer.sessionFactoryCreated( this );
}
+ private void registerEntityNameResolvers(EntityPersister persister) {
+ Iterator itr = persister.getEntityMetamodel().getTuplizerMapping().iterateTuplizers();
+ while ( itr.hasNext() ) {
+ final EntityTuplizer tuplizer = ( EntityTuplizer ) itr.next();
+ registerEntityNameResolvers( tuplizer );
+ }
+ }
+
+ private void registerEntityNameResolvers(EntityTuplizer tuplizer) {
+ EntityNameResolver[] resolvers = tuplizer.getEntityNameResolvers();
+ if ( resolvers == null ) {
+ return;
+ }
+
+ for ( int i = 0; i < resolvers.length; i++ ) {
+ registerEntityNameResolver( resolvers[i], tuplizer.getEntityMode() );
+ }
+ }
+
+ public void registerEntityNameResolver(EntityNameResolver resolver, EntityMode entityMode) {
+ LinkedHashSet resolversForMode = ( LinkedHashSet ) entityNameResolvers.get( entityMode );
+ if ( resolversForMode == null ) {
+ resolversForMode = new LinkedHashSet();
+ entityNameResolvers.put( entityMode, resolversForMode );
+ }
+ resolversForMode.add( resolver );
+ }
+
+ public Iterator iterateEntityNameResolvers(EntityMode entityMode) {
+ Set actualEntityNameResolvers = ( Set ) entityNameResolvers.get( entityMode );
+ return actualEntityNameResolvers == null
+ ? EmptyIterator.INSTANCE
+ : actualEntityNameResolvers.iterator();
+ }
+
public QueryPlanCache getQueryPlanCache() {
return queryPlanCache;
}
Modified: core/trunk/core/src/main/java/org/hibernate/impl/SessionImpl.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/impl/SessionImpl.java 2008-10-06 22:17:13 UTC (rev 15257)
+++ core/trunk/core/src/main/java/org/hibernate/impl/SessionImpl.java 2008-10-07 15:54:42 UTC (rev 15258)
@@ -67,6 +67,7 @@
import org.hibernate.TransientObjectException;
import org.hibernate.UnresolvableObjectException;
import org.hibernate.UnknownProfileException;
+import org.hibernate.EntityNameResolver;
import org.hibernate.collection.PersistentCollection;
import org.hibernate.engine.ActionQueue;
import org.hibernate.engine.CollectionEntry;
@@ -127,6 +128,7 @@
import org.hibernate.stat.SessionStatistics;
import org.hibernate.stat.SessionStatisticsImpl;
import org.hibernate.tuple.DynamicMapInstantiator;
+import org.hibernate.tuple.entity.PojoEntityTuplizer;
import org.hibernate.type.Type;
import org.hibernate.util.ArrayHelper;
import org.hibernate.util.CollectionHelper;
@@ -175,6 +177,30 @@
private transient Session rootSession;
private transient Map childSessionsByEntityMode;
+ private EntityNameResolver entityNameResolver = new EntityNameResolver() {
+ public String resolveEntityName(Object entity) {
+ String entityName = interceptor.getEntityName( entity );
+ if ( entityName != null ) {
+ return entityName;
+ }
+
+ Iterator itr = factory.iterateEntityNameResolvers( entityMode );
+ while ( itr.hasNext() ) {
+ final EntityNameResolver resolver = ( EntityNameResolver ) itr.next();
+ entityName = resolver.resolveEntityName( entity );
+ if ( entityName != null ) {
+ break;
+ }
+ }
+ if ( entityName != null ) {
+ return entityName;
+ }
+
+ // the old-time stand-by...
+ return entity.getClass().getName();
+ }
+ };
+
/**
* Constructor used in building "child sessions".
*
@@ -1724,23 +1750,7 @@
public String guessEntityName(Object object) throws HibernateException {
errorIfClosed();
- String entity = interceptor.getEntityName( object );
- if ( entity == null ) {
- if ( object instanceof Map ) {
- entity = (String) ( (Map) object ).get( DynamicMapInstantiator.KEY );
- if ( entity == null ) {
- throw new HibernateException( "could not determine type of dynamic entity" );
- }
- }
- else if ( object instanceof Element ) {
- // TODO : really need to keep a map of nodeName -> entityName, but that would mean nodeName being distinct
- entity = ( (Element) object ).getName();
- }
- else {
- entity = object.getClass().getName();
- }
- }
- return entity;
+ return entityNameResolver.resolveEntityName( object );
}
public void cancelQuery() throws HibernateException {
Modified: core/trunk/core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java 2008-10-06 22:17:13 UTC (rev 15257)
+++ core/trunk/core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java 2008-10-07 15:54:42 UTC (rev 15258)
@@ -132,7 +132,6 @@
private final boolean isLazyPropertiesCacheable;
private final CacheEntryStructure cacheEntryStructure;
private final EntityMetamodel entityMetamodel;
- private final Map entityNameBySubclass = new HashMap();
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
private final String[] rootTableKeyColumnNames;
@@ -456,15 +455,6 @@
(CacheEntryStructure) new UnstructuredCacheEntry();
this.entityMetamodel = new EntityMetamodel( persistentClass, factory );
-
- if ( persistentClass.hasPojoRepresentation() ) {
- //TODO: this is currently specific to pojos, but need to be available for all entity-modes
- Iterator iter = persistentClass.getSubclassIterator();
- while ( iter.hasNext() ) {
- PersistentClass pc = ( PersistentClass ) iter.next();
- entityNameBySubclass.put( pc.getMappedClass(), pc.getEntityName() );
- }
- }
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
int batch = persistentClass.getBatchSize();
@@ -3302,10 +3292,6 @@
return entityMetamodel.getEntityType();
}
- private String getSubclassEntityName(Class clazz) {
- return ( String ) entityNameBySubclass.get( clazz );
- }
-
public boolean isPolymorphic() {
return entityMetamodel.isPolymorphic();
}
@@ -3694,29 +3680,17 @@
getTuplizer( entityMode ).resetIdentifier( entity, currentId, currentVersion );
}
- public EntityPersister getSubclassEntityPersister(Object instance, SessionFactoryImplementor factory, EntityMode entityMode) {
+ public EntityPersister getSubclassEntityPersister(
+ Object instance,
+ SessionFactoryImplementor factory,
+ EntityMode entityMode) {
if ( !hasSubclasses() ) {
return this;
}
else {
- // TODO : really need a way to do something like :
- // getTuplizer(entityMode).determineConcreteSubclassEntityName(instance)
- Class clazz = instance.getClass();
- if ( clazz == getMappedClass( entityMode ) ) {
- return this;
- }
- else {
- String subclassEntityName = getSubclassEntityName( clazz );
- if ( subclassEntityName == null ) {
- throw new HibernateException(
- "instance not of expected entity type: " + clazz.getName() +
- " is not a: " + getEntityName()
- );
- }
- else {
- return factory.getEntityPersister( subclassEntityName );
- }
- }
+ final String concreteEntityName = getTuplizer( entityMode )
+ .determineConcreteSubclassEntityName( instance, factory );
+ return factory.getEntityPersister( concreteEntityName );
}
}
Modified: core/trunk/core/src/main/java/org/hibernate/persister/entity/EntityPersister.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/persister/entity/EntityPersister.java 2008-10-06 22:17:13 UTC (rev 15257)
+++ core/trunk/core/src/main/java/org/hibernate/persister/entity/EntityPersister.java 2008-10-07 15:54:42 UTC (rev 15258)
@@ -668,15 +668,35 @@
public boolean hasUninitializedLazyProperties(Object object, EntityMode entityMode);
/**
- * Set the identifier and version of the given instance back
- * to its "unsaved" value, returning the id
- * @param currentId TODO
- * @param currentVersion TODO
+ * Set the identifier and version of the given instance back to its "unsaved" value.
+ *
+ * @param entity The entity instance
+ * @param currentId The currently assigned identifier value.
+ * @param currentVersion The currently assigned version value.
+ * @param entityMode The entity mode represented by the entity instance.
*/
public void resetIdentifier(Object entity, Serializable currentId, Object currentVersion, EntityMode entityMode);
/**
- * Get the persister for an instance of this class or a subclass
+ * A request has already identified the entity-name of this persister as the mapping for the given instance.
+ * However, we still need to account for possible subclassing and potentially re-route to the more appropriate
+ * persister.
+ * <p/>
+ * For example, a request names <tt>Animal</tt> as the entity-name which gets resolved to this persister. But the
+ * actual instance is really an instance of <tt>Cat</tt> which is a subclass of <tt>Animal</tt>. So, here the
+ * <tt>Animal</tt> persister is being asked to return the persister specific to <tt>Cat</tt>.
+ * <p/>
+ * It is also possible that the instance is actually an <tt>Animal</tt> instance in the above example in which
+ * case we would retrn <tt>this</tt> from this method.
+ *
+ * @param instance The entity instance
+ * @param factory Reference to the SessionFactory
+ * @param entityMode The entity mode represented by the entity instance.
+ *
+ * @return The appropriate persister
+ *
+ * @throws HibernateException Indicates that instance was deemed to not be a subclass of the entity mapped by
+ * this persister.
*/
public EntityPersister getSubclassEntityPersister(Object instance, SessionFactoryImplementor factory, EntityMode entityMode);
}
Modified: core/trunk/core/src/main/java/org/hibernate/tuple/EntityModeToTuplizerMapping.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/tuple/EntityModeToTuplizerMapping.java 2008-10-06 22:17:13 UTC (rev 15257)
+++ core/trunk/core/src/main/java/org/hibernate/tuple/EntityModeToTuplizerMapping.java 2008-10-07 15:54:42 UTC (rev 15258)
@@ -55,6 +55,15 @@
}
/**
+ * Allow iteration over all defined {@link Tuplizer Tuplizers}.
+ *
+ * @return Iterator over defined tuplizers
+ */
+ public Iterator iterateTuplizers() {
+ return tuplizers.values().iterator();
+ }
+
+ /**
* Given a supposed instance of an entity/component, guess its entity mode.
*
* @param object The supposed instance of the entity/component.
Modified: core/trunk/core/src/main/java/org/hibernate/tuple/entity/AbstractEntityTuplizer.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/tuple/entity/AbstractEntityTuplizer.java 2008-10-06 22:17:13 UTC (rev 15257)
+++ core/trunk/core/src/main/java/org/hibernate/tuple/entity/AbstractEntityTuplizer.java 2008-10-07 15:54:42 UTC (rev 15258)
@@ -74,13 +74,6 @@
/**
- * Return the entity-mode handled by this tuplizer instance.
- *
- * @return The entity-mode
- */
- protected abstract EntityMode getEntityMode();
-
- /**
* Build an appropriate Getter for the given property.
*
* @param mappedProperty The property to be accessed via the built Getter.
Modified: core/trunk/core/src/main/java/org/hibernate/tuple/entity/Dom4jEntityTuplizer.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/tuple/entity/Dom4jEntityTuplizer.java 2008-10-06 22:17:13 UTC (rev 15257)
+++ core/trunk/core/src/main/java/org/hibernate/tuple/entity/Dom4jEntityTuplizer.java 2008-10-07 15:54:42 UTC (rev 15258)
@@ -35,6 +35,8 @@
import org.hibernate.property.Setter;
import org.hibernate.EntityMode;
import org.hibernate.HibernateException;
+import org.hibernate.EntityNameResolver;
+import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.tuple.Instantiator;
import org.hibernate.tuple.Dom4jInstantiator;
import org.hibernate.type.AbstractComponentType;
@@ -44,8 +46,9 @@
import java.io.Serializable;
import java.util.HashSet;
-import java.util.Set;
import java.util.Iterator;
+import java.util.Map;
+import java.util.HashMap;
/**
* An {@link EntityTuplizer} specific to the dom4j entity mode.
@@ -57,17 +60,21 @@
static final Logger log = LoggerFactory.getLogger( Dom4jEntityTuplizer.class );
- private Set subclassNodeNames = new HashSet();
+ private Map inheritenceNodeNameMap = new HashMap();
Dom4jEntityTuplizer(EntityMetamodel entityMetamodel, PersistentClass mappedEntity) {
- super(entityMetamodel, mappedEntity);
+ super( entityMetamodel, mappedEntity );
+ inheritenceNodeNameMap.put( mappedEntity.getNodeName(), mappedEntity.getEntityName() );
Iterator itr = mappedEntity.getSubclassClosureIterator();
while( itr.hasNext() ) {
final PersistentClass mapping = ( PersistentClass ) itr.next();
- subclassNodeNames.add( mapping.getNodeName() );
+ inheritenceNodeNameMap.put( mapping.getNodeName(), mapping.getEntityName() );
}
}
+ /**
+ * {@inheritDoc}
+ */
public EntityMode getEntityMode() {
return EntityMode.DOM4J;
}
@@ -85,18 +92,30 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
protected Getter buildPropertyGetter(Property mappedProperty, PersistentClass mappedEntity) {
return buildPropertyAccessor(mappedProperty).getGetter( null, mappedProperty.getName() );
}
+ /**
+ * {@inheritDoc}
+ */
protected Setter buildPropertySetter(Property mappedProperty, PersistentClass mappedEntity) {
return buildPropertyAccessor(mappedProperty).getSetter( null, mappedProperty.getName() );
}
+ /**
+ * {@inheritDoc}
+ */
protected Instantiator buildInstantiator(PersistentClass persistentClass) {
return new Dom4jInstantiator( persistentClass );
}
+ /**
+ * {@inheritDoc}
+ */
public Serializable getIdentifier(Object entityOrId) throws HibernateException {
if (entityOrId instanceof Element) {
return super.getIdentifier(entityOrId);
@@ -107,6 +126,9 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
protected ProxyFactory buildProxyFactory(PersistentClass mappingInfo, Getter idGetter, Setter idSetter) {
HashSet proxyInterfaces = new HashSet();
proxyInterfaces.add( HibernateProxy.class );
@@ -132,15 +154,73 @@
return pf;
}
+ /**
+ * {@inheritDoc}
+ */
public Class getMappedClass() {
return Element.class;
}
+ /**
+ * {@inheritDoc}
+ */
public Class getConcreteProxyClass() {
return Element.class;
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isInstrumented() {
return false;
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public EntityNameResolver[] getEntityNameResolvers() {
+ return new EntityNameResolver[] { new BasicEntityNameResolver( getEntityName(), inheritenceNodeNameMap ) };
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String determineConcreteSubclassEntityName(Object entityInstance, SessionFactoryImplementor factory) {
+ return ( String ) inheritenceNodeNameMap.get( extractNodeName( ( Element ) entityInstance ) );
+ }
+
+ public static String extractNodeName(Element element) {
+ return element.getName();
+ }
+
+ public static class BasicEntityNameResolver implements EntityNameResolver {
+ private final String rootEntityName;
+ private final Map nodeNameToEntityNameMap;
+
+ public BasicEntityNameResolver(String rootEntityName, Map nodeNameToEntityNameMap) {
+ this.rootEntityName = rootEntityName;
+ this.nodeNameToEntityNameMap = nodeNameToEntityNameMap;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String resolveEntityName(Object entity) {
+ return ( String ) nodeNameToEntityNameMap.get( extractNodeName( ( Element ) entity ) );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean equals(Object obj) {
+ return rootEntityName.equals( ( ( BasicEntityNameResolver ) obj ).rootEntityName );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int hashCode() {
+ return rootEntityName.hashCode();
+ }
+ }
}
Modified: core/trunk/core/src/main/java/org/hibernate/tuple/entity/DynamicMapEntityTuplizer.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/tuple/entity/DynamicMapEntityTuplizer.java 2008-10-06 22:17:13 UTC (rev 15257)
+++ core/trunk/core/src/main/java/org/hibernate/tuple/entity/DynamicMapEntityTuplizer.java 2008-10-07 15:54:42 UTC (rev 15258)
@@ -28,6 +28,8 @@
import org.hibernate.EntityMode;
import org.hibernate.HibernateException;
+import org.hibernate.EntityNameResolver;
+import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.tuple.Instantiator;
import org.hibernate.tuple.DynamicMapInstantiator;
import org.hibernate.mapping.PersistentClass;
@@ -112,4 +114,37 @@
public boolean isInstrumented() {
return false;
}
+
+ public EntityNameResolver[] getEntityNameResolvers() {
+ return new EntityNameResolver[] { BasicEntityNameResolver.INSTANCE };
+ }
+
+ public String determineConcreteSubclassEntityName(Object entityInstance, SessionFactoryImplementor factory) {
+ // TODO : do we need an explicit isInstance check here, or is that asserted prior to here?
+ return extractEmbeddedEntityName( ( Map ) entityInstance );
+ }
+
+ public static String extractEmbeddedEntityName(Map entity) {
+ return ( String ) entity.get( DynamicMapInstantiator.KEY );
+ }
+
+ public static class BasicEntityNameResolver implements EntityNameResolver {
+ public static final BasicEntityNameResolver INSTANCE = new BasicEntityNameResolver();
+
+ public String resolveEntityName(Object entity) {
+ final String entityName = extractEmbeddedEntityName( ( Map ) entity );
+ if ( entityName == null ) {
+ throw new HibernateException( "Could not determine type of dynamic map entity" );
+ }
+ return entityName;
+ }
+
+ public boolean equals(Object obj) {
+ return getClass().equals( obj.getClass() );
+ }
+
+ public int hashCode() {
+ return getClass().hashCode();
+ }
+ }
}
Modified: core/trunk/core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java 2008-10-06 22:17:13 UTC (rev 15257)
+++ core/trunk/core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java 2008-10-07 15:54:42 UTC (rev 15258)
@@ -122,21 +122,10 @@
private final boolean inherited;
private final boolean hasSubclasses;
private final Set subclassEntityNames = new HashSet();
+ private final Map entityNameByInheritenceClassNameMap = new HashMap();
private final EntityEntityModeToTuplizerMapping tuplizerMapping;
- public EntityTuplizer getTuplizer(EntityMode entityMode) {
- return (EntityTuplizer) tuplizerMapping.getTuplizer( entityMode );
- }
-
- public EntityTuplizer getTuplizerOrNull(EntityMode entityMode) {
- return ( EntityTuplizer ) tuplizerMapping.getTuplizerOrNull( entityMode );
- }
-
- public EntityMode guessEntityMode(Object object) {
- return tuplizerMapping.guessEntityMode( object );
- }
-
public EntityMetamodel(PersistentClass persistentClass, SessionFactoryImplementor sessionFactory) {
this.sessionFactory = sessionFactory;
@@ -322,6 +311,15 @@
}
subclassEntityNames.add( name );
+ if ( persistentClass.hasPojoRepresentation() ) {
+ entityNameByInheritenceClassNameMap.put( persistentClass.getMappedClass(), persistentClass.getEntityName() );
+ iter = persistentClass.getSubclassIterator();
+ while ( iter.hasNext() ) {
+ final PersistentClass pc = ( PersistentClass ) iter.next();
+ entityNameByInheritenceClassNameMap.put( pc.getMappedClass(), pc.getEntityName() );
+ }
+ }
+
tuplizerMapping = new EntityEntityModeToTuplizerMapping( persistentClass, this );
}
@@ -395,6 +393,22 @@
}
}
+ public EntityEntityModeToTuplizerMapping getTuplizerMapping() {
+ return tuplizerMapping;
+ }
+
+ public EntityTuplizer getTuplizer(EntityMode entityMode) {
+ return (EntityTuplizer) tuplizerMapping.getTuplizer( entityMode );
+ }
+
+ public EntityTuplizer getTuplizerOrNull(EntityMode entityMode) {
+ return ( EntityTuplizer ) tuplizerMapping.getTuplizerOrNull( entityMode );
+ }
+
+ public EntityMode guessEntityMode(Object object) {
+ return tuplizerMapping.guessEntityMode( object );
+ }
+
public int[] getNaturalIdentifierProperties() {
return naturalIdPropertyNumbers;
}
@@ -555,6 +569,16 @@
return isAbstract;
}
+ /**
+ * Return the entity-name mapped to the given class within our inheritence hierarchy, if any.
+ *
+ * @param inheritenceClass The class for which to resolve the entity-name.
+ * @return The mapped entity-name, or null if no such mapping was found.
+ */
+ public String findEntityNameByEntityClass(Class inheritenceClass) {
+ return ( String ) entityNameByInheritenceClassNameMap.get( inheritenceClass.getName() );
+ }
+
public String toString() {
return "EntityMetamodel(" + name + ':' + ArrayHelper.toString(properties) + ')';
}
Modified: core/trunk/core/src/main/java/org/hibernate/tuple/entity/EntityTuplizer.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/tuple/entity/EntityTuplizer.java 2008-10-06 22:17:13 UTC (rev 15257)
+++ core/trunk/core/src/main/java/org/hibernate/tuple/entity/EntityTuplizer.java 2008-10-07 15:54:42 UTC (rev 15258)
@@ -28,8 +28,11 @@
import java.util.Map;
import org.hibernate.HibernateException;
+import org.hibernate.EntityNameResolver;
+import org.hibernate.EntityMode;
import org.hibernate.tuple.Tuplizer;
import org.hibernate.engine.SessionImplementor;
+import org.hibernate.engine.SessionFactoryImplementor;
/**
* Defines further responsibilities reagarding tuplization based on
@@ -42,6 +45,12 @@
* @author Steve Ebersole
*/
public interface EntityTuplizer extends Tuplizer {
+ /**
+ * Return the entity-mode handled by this tuplizer instance.
+ *
+ * @return The entity-mode
+ */
+ public EntityMode getEntityMode();
/**
* Create an entity instance initialized with the given identifier.
@@ -176,11 +185,11 @@
*/
public boolean isValidatableImplementor();
- // TODO: getConcreteProxyClass() is solely used (externally) to perform narrowProxy()
- // would be great to fully encapsulate that narrowProxy() functionality within the
- // Tuplizer, itself, with a Tuplizer.narrowProxy(..., PersistentContext) method
/**
* Returns the java class to which generated proxies will be typed.
+ * <p/>
+ * todo : look at fully encapsulating {@link org.hibernate.engine.PersistenceContext#narrowProxy} here,
+ * since that is the only external use of this method
*
* @return The java class to which generated proxies will be typed
*/
@@ -198,4 +207,35 @@
* Is it an instrumented POJO?
*/
public boolean isInstrumented();
+
+ /**
+ * Get any {@link EntityNameResolver EntityNameResolvers} associated with this {@link Tuplizer}.
+ *
+ * @return The associated resolvers. May be null or empty.
+ */
+ public EntityNameResolver[] getEntityNameResolvers();
+
+ /**
+ * Given an entity instance, determine the most appropriate (most targeted) entity-name which represents it.
+ * This is called in situations where we already know an entity name for the given entityInstance; we are being
+ * asked to determine if there is a more appropriate entity-name to use, specifically within an inheritence
+ * hierarchy.
+ * <p/>
+ * For example, consider a case where a user calls <tt>session.update( "Animal", cat );</tt>. Here, the
+ * user has explicitly provided <tt>Animal</tt> as the entity-name. However, they have passed in an instance
+ * of <tt>Cat</tt> which is a subclass of <tt>Animal</tt>. In this case, we would return <tt>Cat</tt> as the
+ * entity-name.
+ * <p/>
+ * <tt>null</tt> may be returned from calls to this method. The meaining of <tt>null</tt> in that case is assumed
+ * to be that we should use whatever explicit entity-name the user provided (<tt>Animal</tt> rather than <tt>Cat</tt>
+ * in the example above).
+ *
+ * @param entityInstance The entity instance.
+ * @param factory Reference to the SessionFactory.
+ *
+ * @return The most appropriate entity name to use.
+ *
+ * @throws HibernateException If we are unable to determine an entity-name within the inheritence hierarchy.
+ */
+ public String determineConcreteSubclassEntityName(Object entityInstance, SessionFactoryImplementor factory);
}
Modified: core/trunk/core/src/main/java/org/hibernate/tuple/entity/PojoEntityTuplizer.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/tuple/entity/PojoEntityTuplizer.java 2008-10-06 22:17:13 UTC (rev 15257)
+++ core/trunk/core/src/main/java/org/hibernate/tuple/entity/PojoEntityTuplizer.java 2008-10-07 15:54:42 UTC (rev 15258)
@@ -36,6 +36,7 @@
import org.hibernate.EntityMode;
import org.hibernate.HibernateException;
import org.hibernate.MappingException;
+import org.hibernate.EntityNameResolver;
import org.hibernate.tuple.Instantiator;
import org.hibernate.tuple.PojoInstantiator;
import org.hibernate.bytecode.ReflectionOptimizer;
@@ -43,6 +44,7 @@
import org.hibernate.classic.Lifecycle;
import org.hibernate.classic.Validatable;
import org.hibernate.engine.SessionImplementor;
+import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.intercept.FieldInterceptor;
import org.hibernate.intercept.FieldInterceptionHelper;
import org.hibernate.mapping.PersistentClass;
@@ -70,7 +72,7 @@
private final boolean lifecycleImplementor;
private final boolean validatableImplementor;
private final Set lazyPropertyNames = new HashSet();
- private ReflectionOptimizer optimizer;
+ private final ReflectionOptimizer optimizer;
public PojoEntityTuplizer(EntityMetamodel entityMetamodel, PersistentClass mappedEntity) {
super( entityMetamodel, mappedEntity );
@@ -109,6 +111,9 @@
}
+ /**
+ * {@inheritDoc}
+ */
protected ProxyFactory buildProxyFactory(PersistentClass persistentClass, Getter idGetter, Setter idSetter) {
// determine the id getter and setter methods from the proxy interface (if any)
// determine all interfaces needed by the resulting proxy
@@ -199,11 +204,14 @@
}
protected ProxyFactory buildProxyFactoryInternal(PersistentClass persistentClass, Getter idGetter, Setter idSetter) {
- // TODO : YUCK!!! finx after HHH-1907 is complete
+ // TODO : YUCK!!! fix after HHH-1907 is complete
return Environment.getBytecodeProvider().getProxyFactoryFactory().buildProxyFactory();
// return getFactory().getSettings().getBytecodeProvider().getProxyFactoryFactory().buildProxyFactory();
}
+ /**
+ * {@inheritDoc}
+ */
protected Instantiator buildInstantiator(PersistentClass persistentClass) {
if ( optimizer == null ) {
return new PojoInstantiator( persistentClass, null );
@@ -213,6 +221,9 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public void setPropertyValues(Object entity, Object[] values) throws HibernateException {
if ( !getEntityMetamodel().hasLazyProperties() && optimizer != null && optimizer.getAccessOptimizer() != null ) {
setPropertyValuesWithOptimizer( entity, values );
@@ -222,6 +233,9 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public Object[] getPropertyValues(Object entity) throws HibernateException {
if ( shouldGetAllProperties( entity ) && optimizer != null && optimizer.getAccessOptimizer() != null ) {
return getPropertyValuesWithOptimizer( entity );
@@ -231,6 +245,9 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public Object[] getPropertyValuesToInsert(Object entity, Map mergeMap, SessionImplementor session) throws HibernateException {
if ( shouldGetAllProperties( entity ) && optimizer != null && optimizer.getAccessOptimizer() != null ) {
return getPropertyValuesWithOptimizer( entity );
@@ -248,36 +265,60 @@
return optimizer.getAccessOptimizer().getPropertyValues( object );
}
+ /**
+ * {@inheritDoc}
+ */
public EntityMode getEntityMode() {
return EntityMode.POJO;
}
+ /**
+ * {@inheritDoc}
+ */
public Class getMappedClass() {
return mappedClass;
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isLifecycleImplementor() {
return lifecycleImplementor;
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isValidatableImplementor() {
return validatableImplementor;
}
+ /**
+ * {@inheritDoc}
+ */
protected Getter buildPropertyGetter(Property mappedProperty, PersistentClass mappedEntity) {
return mappedProperty.getGetter( mappedEntity.getMappedClass() );
}
+ /**
+ * {@inheritDoc}
+ */
protected Setter buildPropertySetter(Property mappedProperty, PersistentClass mappedEntity) {
return mappedProperty.getSetter( mappedEntity.getMappedClass() );
}
+ /**
+ * {@inheritDoc}
+ */
public Class getConcreteProxyClass() {
return proxyInterface;
}
//TODO: need to make the majority of this functionality into a top-level support class for custom impl support
+ /**
+ * {@inheritDoc}
+ */
public void afterInitialize(Object entity, boolean lazyPropertiesAreUnfetched, SessionImplementor session) {
if ( isInstrumented() ) {
Set lazyProps = lazyPropertiesAreUnfetched && getEntityMetamodel().hasLazyProperties() ?
@@ -288,6 +329,9 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public boolean hasUninitializedLazyProperties(Object entity) {
if ( getEntityMetamodel().hasLazyProperties() ) {
FieldInterceptor callback = FieldInterceptionHelper.extractFieldInterceptor( entity );
@@ -298,8 +342,37 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isInstrumented() {
return FieldInterceptionHelper.isInstrumented( getMappedClass() );
}
+ /**
+ * {@inheritDoc}
+ */
+ public String determineConcreteSubclassEntityName(Object entityInstance, SessionFactoryImplementor factory) {
+ final Class concreteEntityClass = entityInstance.getClass();
+ if ( concreteEntityClass == getMappedClass() ) {
+ return getEntityName();
+ }
+ else {
+ String entityName = getEntityMetamodel().findEntityNameByEntityClass( concreteEntityClass );
+ if ( entityName == null ) {
+ throw new HibernateException(
+ "Unable to resolve entity name from Class [" + concreteEntityClass.getName() + "]"
+ + " expected instance/subclass of [" + getEntityName() + "]"
+ );
+ }
+ return entityName;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public EntityNameResolver[] getEntityNameResolvers() {
+ return null;
+ }
}
Copied: core/trunk/testsuite/src/test/java/org/hibernate/test/dynamicentity/tuplizer2/Customer.hbm.xml (from rev 15071, core/trunk/testsuite/src/test/java/org/hibernate/test/dynamicentity/tuplizer/Customer.hbm.xml)
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/dynamicentity/tuplizer2/Customer.hbm.xml (rev 0)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/dynamicentity/tuplizer2/Customer.hbm.xml 2008-10-07 15:54:42 UTC (rev 15258)
@@ -0,0 +1,72 @@
+<?xml version="1.0"?>
+<!--
+ ~ Hibernate, Relational Persistence for Idiomatic Java
+ ~
+ ~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ ~ indicated by the @author tags or express copyright attribution
+ ~ statements applied by the authors. All third-party contributions are
+ ~ distributed under license by Red Hat Middleware LLC.
+ ~
+ ~ This copyrighted material is made available to anyone wishing to use, modify,
+ ~ copy, or redistribute it subject to the terms and conditions of the GNU
+ ~ Lesser General Public License, as published by the Free Software Foundation.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ ~ for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this distribution; if not, write to:
+ ~ Free Software Foundation, Inc.
+ ~ 51 Franklin Street, Fifth Floor
+ ~ Boston, MA 02110-1301 USA
+ ~
+ -->
+
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="org.hibernate.test.dynamicentity">
+
+ <class name="Person" table="t_person" discriminator-value="person" abstract="false">
+ <tuplizer class="org.hibernate.test.dynamicentity.tuplizer2.MyEntityTuplizer" entity-mode="pojo"/>
+ <id name="id">
+ <generator class="native"/>
+ </id>
+ <discriminator force="false"/>
+ <property name="name"/>
+
+ <many-to-one name="address" cascade="all" column="addr_id"/>
+
+ <set name="family" lazy="true" cascade="all">
+ <key column="pers_id"/>
+ <one-to-many class="Person"/>
+ </set>
+
+ <subclass name="Customer" discriminator-value="customer" abstract="false">
+ <tuplizer class="org.hibernate.test.dynamicentity.tuplizer2.MyEntityTuplizer" entity-mode="pojo"/>
+ <many-to-one name="company" cascade="none" column="comp_id"/>
+ </subclass>
+ </class>
+
+ <class name="Company" table="t_company" abstract="false">
+ <tuplizer class="org.hibernate.test.dynamicentity.tuplizer2.MyEntityTuplizer" entity-mode="pojo"/>
+ <id name="id">
+ <generator class="native"/>
+ </id>
+ <property name="name"/>
+ </class>
+
+ <class name="Address" table="t_address" abstract="false">
+ <tuplizer class="org.hibernate.test.dynamicentity.tuplizer2.MyEntityTuplizer" entity-mode="pojo"/>
+ <id name="id">
+ <generator class="native"/>
+ </id>
+ <property name="street"/>
+ <property name="city"/>
+ <property name="postalCode"/>
+ </class>
+
+</hibernate-mapping>
Copied: core/trunk/testsuite/src/test/java/org/hibernate/test/dynamicentity/tuplizer2/ImprovedTuplizerDynamicEntityTest.java (from rev 15071, core/trunk/testsuite/src/test/java/org/hibernate/test/dynamicentity/tuplizer/TuplizerDynamicEntityTest.java)
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/dynamicentity/tuplizer2/ImprovedTuplizerDynamicEntityTest.java (rev 0)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/dynamicentity/tuplizer2/ImprovedTuplizerDynamicEntityTest.java 2008-10-07 15:54:42 UTC (rev 15258)
@@ -0,0 +1,149 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate.test.dynamicentity.tuplizer2;
+
+import org.hibernate.test.dynamicentity.Company;
+import org.hibernate.test.dynamicentity.ProxyHelper;
+import org.hibernate.test.dynamicentity.Customer;
+import org.hibernate.test.dynamicentity.Address;
+import org.hibernate.test.dynamicentity.Person;
+import org.hibernate.Session;
+import org.hibernate.Hibernate;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.junit.functional.FunctionalTestCase;
+import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
+
+import junit.framework.TestSuite;
+
+import java.util.HashSet;
+
+/**
+ * Demonstrates use of Tuplizers to allow the use of JDK
+ * {@link java.lang.reflect.Proxy dynamic proxies} as our
+ * domain model.
+ * <p/>
+ * Here we plug a custom Interceptor into the session simply to
+ * allow us to not have to explicitly supply the appropriate entity
+ * name to the Session calls.
+ *
+ * @author Steve Ebersole
+ */
+public class ImprovedTuplizerDynamicEntityTest extends FunctionalTestCase {
+ public ImprovedTuplizerDynamicEntityTest(String x) {
+ super( x );
+ }
+
+ public String[] getMappings() {
+ return new String[] { "dynamicentity/tuplizer2/Customer.hbm.xml" };
+ }
+
+ public void configure(Configuration cfg) {
+ super.configure( cfg );
+ }
+
+ public static TestSuite suite() {
+ return new FunctionalTestClassTestSuite( ImprovedTuplizerDynamicEntityTest.class );
+ }
+
+ public void testIt() {
+ // Test saving these dyna-proxies
+ Session session = openSession();
+ session.beginTransaction();
+ Company company = ProxyHelper.newCompanyProxy();
+ company.setName( "acme" );
+ session.save( company );
+ Customer customer = ProxyHelper.newCustomerProxy();
+ customer.setName( "Steve" );
+ customer.setCompany( company );
+ Address address = ProxyHelper.newAddressProxy();
+ address.setStreet( "somewhere over the rainbow" );
+ address.setCity( "lawerence, kansas" );
+ address.setPostalCode( "toto");
+ customer.setAddress( address );
+ customer.setFamily( new HashSet() );
+ Person son = ProxyHelper.newPersonProxy();
+ son.setName( "son" );
+ customer.getFamily().add( son );
+ Person wife = ProxyHelper.newPersonProxy();
+ wife.setName( "wife" );
+ customer.getFamily().add( wife );
+ session.save( customer );
+ session.getTransaction().commit();
+ session.close();
+
+ assertNotNull( "company id not assigned", company.getId() );
+ assertNotNull( "customer id not assigned", customer.getId() );
+ assertNotNull( "address id not assigned", address.getId() );
+ assertNotNull( "son:Person id not assigned", son.getId() );
+ assertNotNull( "wife:Person id not assigned", wife.getId() );
+
+ // Test loading these dyna-proxies, along with flush processing
+ session = openSession();
+ session.beginTransaction();
+ customer = ( Customer ) session.load( Customer.class, customer.getId() );
+ assertFalse( "should-be-proxy was initialized", Hibernate.isInitialized( customer ) );
+
+ customer.setName( "other" );
+ session.flush();
+ assertFalse( "should-be-proxy was initialized", Hibernate.isInitialized( customer.getCompany() ) );
+
+ session.refresh( customer );
+ assertEquals( "name not updated", "other", customer.getName() );
+ assertEquals( "company association not correct", "acme", customer.getCompany().getName() );
+
+ session.getTransaction().commit();
+ session.close();
+
+ // Test detached entity re-attachment with these dyna-proxies
+ customer.setName( "Steve" );
+ session = openSession();
+ session.beginTransaction();
+ session.update( customer );
+ session.flush();
+ session.refresh( customer );
+ assertEquals( "name not updated", "Steve", customer.getName() );
+ session.getTransaction().commit();
+ session.close();
+
+ // Test querying
+ session = openSession();
+ session.beginTransaction();
+ int count = session.createQuery( "from Customer" ).list().size();
+ assertEquals( "querying dynamic entity", 1, count );
+ session.clear();
+ count = session.createQuery( "from Person" ).list().size();
+ assertEquals( "querying dynamic entity", 3, count );
+ session.getTransaction().commit();
+ session.close();
+
+ // test deleteing
+ session = openSession();
+ session.beginTransaction();
+ session.delete( company );
+ session.delete( customer );
+ session.getTransaction().commit();
+ session.close();
+ }
+}
\ No newline at end of file
Copied: core/trunk/testsuite/src/test/java/org/hibernate/test/dynamicentity/tuplizer2/MyEntityInstantiator.java (from rev 15071, core/trunk/testsuite/src/test/java/org/hibernate/test/dynamicentity/tuplizer/MyEntityInstantiator.java)
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/dynamicentity/tuplizer2/MyEntityInstantiator.java (rev 0)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/dynamicentity/tuplizer2/MyEntityInstantiator.java 2008-10-07 15:54:42 UTC (rev 15258)
@@ -0,0 +1,78 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate.test.dynamicentity.tuplizer2;
+
+import org.hibernate.tuple.Instantiator;
+import org.hibernate.test.dynamicentity.Customer;
+import org.hibernate.test.dynamicentity.ProxyHelper;
+import org.hibernate.test.dynamicentity.Company;
+import org.hibernate.test.dynamicentity.Address;
+import org.hibernate.test.dynamicentity.Person;
+import org.hibernate.util.ReflectHelper;
+import org.hibernate.HibernateException;
+
+import java.io.Serializable;
+
+/**
+ * @author Steve Ebersole
+ */
+public class MyEntityInstantiator implements Instantiator {
+ private final String entityName;
+
+ public MyEntityInstantiator(String entityName) {
+ this.entityName = entityName;
+ }
+
+ public Object instantiate(Serializable id) {
+ if ( Person.class.getName().equals( entityName ) ) {
+ return ProxyHelper.newPersonProxy( id );
+ }
+ if ( Customer.class.getName().equals( entityName ) ) {
+ return ProxyHelper.newCustomerProxy( id );
+ }
+ else if ( Company.class.getName().equals( entityName ) ) {
+ return ProxyHelper.newCompanyProxy( id );
+ }
+ else if ( Address.class.getName().equals( entityName ) ) {
+ return ProxyHelper.newAddressProxy( id );
+ }
+ else {
+ throw new IllegalArgumentException( "unknown entity for instantiation [" + entityName + "]" );
+ }
+ }
+
+ public Object instantiate() {
+ return instantiate( null );
+ }
+
+ public boolean isInstance(Object object) {
+ try {
+ return ReflectHelper.classForName( entityName ).isInstance( object );
+ }
+ catch( Throwable t ) {
+ throw new HibernateException( "could not get handle to entity-name as interface : " + t );
+ }
+ }
+}
\ No newline at end of file
Copied: core/trunk/testsuite/src/test/java/org/hibernate/test/dynamicentity/tuplizer2/MyEntityTuplizer.java (from rev 15071, core/trunk/testsuite/src/test/java/org/hibernate/test/dynamicentity/tuplizer/MyEntityTuplizer.java)
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/dynamicentity/tuplizer2/MyEntityTuplizer.java (rev 0)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/dynamicentity/tuplizer2/MyEntityTuplizer.java 2008-10-07 15:54:42 UTC (rev 15258)
@@ -0,0 +1,87 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate.test.dynamicentity.tuplizer2;
+
+import org.hibernate.tuple.entity.PojoEntityTuplizer;
+import org.hibernate.tuple.entity.EntityMetamodel;
+import org.hibernate.tuple.Instantiator;
+import org.hibernate.mapping.PersistentClass;
+import org.hibernate.proxy.ProxyFactory;
+import org.hibernate.property.Getter;
+import org.hibernate.property.Setter;
+import org.hibernate.test.dynamicentity.tuplizer.MyEntityInstantiator;
+import org.hibernate.test.dynamicentity.ProxyHelper;
+import org.hibernate.engine.SessionFactoryImplementor;
+import org.hibernate.EntityNameResolver;
+
+/**
+ * @author Steve Ebersole
+ */
+public class MyEntityTuplizer extends PojoEntityTuplizer {
+
+ public MyEntityTuplizer(EntityMetamodel entityMetamodel, PersistentClass mappedEntity) {
+ super( entityMetamodel, mappedEntity );
+ }
+
+ public EntityNameResolver[] getEntityNameResolvers() {
+ return new EntityNameResolver[] { MyEntityNameResolver.INSTANCE };
+ }
+
+ protected Instantiator buildInstantiator(PersistentClass persistentClass) {
+ return new MyEntityInstantiator( persistentClass.getEntityName() );
+ }
+
+ public String determineConcreteSubclassEntityName(Object entityInstance, SessionFactoryImplementor factory) {
+ String entityName = ProxyHelper.extractEntityName( entityInstance );
+ if ( entityName == null ) {
+ entityName = super.determineConcreteSubclassEntityName( entityInstance, factory );
+ }
+ return entityName;
+ }
+
+ protected ProxyFactory buildProxyFactory(PersistentClass persistentClass, Getter idGetter, Setter idSetter) {
+ // allows defining a custom proxy factory, which is responsible for
+ // generating lazy proxies for a given entity.
+ //
+ // Here we simply use the default...
+ return super.buildProxyFactory( persistentClass, idGetter, idSetter );
+ }
+
+ public static class MyEntityNameResolver implements EntityNameResolver {
+ public static final MyEntityNameResolver INSTANCE = new MyEntityNameResolver();
+
+ public String resolveEntityName(Object entity) {
+ return ProxyHelper.extractEntityName( entity );
+ }
+
+ public boolean equals(Object obj) {
+ return getClass().equals( obj.getClass() );
+ }
+
+ public int hashCode() {
+ return getClass().hashCode();
+ }
+ }
+}
\ No newline at end of file
17 years, 1 month
Hibernate SVN: r15257 - annotations/branches/v3_2_1_GA_CP/src/test/org/hibernate/test/annotations/bytecode.
by hibernate-commits@lists.jboss.org
Author: gbadner
Date: 2008-10-06 18:17:13 -0400 (Mon, 06 Oct 2008)
New Revision: 15257
Added:
annotations/branches/v3_2_1_GA_CP/src/test/org/hibernate/test/annotations/bytecode/Hammer.hbm.xml
Removed:
annotations/branches/v3_2_1_GA_CP/src/test/org/hibernate/test/annotations/bytecode/hammer.hbm.xml
Modified:
annotations/branches/v3_2_1_GA_CP/src/test/org/hibernate/test/annotations/bytecode/ProxyBreakingTest.java
Log:
JBPAPP-1258 ANN-588 - ProxyBreakingTest fails on case sensitive file systems and path typo
Copied: annotations/branches/v3_2_1_GA_CP/src/test/org/hibernate/test/annotations/bytecode/Hammer.hbm.xml (from rev 15256, annotations/branches/v3_2_1_GA_CP/src/test/org/hibernate/test/annotations/bytecode/hammer.hbm.xml)
===================================================================
--- annotations/branches/v3_2_1_GA_CP/src/test/org/hibernate/test/annotations/bytecode/Hammer.hbm.xml (rev 0)
+++ annotations/branches/v3_2_1_GA_CP/src/test/org/hibernate/test/annotations/bytecode/Hammer.hbm.xml 2008-10-06 22:17:13 UTC (rev 15257)
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="org.hibernate.test.annotations.bytecode">
+ <class name="Hammer">
+ <id name="id" type="java.lang.Long">
+ <generator class="increment"/>
+ </id>
+ </class>
+</hibernate-mapping>
\ No newline at end of file
Modified: annotations/branches/v3_2_1_GA_CP/src/test/org/hibernate/test/annotations/bytecode/ProxyBreakingTest.java
===================================================================
--- annotations/branches/v3_2_1_GA_CP/src/test/org/hibernate/test/annotations/bytecode/ProxyBreakingTest.java 2008-10-03 22:16:43 UTC (rev 15256)
+++ annotations/branches/v3_2_1_GA_CP/src/test/org/hibernate/test/annotations/bytecode/ProxyBreakingTest.java 2008-10-06 22:17:13 UTC (rev 15257)
@@ -41,7 +41,7 @@
protected String[] getXmlFiles() {
return new String[] {
- "annotations/bytecode/Hammer.hbm.xml"
+ "org/hibernate/test/annotations/bytecode/Hammer.hbm.xml"
};
}
Deleted: annotations/branches/v3_2_1_GA_CP/src/test/org/hibernate/test/annotations/bytecode/hammer.hbm.xml
===================================================================
--- annotations/branches/v3_2_1_GA_CP/src/test/org/hibernate/test/annotations/bytecode/hammer.hbm.xml 2008-10-03 22:16:43 UTC (rev 15256)
+++ annotations/branches/v3_2_1_GA_CP/src/test/org/hibernate/test/annotations/bytecode/hammer.hbm.xml 2008-10-06 22:17:13 UTC (rev 15257)
@@ -1,12 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping package="org.hibernate.test.annotations.bytecode">
- <class name="Hammer">
- <id name="id" type="java.lang.Long">
- <generator class="increment"/>
- </id>
- </class>
-</hibernate-mapping>
\ No newline at end of file
17 years, 1 month
Hibernate SVN: r15256 - core/branches/Branch_3_2/src/org/hibernate/hql/ast/tree.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2008-10-03 18:16:43 -0400 (Fri, 03 Oct 2008)
New Revision: 15256
Modified:
core/branches/Branch_3_2/src/org/hibernate/hql/ast/tree/IdentNode.java
Log:
HHH-3510 : backout problematic change
Modified: core/branches/Branch_3_2/src/org/hibernate/hql/ast/tree/IdentNode.java
===================================================================
--- core/branches/Branch_3_2/src/org/hibernate/hql/ast/tree/IdentNode.java 2008-10-03 21:10:16 UTC (rev 15255)
+++ core/branches/Branch_3_2/src/org/hibernate/hql/ast/tree/IdentNode.java 2008-10-03 22:16:43 UTC (rev 15256)
@@ -1,4 +1,27 @@
-// $Id$
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
package org.hibernate.hql.ast.tree;
import antlr.SemanticException;
@@ -15,13 +38,14 @@
import org.hibernate.util.StringHelper;
import java.util.List;
+import java.util.Collections;
/**
* Represents an identifier all by itself, which may be a function name,
* a class alias, or a form of naked property-ref depending on the
* context.
*
- * @author josh Aug 16, 2004 7:20:55 AM
+ * @author josh
*/
public class IdentNode extends FromReferenceNode implements SelectExpression {
@@ -105,6 +129,18 @@
// resolve this...
return;
}
+ else if ( result == UNKNOWN ) {
+ final SQLFunction sqlFunction = getSessionFactoryHelper().findSQLFunction( getText() );
+ if ( sqlFunction != null ) {
+ String text = sqlFunction.render( Collections.EMPTY_LIST, getSessionFactoryHelper().getFactory() );
+ if ( text.endsWith( "()" ) ) {
+ text = text.substring( 0, text.length() - 2 );
+ }
+ setText( text );
+ setDataType( sqlFunction.getReturnType( null, getSessionFactoryHelper().getFactory() ) );
+ setResolved();
+ }
+ }
}
// if we are still not resolved, we might represent a constant.
@@ -260,26 +296,30 @@
public Type getDataType() {
Type type = super.getDataType();
- if (type != null) return type;
+ if ( type != null ) {
+ return type;
+ }
FromElement fe = getFromElement();
- if (fe != null) return fe.getDataType();
- SQLFunction sf = getWalker().getSessionFactoryHelper().findSQLFunction(getText());
- return sf == null ? null : sf.getReturnType(null, null);
+ if (fe != null) {
+ return fe.getDataType();
+ }
+ SQLFunction sf = getWalker().getSessionFactoryHelper().findSQLFunction( getText() );
+ return sf == null ? null : sf.getReturnType( null, null );
}
public void setScalarColumnText(int i) throws SemanticException {
- if (nakedPropertyRef) {
+ if ( nakedPropertyRef ) {
// do *not* over-write the column text, as that has already been
// "rendered" during resolve
- ColumnHelper.generateSingleScalarColumn(this, i);
+ ColumnHelper.generateSingleScalarColumn( this, i );
}
else {
FromElement fe = getFromElement();
- if (fe != null) {
- setText(fe.renderScalarIdentifierSelect(i));
+ if ( fe != null ) {
+ setText( fe.renderScalarIdentifierSelect( i ) );
}
else {
- ColumnHelper.generateSingleScalarColumn(this, i);
+ ColumnHelper.generateSingleScalarColumn( this, i );
}
}
}
@@ -287,19 +327,19 @@
public String getDisplayText() {
StringBuffer buf = new StringBuffer();
- if (getType() == SqlTokenTypes.ALIAS_REF) {
- buf.append("{alias=").append(getOriginalText());
- if (getFromElement() == null) {
- buf.append(", no from element");
+ if ( getType() == SqlTokenTypes.ALIAS_REF ) {
+ buf.append( "{alias=" ).append( getOriginalText() );
+ if ( getFromElement() == null ) {
+ buf.append( ", no from element" );
}
else {
- buf.append(", className=").append(getFromElement().getClassName());
- buf.append(", tableAlias=").append(getFromElement().getTableAlias());
+ buf.append( ", className=" ).append( getFromElement().getClassName() );
+ buf.append( ", tableAlias=" ).append( getFromElement().getTableAlias() );
}
- buf.append("}");
+ buf.append( "}" );
}
else {
- buf.append("{originalText=" + getOriginalText()).append("}");
+ buf.append( "{originalText=" ).append( getOriginalText() ).append( "}" );
}
return buf.toString();
}
17 years, 1 month
Hibernate SVN: r15255 - in core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j: component and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2008-10-03 17:10:16 -0400 (Fri, 03 Oct 2008)
New Revision: 15255
Added:
core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/
core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/Component.java
core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/ComponentOwner.java
core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/ComponentReference.java
core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/Dom4jComponentTest.java
core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/Mapping.hbm.xml
Log:
HHH-1907 : component + EntityMode.DOM4J
Added: core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/Component.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/Component.java (rev 0)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/Component.java 2008-10-03 21:10:16 UTC (rev 15255)
@@ -0,0 +1,49 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate.test.entitymode.dom4j.component;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+public class Component {
+ private ComponentReference reference;
+
+ public Component() {
+ }
+
+ public Component(ComponentReference reference) {
+ this.reference = reference;
+ }
+
+ public ComponentReference getReference() {
+ return reference;
+ }
+
+ public void setReference(ComponentReference reference) {
+ this.reference = reference;
+ }
+}
Added: core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/ComponentOwner.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/ComponentOwner.java (rev 0)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/ComponentOwner.java 2008-10-03 21:10:16 UTC (rev 15255)
@@ -0,0 +1,58 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate.test.entitymode.dom4j.component;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+public class ComponentOwner {
+ private Long id;
+ private Component component;
+
+ public ComponentOwner() {
+ }
+
+ public ComponentOwner(Component component) {
+ this.component = component;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public Component getComponent() {
+ return component;
+ }
+
+ public void setComponent(Component component) {
+ this.component = component;
+ }
+}
Added: core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/ComponentReference.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/ComponentReference.java (rev 0)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/ComponentReference.java 2008-10-03 21:10:16 UTC (rev 15255)
@@ -0,0 +1,45 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate.test.entitymode.dom4j.component;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+public class ComponentReference {
+ private Long id;
+
+ public ComponentReference() {
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+}
Added: core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/Dom4jComponentTest.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/Dom4jComponentTest.java (rev 0)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/Dom4jComponentTest.java 2008-10-03 21:10:16 UTC (rev 15255)
@@ -0,0 +1,79 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate.test.entitymode.dom4j.component;
+
+import junit.framework.Test;
+
+import org.hibernate.junit.functional.FunctionalTestCase;
+import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
+import org.hibernate.Session;
+import org.hibernate.EntityMode;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Environment;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+public class Dom4jComponentTest extends FunctionalTestCase {
+ public Dom4jComponentTest(String string) {
+ super( string );
+ }
+
+ public String[] getMappings() {
+ return new String[] { "entitymode/dom4j/component/Mapping.hbm.xml" };
+ }
+
+ public void configure(Configuration cfg) {
+ cfg.setProperty( Environment.DEFAULT_ENTITY_MODE, EntityMode.DOM4J.toString() );
+ }
+
+ public static Test suite() {
+ return new FunctionalTestClassTestSuite( Dom4jComponentTest.class );
+ }
+
+ public void testSetAccessorsFailureExpected() {
+ // An example of part of the issue discussed in HHH-1907
+ Session session = openSession();
+ session.beginTransaction();
+ session.getSession( EntityMode.POJO ).save( new ComponentOwner( new Component( new ComponentReference() ) ) );
+ session.getTransaction().commit();
+ session.close();
+
+ session = openSession();
+ session.beginTransaction();
+ session.createQuery( "from ComponentOwner" ).list();
+ session.getTransaction().commit();
+ session.close();
+
+ session = openSession();
+ session.beginTransaction();
+ session.createQuery( "delete ComponentOwner" ).executeUpdate();
+ session.createQuery( "delete ComponentReference" ).executeUpdate();
+ session.getTransaction().commit();
+ session.close();
+ }
+}
Added: core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/Mapping.hbm.xml
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/Mapping.hbm.xml (rev 0)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/entitymode/dom4j/component/Mapping.hbm.xml 2008-10-03 21:10:16 UTC (rev 15255)
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+ ~ Hibernate, Relational Persistence for Idiomatic Java
+ ~
+ ~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ ~ indicated by the @author tags or express copyright attribution
+ ~ statements applied by the authors. All third-party contributions are
+ ~ distributed under license by Red Hat Middleware LLC.
+ ~
+ ~ This copyrighted material is made available to anyone wishing to use, modify,
+ ~ copy, or redistribute it subject to the terms and conditions of the GNU
+ ~ Lesser General Public License, as published by the Free Software Foundation.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ ~ for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this distribution; if not, write to:
+ ~ Free Software Foundation, Inc.
+ ~ 51 Franklin Street, Fifth Floor
+ ~ Boston, MA 02110-1301 USA
+ ~
+ -->
+
+<hibernate-mapping package="org.hibernate.test.entitymode.dom4j.component">
+
+ <class name="ComponentOwner">
+ <id name="id" type="long" node="@id">
+ <generator class="increment"/>
+ </id>
+ <component name="component" class="Component">
+ <many-to-one name="reference" class="ComponentReference" embed-xml="false" cascade="all"/>
+ </component>
+ </class>
+
+ <class name="ComponentReference">
+ <id name="id" type="long" node="@id">
+ <generator class="increment"/>
+ </id>
+ </class>
+
+</hibernate-mapping>
17 years, 1 month
Hibernate SVN: r15254 - in validator/trunk: hibernate-validator-legacy and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2008-10-03 10:59:54 -0400 (Fri, 03 Oct 2008)
New Revision: 15254
Modified:
validator/trunk/hibernate-validator-legacy/build.xml
validator/trunk/hibernate-validator-legacy/common-build.xml
validator/trunk/hibernate-validator-legacy/pom.xml
validator/trunk/pom.xml
Log:
made the legacy validator part of the reactor build
Modified: validator/trunk/hibernate-validator-legacy/build.xml
===================================================================
--- validator/trunk/hibernate-validator-legacy/build.xml 2008-10-03 14:41:53 UTC (rev 15253)
+++ validator/trunk/hibernate-validator-legacy/build.xml 2008-10-03 14:59:54 UTC (rev 15254)
@@ -148,13 +148,6 @@
<attribute name="Implementation-URL" value="http://validator.hibernate.org"/>
</manifest>
<antcall target="common-build.jar"/>
- <ivy:resolve conf="default"/>
- <ivy:publish artifactspattern="${dist.dir}/[artifact].[ext]"
- resolver="local"
- pubrevision="latest"
- pubdate="${now}"
- status="integration"
- />
</target>
<!-- Some of this can probably be moved to common-build... -->
Modified: validator/trunk/hibernate-validator-legacy/common-build.xml
===================================================================
--- validator/trunk/hibernate-validator-legacy/common-build.xml 2008-10-03 14:41:53 UTC (rev 15253)
+++ validator/trunk/hibernate-validator-legacy/common-build.xml 2008-10-03 14:59:54 UTC (rev 15254)
@@ -16,11 +16,11 @@
<property name="test.dir" location="src/test/java"/>
<property name="test.resources.dir" location="src/test/resources"/>
<property name="lib.dir" location="lib"/>
- <property name="build.dir" location="target"/>
+ <property name="build.dir" location="${basedir}/target"/>
<property name="test.output" location="${build.dir}/test-reports"/>
<property name="classes.dir" location="${build.dir}/classes"/>
<property name="testclasses.dir" location="${build.dir}/testclasses"/>
- <property name="dist.target.dir" location="target"/>
+ <property name="dist.target.dir" location="${basedir}/target"/>
<property name="dist.dir" location="${dist.target.dir}/${name}"/>
<property name="instrumenttest.out.dir" value="instrumenttestout"/>
<property name="doc.dir" location="doc"/>
Modified: validator/trunk/hibernate-validator-legacy/pom.xml
===================================================================
--- validator/trunk/hibernate-validator-legacy/pom.xml 2008-10-03 14:41:53 UTC (rev 15253)
+++ validator/trunk/hibernate-validator-legacy/pom.xml 2008-10-03 14:59:54 UTC (rev 15254)
@@ -12,7 +12,7 @@
<artifactId>hibernate-validator-legacy</artifactId>
<packaging>jar</packaging>
- <name>Hibernate Validator</name>
+ <name>Hibernate Validator (legacy)</name>
<version>3.1.0.GA</version>
<url>http://validator.hibernate.org</url>
<licenses>
Modified: validator/trunk/pom.xml
===================================================================
--- validator/trunk/pom.xml 2008-10-03 14:41:53 UTC (rev 15253)
+++ validator/trunk/pom.xml 2008-10-03 14:59:54 UTC (rev 15254)
@@ -48,6 +48,7 @@
<modules>
<module>validation-api</module>
<module>hibernate-validator</module>
+ <module>hibernate-validator-legacy</module>
</modules>
<dependencyManagement>
17 years, 1 month
Hibernate SVN: r15253 - in validator/trunk/hibernate-validator-legacy: doc/reference and 11 other directories.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2008-10-03 10:41:53 -0400 (Fri, 03 Oct 2008)
New Revision: 15253
Added:
validator/trunk/hibernate-validator-legacy/src/main/
validator/trunk/hibernate-validator-legacy/src/main/java/
validator/trunk/hibernate-validator-legacy/src/main/resources/
validator/trunk/hibernate-validator-legacy/src/main/resources/org/
validator/trunk/hibernate-validator-legacy/src/main/resources/org/hibernate/
validator/trunk/hibernate-validator-legacy/src/main/resources/org/hibernate/validator/
validator/trunk/hibernate-validator-legacy/src/main/resources/org/hibernate/validator/resources/
validator/trunk/hibernate-validator-legacy/src/test/java/
validator/trunk/hibernate-validator-legacy/src/test/java/org/
validator/trunk/hibernate-validator-legacy/src/test/resources/
validator/trunk/hibernate-validator-legacy/src/test/resources/ValidatorMessages.properties
validator/trunk/hibernate-validator-legacy/src/test/resources/ValidatorMessages_da.properties
validator/trunk/hibernate-validator-legacy/src/test/resources/ValidatorMessages_fr.properties
validator/trunk/hibernate-validator-legacy/src/test/resources/hibernate.properties
validator/trunk/hibernate-validator-legacy/src/test/resources/log4j.properties
validator/trunk/hibernate-validator-legacy/src/test/resources/messages_en.properties
Removed:
validator/trunk/hibernate-validator-legacy/src/java/
validator/trunk/hibernate-validator-legacy/src/main/java/org/hibernate/validator/resources/
validator/trunk/hibernate-validator-legacy/src/test/ValidatorMessages.properties
validator/trunk/hibernate-validator-legacy/src/test/ValidatorMessages_da.properties
validator/trunk/hibernate-validator-legacy/src/test/ValidatorMessages_fr.properties
validator/trunk/hibernate-validator-legacy/src/test/hibernate.properties
validator/trunk/hibernate-validator-legacy/src/test/log4j.properties
validator/trunk/hibernate-validator-legacy/src/test/messages_en.properties
validator/trunk/hibernate-validator-legacy/src/test/org/
Modified:
validator/trunk/hibernate-validator-legacy/build.xml
validator/trunk/hibernate-validator-legacy/common-build.xml
validator/trunk/hibernate-validator-legacy/doc/reference/build.xml
validator/trunk/hibernate-validator-legacy/ivy.xml
validator/trunk/hibernate-validator-legacy/pom.xml
Log:
Refactored build so that compile and test can be run by ant or maven. Still needs ant to build dist. Long term goal is to remove the ant specific stuff
Modified: validator/trunk/hibernate-validator-legacy/build.xml
===================================================================
--- validator/trunk/hibernate-validator-legacy/build.xml 2008-10-03 03:03:21 UTC (rev 15252)
+++ validator/trunk/hibernate-validator-legacy/build.xml 2008-10-03 14:41:53 UTC (rev 15253)
@@ -15,117 +15,105 @@
-->
<project name="Hibernate Validator" default="dist" basedir="."
- xmlns:ivy="antlib:fr.jayasoft.ivy.ant">
+ xmlns:ivy="antlib:fr.jayasoft.ivy.ant">
<!-- Give user a chance to override without editing this file
(and without typing -D each time it compiles it) -->
- <property file="build.properties"/>
- <property file="${user.home}/.ant.properties"/>
+ <property file="build.properties"/>
+ <property file="${user.home}/.ant.properties"/>
- <!-- Name of project and version, used to create filenames -->
- <property name="Name" value="Hibernate Validator"/>
- <property name="name" value="hibernate-validator"/>
- <property name="version" value="3.1.0.GA"/>
- <property name="javadoc.packagenames" value="org.hibernate.validator.*"/>
- <property name="copy.test" value="true"/>
- <property name="javac.source" value="1.5"/>
- <property name="javac.target" value="1.5"/>
- <property name="jdbc.dir" value="jdbc"/>
- <property name="common.dir" value="${basedir}"/>
+ <!-- Name of project and version, used to create filenames -->
+ <property name="Name" value="Hibernate Validator"/>
+ <property name="name" value="hibernate-validator"/>
+ <property name="version" value="3.1.0.GA"/>
+ <property name="javadoc.packagenames" value="org.hibernate.validator.*"/>
+ <property name="copy.test" value="true"/>
+ <property name="javac.source" value="1.5"/>
+ <property name="javac.target" value="1.5"/>
+ <property name="jdbc.dir" value="jdbc"/>
+ <property name="common.dir" value="${basedir}"/>
- <property name="ivy.dep.dir" value="${basedir}/build/lib" />
+ <property name="ivy.dep.dir" value="${basedir}/target/lib"/>
- <!-- dependencies -->
- <!-- property name="jpa-api.jar" value="${basedir}/../jpa-api/build/ejb3-persistence.jar"/>
- <property name="annotations.jar"
- value="${basedir}/../annotations/target/hibernate-annotations/hibernate-annotations.jar"/>
- <property name="jpa.jar"
- value="${basedir}/../entitymanager/target/hibernate-entitymanager/hibernate-entitymanager.jar"/>
- <property name="archive-browsing.jar"
- value="${basedir}/../entitymanager/lib/jboss-archive-browsing.jar"/>
- <property name="commons-annotations.jar"
- value="${basedir}/../commons-annotations/target/hibernate-commons-annotations/hibernate-commons-annotations.jar"/ -->
<import file="${common.dir}/common-build.xml"/>
- <path id="lib.moduleclass.path">
- <!-- pathelement location="${jpa-api.jar}"/>
- <pathelement location="${commons-annotations.jar}"/ -->
+ <path id="lib.moduleclass.path">
<fileset dir="${ivy.dep.dir}/core">
- <include name="*.jar"/>
- </fileset>
+ <include name="*.jar"/>
+ </fileset>
</path>
- <path id="junit.moduleclasspath">
- <pathelement location="${src.dir}"/>
- <pathelement location="${test.dir}"/>
- <!-- pathelement location="${annotations.jar}"/>
- <pathelement location="${jpa.jar}"/>
- <pathelement location="${archive-browsing.jar}"/ -->
+ <path id="junit.moduleclasspath">
+ <pathelement location="${src.dir}"/>
+ <pathelement location="${test.dir}"/>
<fileset dir="${ivy.dep.dir}/test">
- <include name="*.jar"/>
- </fileset>
+ <include name="*.jar"/>
+ </fileset>
<fileset dir="${jdbc.dir}">
- <include name="*.jar"/>
- <include name="*.zip"/>
- </fileset>
+ <include name="*.jar"/>
+ <include name="*.zip"/>
+ </fileset>
<fileset dir="${lib.dir}/test">
- <include name="*.jar"/>
- <include name="*.zip"/>
- </fileset>
+ <include name="*.jar"/>
+ <include name="*.zip"/>
+ </fileset>
</path>
<!-- ivy load -->
- <property name="ivy.jar.dir" value="${basedir}/ivy" />
- <property name="ivy.conf.dir" value="${basedir}" />
+ <property name="ivy.jar.dir" value="${basedir}/ivy"/>
+ <property name="ivy.conf.dir" value="${basedir}"/>
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar"/>
</path>
<taskdef resource="fr/jayasoft/ivy/ant/antlib.xml"
- uri="antlib:fr.jayasoft.ivy.ant" classpathref="ivy.lib.path"/>
+ uri="antlib:fr.jayasoft.ivy.ant" classpathref="ivy.lib.path"/>
<target name="init">
- <antcall target="common-build.init"/>
+ <antcall target="common-build.init"/>
<tstamp>
<format property="now" pattern="yyyyMMddhhmmss"/>
</tstamp>
- <!-- check for dependency artefacts -->
- <!-- available file="${jpa-api.jar}" type="file" property="jpa-api.jar.available"/>
- <available file="${commons-annotations.jar}" type="file" property="commons-annotations.jar.available"/>
- <available file="${annotations.jar}" type="file" property="annotations.jar.available"/>
- <available file="${jpa.jar}" type="file" property="jpa.jar.available"/ -->
<mkdir dir="${ivy.dep.dir}/core"/>
<mkdir dir="${ivy.dep.dir}/test"/>
- <ivy:configure file="${ivy.jar.dir}/ivyconf.xml" />
+ <ivy:configure file="${ivy.jar.dir}/ivyconf.xml"/>
<mkdir dir="${lib.dir}/test"/>
</target>
- <!-- target name="get.jpa-api" depends="init" unless="jpa-api.jar.available">
- <ant inheritall="false" dir="${basedir}/../jpa-api" target="clean"/>
- <ant inheritall="false" dir="${basedir}/../jpa-api" target="jar"/>
- </target>
+ <target name="get.deps.core" depends="init" description="retrieve the core dependencies">
+ <ivy:resolve conf="default"/>
+ <ivy:retrieve pattern="${ivy.dep.dir}/core/[artifact].[ext]" conf="default"/>
+ </target>
- <target name="get.commons-annotations" depends="init" unless="commons-annotations.jar.available">
- <ant inheritall="false" dir="${basedir}/../commons-annotations" target="clean"/>
- <ant inheritall="false" dir="${basedir}/../commons-annotations" target="jar"/>
- </target>
+ <target name="get.deps.test" depends="init" description="retrieve the test dependencies">
+ <ivy:resolve conf="test"/>
+ <ivy:retrieve pattern="${ivy.dep.dir}/test/[artifact].[ext]" conf="test"/>
+ </target>
- <target name="get.annotations" depends="init" unless="annotations.jar.available">
- <ant inheritall="false" dir="${basedir}/../annotations" target="clean"/>
- <ant inheritall="false" dir="${basedir}/../annotations" target="jar"/>
- </target>
-
- <target name="get.jpa" depends="init" unless="jpa.jar.available">
- <ant inheritall="false" dir="${basedir}/../entitymanager" target="clean"/>
- <ant inheritall="false" dir="${basedir}/../entitymanager" target="jar"/>
- </target -->
-
- <target name="get.deps.core" depends="init" description="retrieve the core dependencies">
- <ivy:resolve conf="default" />
- <ivy:retrieve pattern="${ivy.dep.dir}/core/[artifact].[ext]" conf="default" />
+ <!-- Run a single unit test. -->
+ <target name="junitsingle" depends="compiletest"
+ description="Run a single test suite (requires testname and jdbc.driver properties)">
+ <mkdir dir="${test.output}"/>
+ <junit printsummary="yes" fork="yes" haltonfailure="yes">
+ <classpath>
+ <fileset dir="${jdbc.dir}">
+ <include name="**/*.jar"/>
+ <include name="**/*.zip"/>
+ </fileset>
+ <path refid="lib.class.path"/>
+ <pathelement path="${classes.dir}"/>
+ <pathelement path="${src.dir}"/>
+ <!-- pick up properties from here -->
+ <pathelement path="${test.dir}"/>
+ <!-- pick up mappings from here -->
+ </classpath>
+ <formatter type="plain"/>
+ <formatter type="xml"/>
+ <test fork="yes" todir="${test.output}" haltonfailure="no" name="${testname}"/>
+ </junit>
</target>
- <target name="compile" depends="init,get.deps.core" description="Compile the Java source code">
+ <target name="compile" depends="init,get.deps.core,resources" description="Compile the Java source code">
<available
classname="org.eclipse.core.launcher.Main"
property="build.compiler"
@@ -148,124 +136,43 @@
<include name="**/*.xsd"/>
</fileset>
</copy>
- </target>
+ </target>
- <target name="get.deps.test" depends="init" description="retrieve the test dependencies">
- <ivy:resolve conf="test" />
- <ivy:retrieve pattern="${ivy.dep.dir}/test/[artifact].[ext]" conf="test" />
- </target>
-
- <target name="compiletest" depends="init,get.deps.test,compile" description="Compile the tests">
- <available
- classname="org.eclipse.core.launcher.Main"
- property="build.compiler"
- value="org.eclipse.jdt.core.JDTCompilerAdapter"
- classpath="${java.class.path}"/>
- <javac
- destdir="${testclasses.dir}"
- classpathref="junit.classpath"
- debug="${javac.debug}"
- optimize="${javac.optimize}"
- nowarn="on"
- source="1.5"
- target="1.5">
- <src refid="testsrc.path"/>
- </javac>
- </target>
-
-
- <!-- target name="junit" depends="compiletest">
- <mkdir dir="test_output"/>
- <junit fork="yes" printsummary="yes" haltonfailure="yes"
- forkmode="perBatch">
- <classpath>
- <fileset dir="${jdbc.dir}">
- <include name="**/*.jar"/>
- <include name="**/*.zip"/>
- </fileset>
- <path refid="lib.class.path"/>
- <pathelement path="${classes.dir}"/>
- <pathelement path="${src.dir}"/>
- <pathelement path="${test.dir}"/>
- </classpath>
- <formatter type="plain"/>
- <formatter type="xml"/>
- <batchtest fork="yes" todir="test_output" haltonfailure="no">
- <fileset dir="${classes.dir}">
- <include name="**/*Test.class"/>
- </fileset>
- </batchtest>
- </junit>
- </target -->
-
- <!-- Run a single unit test. -->
- <target name="junitsingle" depends="compiletest"
- description="Run a single test suite (requires testname and jdbc.driver properties)">
- <mkdir dir="test_output"/>
- <junit printsummary="yes" fork="yes" haltonfailure="yes">
- <classpath>
- <fileset dir="${jdbc.dir}">
- <include name="**/*.jar"/>
- <include name="**/*.zip"/>
- </fileset>
- <path refid="lib.class.path"/>
- <pathelement path="${classes.dir}"/>
- <pathelement path="${src.dir}"/>
- <!-- pick up properties from here -->
- <pathelement path="${test.dir}"/>
- <!-- pick up mappings from here -->
- </classpath>
- <formatter type="plain"/>
- <formatter type="xml"/>
- <test fork="yes" todir="test_output" haltonfailure="no" name="${testname}"/>
- </junit>
- </target>
-
- <!-- target name="report">
- <mkdir dir="test_output"/>
- <junitreport todir="test_output">
- <fileset dir="test_output">
- <include name="TEST-*.xml"/>
- </fileset>
- <report format="frames" todir="test_output/report"/>
- </junitreport>
- </target -->
-
- <target name="jar" depends="compile" description="Build the distribution .jar file">
- <mkdir dir="${classes.dir}/META-INF"/>
- <manifest file="${classes.dir}/META-INF/MANIFEST.MF">
- <attribute name="Implementation-Title" value="${Name}"/>
- <attribute name="Implementation-Version" value="${version}"/>
+ <target name="jar" depends="compile" description="Build the distribution .jar file">
+ <mkdir dir="${classes.dir}/META-INF"/>
+ <manifest file="${classes.dir}/META-INF/MANIFEST.MF">
+ <attribute name="Implementation-Title" value="${Name}"/>
+ <attribute name="Implementation-Version" value="${version}"/>
<attribute name="Implementation-Vendor" value="hibernate.org"/>
<attribute name="Implementation-Vendor-Id" value="hibernate.org"/>
<attribute name="Implementation-URL" value="http://validator.hibernate.org"/>
- </manifest>
- <antcall target="common-build.jar"/>
+ </manifest>
+ <antcall target="common-build.jar"/>
<ivy:resolve conf="default"/>
<ivy:publish artifactspattern="${dist.dir}/[artifact].[ext]"
- resolver="local"
- pubrevision="latest"
- pubdate="${now}"
- status="integration"
- />
+ resolver="local"
+ pubrevision="latest"
+ pubdate="${now}"
+ status="integration"
+ />
</target>
- <!-- Some of this can probably be moved to common-build... -->
- <target name="dist" depends="get.deps.core,get.deps.test,jar,javadoc,copysource,copytest,copylib,extras"
- description="Build everything">
+ <!-- Some of this can probably be moved to common-build... -->
+ <target name="dist" depends="get.deps.core,get.deps.test,jar,javadoc,copysource,copytest,copylib,extras"
+ description="Build everything">
- <ant inheritall="false" dir="${basedir}/doc/reference"/>
- <copy todir="${dist.dir}/doc/reference" failonerror="false">
- <fileset dir="${basedir}/doc/reference/build">
- <include name="**/*.*"/>
- </fileset>
- </copy>
+ <ant inheritall="false" dir="${basedir}/doc/reference"/>
+ <copy todir="${dist.dir}/doc/reference" failonerror="false">
+ <fileset dir="${basedir}/doc/reference/build">
+ <include name="**/*.*"/>
+ </fileset>
+ </copy>
- <copy todir="${dist.dir}" failonerror="false">
- <fileset dir="${common.dir}">
- <include name="common-build.xml"/>
- </fileset>
- </copy>
+ <copy todir="${dist.dir}" failonerror="false">
+ <fileset dir="${common.dir}">
+ <include name="common-build.xml"/>
+ </fileset>
+ </copy>
<copy todir="${dist.dir}/ivy" failonerror="false">
<fileset dir="${ivy.jar.dir}">
<include name="**/*.*"/>
@@ -274,23 +181,23 @@
<!-- copy dependencies -->
<copy todir="${dist.lib.dir}" failonerror="false">
- <!-- fileset file="${jpa-api.jar}"/>
- <fileset file="${commons-annotations.jar}"/ -->
+ <!-- fileset file="${jpa-api.jar}"/>
+ <fileset file="${commons-annotations.jar}"/ -->
<fileset dir="${ivy.dep.dir}/core">
<include name="*.jar"/>
</fileset>
</copy>
-
+
<mkdir dir="${dist.lib.dir}/test"/>
<copy todir="${dist.lib.dir}/test" failonerror="false">
- <fileset dir="${ivy.dep.dir}/test">
+ <fileset dir="${ivy.dep.dir}/test">
<include name="*.jar"/>
</fileset>
</copy>
<mkdir dir="${dist.lib.dir}/build"/>
<copy todir="${dist.lib.dir}/build" failonerror="false">
- <fileset file="${lib.dir}/build/*.jar"/>
+ <fileset file="${lib.dir}/build/*.jar"/>
</copy>
<!-- ivy uses the module name without hibernate- (to mimic the directory names). Revert the situation -->
@@ -302,18 +209,18 @@
failonerror="false"/>
<copy file="${basedir}/build.properties.dist" tofile="${dist.dir}/build.properties" failonerror="false">
- </copy>
- <antcall target="common-build.dist"/>
- </target>
+ </copy>
+ <antcall target="common-build.dist"/>
+ </target>
- <target name="zip-dist" description="zip the dist">
- <zip zipfile="${dist.dir}-${version}.zip">
- <zipfileset prefix="${name}-${version}" dir="${dist.dir}"/>
- </zip>
- <tar compression="gzip" tarfile="${dist.dir}-${version}.tar.gz">
- <tarfileset prefix="${name}-${version}" dir="${dist.dir}"/>
- </tar>
- </target>
+ <target name="zip-dist" description="zip the dist">
+ <zip zipfile="${dist.dir}-${version}.zip">
+ <zipfileset prefix="${name}-${version}" dir="${dist.dir}"/>
+ </zip>
+ <tar compression="gzip" tarfile="${dist.dir}-${version}.tar.gz">
+ <tarfileset prefix="${name}-${version}" dir="${dist.dir}"/>
+ </tar>
+ </target>
</project>
Modified: validator/trunk/hibernate-validator-legacy/common-build.xml
===================================================================
--- validator/trunk/hibernate-validator-legacy/common-build.xml 2008-10-03 03:03:21 UTC (rev 15252)
+++ validator/trunk/hibernate-validator-legacy/common-build.xml 2008-10-03 14:41:53 UTC (rev 15253)
@@ -11,10 +11,13 @@
<property file="${common-build.basedir}/build.properties"/>
<property file="${user.home}/.ant.properties"/>
- <property name="src.dir" location="src/java"/>
- <property name="test.dir" location="src/test"/>
+ <property name="src.dir" location="src/main/java"/>
+ <property name="resources.dir" location="src/main/resources"/>
+ <property name="test.dir" location="src/test/java"/>
+ <property name="test.resources.dir" location="src/test/resources"/>
<property name="lib.dir" location="lib"/>
- <property name="build.dir" location="build"/>
+ <property name="build.dir" location="target"/>
+ <property name="test.output" location="${build.dir}/test-reports"/>
<property name="classes.dir" location="${build.dir}/classes"/>
<property name="testclasses.dir" location="${build.dir}/testclasses"/>
<property name="dist.target.dir" location="target"/>
@@ -44,7 +47,7 @@
<property name="src.jar" value="${build.dir}/src.jar"/>
<!-- build related properties -->
- <property name="build.lib.dir" value="${lib.dir}/build"/>
+ <property name="build.lib.dir" value="${lib.dir}/target"/>
<taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask">
<classpath>
@@ -123,6 +126,7 @@
<path id="testsrc.path">
<pathelement location="${test.dir}"/>
+ <pathelement location="${test.resources.dir}"/>
</path>
<!-- Clover -->
@@ -188,25 +192,7 @@
</copy>
</target>
- <target name="compile" depends="init" description="Compile the Java source code">
- <available
- classname="org.eclipse.core.launcher.Main"
- property="build.compiler"
- value="org.eclipse.jdt.core.JDTCompilerAdapter"
- classpath="${java.class.path}"/>
- <javac
- target="${javac.target}"
- source="${javac.source}"
- srcdir="${src.dir}"
- destdir="${classes.dir}"
- classpathref="lib.class.path"
- debug="${javac.debug}"
- optimize="${javac.optimize}"
- nowarn="on">
- </javac>
- </target>
-
- <target name="compiletest" depends="compile" description="Compile the tests">
+ <target name="compiletest" depends="compile,get.deps.test,test-resources" description="Compile the tests">
<available
classname="org.eclipse.core.launcher.Main"
property="build.compiler"
@@ -224,6 +210,26 @@
</javac>
</target>
+ <target name="test-resources" description="Copies test resources">
+ <mkdir dir="${testclasses.dir}"/>
+ <copy todir="${testclasses.dir}" overwrite="true">
+ <fileset dir="${test.resources.dir}">
+ <include name="*.properties"/>
+ <include name="*.xml"/>
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="resources" description="Copies resources">
+ <mkdir dir="${classes.dir}"/>
+ <copy todir="${classes.dir}" overwrite="true">
+ <fileset dir="${resources.dir}">
+ <include name="**/*.properties"/>
+ <include name="**/*.xml"/>
+ </fileset>
+ </copy>
+ </target>
+
<target name="instrument" depends="compiletest"
description="Instrument the persistent classes"> <!-- depends="jar" -->
@@ -241,14 +247,6 @@
<exclude name="**/*Tests.class"/>
</fileset>
</instrument>
-
- <!-- jar jarfile="${build.dir}/instrumented-classes.jar">
- <fileset dir="${testclasses.dir}">
- <include name="org/hibernate/test/**/*.class"/>
- <exclude name="org/hibernate/test/**/*Test.class"/>
- </fileset>
- </jar -->
-
</target>
<target name="copytest" description="Copy tests to dist dir" if="copy.test" >
@@ -303,7 +301,7 @@
<target name="jar" depends="compile" description="Build the distribution .jar file">
<mkdir dir="${dist.dir}"/>
<jar filesetmanifest="merge" jarfile="${jar.file.name}" basedir="${classes.dir}"/>
- </target>
+ </target>
<target name="jartest" depends="compiletest" description="Build the distribution .jar file">
<mkdir dir="${dist.dir}"/>
@@ -330,8 +328,6 @@
<include name="**/*" />
</packageset>
</javadoc>
-
-
</target>
@@ -377,12 +373,12 @@
</target>
<target name="junit" depends="compiletest">
- <mkdir dir="test_output"/>
+ <mkdir dir="${test.output}"/>
<junit printsummary="yes" haltonfailure="yes" forkmode="once">
<classpath refid="junit.classpath"/>
<formatter type="plain"/>
<formatter type="xml"/>
- <batchtest fork="yes" todir="test_output" haltonfailure="no">
+ <batchtest fork="yes" todir="${test.output}" haltonfailure="no">
<fileset refid="junit.batchtestset"/>
</batchtest>
</junit>
@@ -390,12 +386,12 @@
<!-- Run a single unit test. -->
<target name="junitsingle" depends="compiletest" description="Run a single test suite (requires testname and jdbc.driver properties)">
- <mkdir dir="test_output"/>
+ <mkdir dir="${test.output}"/>
<junit printsummary="yes" fork="yes" haltonfailure="yes">
<classpath refid="junit.classpath"/>
<formatter type="plain"/>
<formatter type="xml"/>
- <test fork="yes" todir="test_output" haltonfailure="no" name="${testname}"/>
+ <test fork="yes" todir="${test.output}" haltonfailure="no" name="${testname}"/>
</junit>
</target>
@@ -416,11 +412,11 @@
</target>
<target name="junitreport" depends="">
- <junitreport todir="./test_output">
- <fileset dir="test_output">
+ <junitreport todir="${test.output}">
+ <fileset dir="${test.output}">
<include name="TEST-*.xml"/>
</fileset>
- <report format="frames" todir="./test_output"/>
+ <report format="frames" todir="./${test.output}"/>
</junitreport>
</target>
@@ -432,7 +428,6 @@
</java>
</target>
-
<target name="checkstyle" description="Check coding style">
<taskdef resource="checkstyletask.properties">
<classpath>
@@ -444,7 +439,7 @@
</taskdef>
<checkstyle config="${common-build.basedir}/checkstyle_checks.xml">
- <fileset dir="${src.dir}">
+ <fileset dir="src/main/java">
<include name="**/*.java"/>
</fileset>
<formatter type="plain"/>
Modified: validator/trunk/hibernate-validator-legacy/doc/reference/build.xml
===================================================================
--- validator/trunk/hibernate-validator-legacy/doc/reference/build.xml 2008-10-03 03:03:21 UTC (rev 15252)
+++ validator/trunk/hibernate-validator-legacy/doc/reference/build.xml 2008-10-03 14:41:53 UTC (rev 15253)
@@ -1,7 +1,7 @@
<project name="Documentation" default="all.doc" basedir=".">
<!-- Use the core Hibernate3 doc build system -->
- <import file="../../common-build.xml"/>
+ <!--import file="../../common-build.xml"/-->
<import file="docbook-common-build.xml"/>
Modified: validator/trunk/hibernate-validator-legacy/ivy.xml
===================================================================
--- validator/trunk/hibernate-validator-legacy/ivy.xml 2008-10-03 03:03:21 UTC (rev 15252)
+++ validator/trunk/hibernate-validator-legacy/ivy.xml 2008-10-03 14:41:53 UTC (rev 15253)
@@ -24,8 +24,8 @@
<dependency org="dom4j" name="dom4j" rev="1.6.1" conf="test->default"/>
<!-- test deps -->
- <dependency name="annotations" rev="3.4.0.CR1" conf="test->default"/>
- <dependency name="entitymanager" rev="3.4.0.CR1" conf="test->default"/>
+ <dependency name="annotations" rev="3.4.0.GA" conf="test->default"/>
+ <dependency name="entitymanager" rev="3.4.0.GA" conf="test->default"/>
<dependency org="javassist" name="javassist" rev="3.4.GA" conf="default->default"/>
<dependency org="asm" name="asm" rev="1.5.3" conf="test->default"/>
<dependency org="asm" name="asm-attrs" rev="1.5.3" conf="test->default"/>
Modified: validator/trunk/hibernate-validator-legacy/pom.xml
===================================================================
--- validator/trunk/hibernate-validator-legacy/pom.xml 2008-10-03 03:03:21 UTC (rev 15252)
+++ validator/trunk/hibernate-validator-legacy/pom.xml 2008-10-03 14:41:53 UTC (rev 15253)
@@ -1,56 +1,116 @@
<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-validator</artifactId>
- <packaging>jar</packaging>
- <name>Hibernate Validator</name>
- <version>3.1.0.GA</version>
- <url>http://validator.hibernate.org</url>
- <licenses>
- <license>
- <name>GNU LESSER GENERAL PUBLIC LICENSE</name>
- <url>http://www.gnu.org/licenses/lgpl.txt</url>
- </license>
- </licenses>
- <description>Following the DRY (Don't Repeat Yourself) principle, Hibernate Validator let's you express your domain constraints once (and only once) and ensure their compliance at various level of your system automatically.</description>
- <scm>
- <url>http://anonhibernate.labs.jboss.com/trunk/HibernateExt/validator</url>
- </scm>
- <dependencies>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-core</artifactId>
- <version>3.3.0.SP1</version>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-commons-annotations</artifactId>
- <version>3.1.0.GA</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.4.2</version>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>ejb3-persistence</artifactId>
- <version>1.0.2.GA</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-annotations</artifactId>
- <version>3.4.0.GA</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-entitymanager</artifactId>
- <version>3.4.0.GA</version>
- <optional>true</optional>
- </dependency>
+ 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>
+
+ <parent>
+ <artifactId>hibernate-validator-parent</artifactId>
+ <groupId>org.hibernate</groupId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>hibernate-validator-legacy</artifactId>
+ <packaging>jar</packaging>
+ <name>Hibernate Validator</name>
+ <version>3.1.0.GA</version>
+ <url>http://validator.hibernate.org</url>
+ <licenses>
+ <license>
+ <name>GNU LESSER GENERAL PUBLIC LICENSE</name>
+ <url>http://www.gnu.org/licenses/lgpl.txt</url>
+ </license>
+ </licenses>
+ <description>Following the DRY (Don't Repeat Yourself) principle, Hibernate Validator let's you express your domain
+ constraints once (and only once) and ensure their compliance at various level of your system automatically.
+ </description>
+ <scm>
+ <url>http://anonhibernate.labs.jboss.com/trunk/HibernateExt/validator</url>
+ </scm>
+ <dependencies>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-core</artifactId>
+ <version>3.3.0.SP1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-commons-annotations</artifactId>
+ <version>3.1.0.GA</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.4.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>ejb3-persistence</artifactId>
+ <version>1.0.2.GA</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-annotations</artifactId>
+ <version>3.4.0.GA</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-entitymanager</artifactId>
+ <version>3.4.0.GA</version>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>javassist</groupId>
+ <artifactId>javassist</artifactId>
+ <version>3.4.GA</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>asm</groupId>
+ <artifactId>asm</artifactId>
+ <version>1.5.3</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>asm</groupId>
+ <artifactId>asm-attrs</artifactId>
+ <version>1.5.3</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>1.4.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.14</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.transaction</groupId>
+ <artifactId>jta</artifactId>
+ <version>1.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <version>1.8.0.2</version>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
</project>
\ No newline at end of file
Copied: validator/trunk/hibernate-validator-legacy/src/main/java (from rev 15246, validator/trunk/hibernate-validator-legacy/src/java)
Copied: validator/trunk/hibernate-validator-legacy/src/main/resources/org/hibernate/validator/resources (from rev 15246, validator/trunk/hibernate-validator-legacy/src/java/org/hibernate/validator/resources)
Property changes on: validator/trunk/hibernate-validator-legacy/src/main/resources/org/hibernate/validator/resources
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: validator/trunk/hibernate-validator-legacy/src/test/ValidatorMessages.properties
===================================================================
--- validator/trunk/hibernate-validator-legacy/src/test/ValidatorMessages.properties 2008-10-03 03:03:21 UTC (rev 15252)
+++ validator/trunk/hibernate-validator-legacy/src/test/ValidatorMessages.properties 2008-10-03 14:41:53 UTC (rev 15253)
@@ -1,7 +0,0 @@
-#overriding of default keys
-
-#specific to my project
-long=is too damn long
-floor.name=Floor
-out.of.range=lower that {min} and greater than {max}
-floor.out.of.range={floor.name} cannot be {out.of.range}
\ No newline at end of file
Deleted: validator/trunk/hibernate-validator-legacy/src/test/ValidatorMessages_da.properties
===================================================================
--- validator/trunk/hibernate-validator-legacy/src/test/ValidatorMessages_da.properties 2008-10-03 03:03:21 UTC (rev 15252)
+++ validator/trunk/hibernate-validator-legacy/src/test/ValidatorMessages_da.properties 2008-10-03 14:41:53 UTC (rev 15253)
@@ -1,7 +0,0 @@
-#overriding of default keys
-
-#specific to my project
-long=is too damn long
-floor.name=Floor
-out.of.range=lower that {min} and greater than {max}
-floor.out.of.range={floor.name} cannot be {out.of.range}
\ No newline at end of file
Deleted: validator/trunk/hibernate-validator-legacy/src/test/ValidatorMessages_fr.properties
===================================================================
--- validator/trunk/hibernate-validator-legacy/src/test/ValidatorMessages_fr.properties 2008-10-03 03:03:21 UTC (rev 15252)
+++ validator/trunk/hibernate-validator-legacy/src/test/ValidatorMessages_fr.properties 2008-10-03 14:41:53 UTC (rev 15253)
@@ -1,7 +0,0 @@
-#overriding of default keys
-
-#specific to my project
-long=est grave trop long
-floor.name=Etage
-out.of.range=plus petit que {min} ou plus grand que {max}
-floor.out.of.range={floor.name} ne peut pas �tre {out.of.range}
\ No newline at end of file
Deleted: validator/trunk/hibernate-validator-legacy/src/test/hibernate.properties
===================================================================
--- validator/trunk/hibernate-validator-legacy/src/test/hibernate.properties 2008-10-03 03:03:21 UTC (rev 15252)
+++ validator/trunk/hibernate-validator-legacy/src/test/hibernate.properties 2008-10-03 14:41:53 UTC (rev 15253)
@@ -1,472 +0,0 @@
-######################
-### Query Language ###
-######################
-
-## define query language constants / function names
-
-hibernate.query.substitutions true 1, false 0, yes 'Y', no 'N'
-
-
-## select the classic query parser
-
-#hibernate.query.factory_class org.hibernate.hql.classic.ClassicQueryTranslatorFactory
-
-hibernate.format_sql true
-
-
-
-#################
-### Platforms ###
-#################
-
-## JNDI Datasource
-
-#hibernate.connection.datasource jdbc/test
-#hibernate.connection.username db2
-#hibernate.connection.password db2
-
-
-## HypersonicSQL
-
-hibernate.dialect org.hibernate.dialect.HSQLDialect
-hibernate.connection.driver_class org.hsqldb.jdbcDriver
-hibernate.connection.username sa
-hibernate.connection.password
-hibernate.connection.url jdbc:hsqldb:hsql://localhost
-hibernate.connection.url jdbc:hsqldb:test
-hibernate.connection.url jdbc:hsqldb:.
-
-
-## MySQL
-
-#hibernate.dialect org.hibernate.dialect.MySQLDialect
-#hibernate.dialect org.hibernate.dialect.MySQLInnoDBDialect
-#hibernate.dialect org.hibernate.dialect.MySQLMyISAMDialect
-#hibernate.connection.driver_class com.mysql.jdbc.Driver
-#hibernate.connection.url jdbc:mysql:///test
-#hibernate.connection.username emmanuel
-#hibernate.connection.password
-
-
-## Oracle
-
-#hibernate.dialect org.hibernate.dialect.OracleDialect
-#hibernate.dialect org.hibernate.dialect.Oracle9Dialect
-#hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver
-#hibernate.connection.username ora
-#hibernate.connection.password ora
-#hibernate.connection.url jdbc:oracle:thin:@localhost:1521:test
-
-
-## PostgreSQL
-
-#hibernate.dialect org.hibernate.dialect.PostgreSQLDialect
-#hibernate.connection.driver_class org.postgresql.Driver
-#hibernate.connection.url jdbc:postgresql:annotations
-#hibernate.connection.username postgres
-#hibernate.connection.password hibernate
-#hibernate.query.substitutions yes 'Y', no 'N'
-
-
-## DB2
-
-#hibernate.dialect org.hibernate.dialect.DB2Dialect
-#hibernate.connection.driver_class COM.ibm.db2.jdbc.app.DB2Driver
-#hibernate.connection.url jdbc:db2:test
-#hibernate.connection.username db2
-#hibernate.connection.password db2
-
-## TimesTen (not supported yet)
-
-#hibernate.dialect org.hibernate.dialect.TimesTenDialect
-#hibernate.connection.driver_class com.timesten.jdbc.TimesTenDriver
-#hibernate.connection.url jdbc:timesten:direct:test
-#hibernate.connection.username
-#hibernate.connection.password
-
-## DB2/400
-
-#hibernate.dialect org.hibernate.dialect.DB2400Dialect
-#hibernate.connection.username user
-#hibernate.connection.password password
-
-## Native driver
-#hibernate.connection.driver_class COM.ibm.db2.jdbc.app.DB2Driver
-#hibernate.connection.url jdbc:db2://systemname
-
-## Toolbox driver
-#hibernate.connection.driver_class com.ibm.as400.access.AS400JDBCDriver
-#hibernate.connection.url jdbc:as400://systemname
-
-
-## Derby (Not supported!)
-
-#hibernate.dialect org.hibernate.dialect.DerbyDialect
-#hibernate.connection.driver_class org.apache.derby.jdbc.EmbeddedDriver
-#hibernate.connection.username
-#hibernate.connection.password
-#hibernate.connection.url jdbc:derby:/test;create=true
-
-
-## Sybase
-
-#hibernate.dialect org.hibernate.dialect.SybaseDialect
-#hibernate.connection.driver_class com.sybase.jdbc2.jdbc.SybDriver
-#hibernate.connection.username sa
-#hibernate.connection.password sasasa
-#hibernate.connection.url jdbc:sybase:Tds:co3061835-a:5000/tempdb
-
-
-## Mckoi SQL
-
-#hibernate.dialect org.hibernate.dialect.MckoiDialect
-#hibernate.connection.driver_class com.mckoi.JDBCDriver
-#hibernate.connection.url jdbc:mckoi:///
-#hibernate.connection.url jdbc:mckoi:local://C:/mckoi1.00/db.conf
-#hibernate.connection.username admin
-#hibernate.connection.password nimda
-
-
-## SAP DB
-
-#hibernate.dialect org.hibernate.dialect.SAPDBDialect
-#hibernate.connection.driver_class com.sap.dbtech.jdbc.DriverSapDB
-#hibernate.connection.url jdbc:sapdb://localhost/TST
-#hibernate.connection.username TEST
-#hibernate.connection.password TEST
-#hibernate.query.substitutions yes 'Y', no 'N'
-
-
-## MS SQL Server
-
-#hibernate.dialect org.hibernate.dialect.SQLServerDialect
-#hibernate.connection.username sa
-#hibernate.connection.password sa
-
-## JSQL Driver
-#hibernate.connection.driver_class com.jnetdirect.jsql.JSQLDriver
-#hibernate.connection.url jdbc:JSQLConnect://1E1/test
-
-## JTURBO Driver
-#hibernate.connection.driver_class com.newatlanta.jturbo.driver.Driver
-#hibernate.connection.url jdbc:JTurbo://1E1:1433/test
-
-## WebLogic Driver
-#hibernate.connection.driver_class weblogic.jdbc.mssqlserver4.Driver
-#hibernate.connection.url jdbc:weblogic:mssqlserver4:1E1:1433
-
-## Microsoft Driver (not recommended!)
-#hibernate.connection.driver_class com.microsoft.jdbc.sqlserver.SQLServerDriver
-#hibernate.connection.url jdbc:microsoft:sqlserver://1E1;DatabaseName=test;SelectMethod=cursor
-
-## jTDS (since version 0.9)
-#hibernate.connection.driver_class net.sourceforge.jtds.jdbc.Driver
-#hibernate.connection.url jdbc:jtds:sqlserver://1E1/test
-
-## Interbase
-
-#hibernate.dialect org.hibernate.dialect.InterbaseDialect
-#hibernate.connection.username sysdba
-#hibernate.connection.password masterkey
-
-## DO NOT specify hibernate.connection.sqlDialect
-
-## InterClient
-
-#hibernate.connection.driver_class interbase.interclient.Driver
-#hibernate.connection.url jdbc:interbase://localhost:3060/C:/firebird/test.gdb
-
-## Pure Java
-
-#hibernate.connection.driver_class org.firebirdsql.jdbc.FBDriver
-#hibernate.connection.url jdbc:firebirdsql:localhost/3050:/firebird/test.gdb
-
-
-## Pointbase
-
-#hibernate.dialect org.hibernate.dialect.PointbaseDialect
-#hibernate.connection.driver_class com.pointbase.jdbc.jdbcUniversalDriver
-#hibernate.connection.url jdbc:pointbase:embedded:sample
-#hibernate.connection.username PBPUBLIC
-#hibernate.connection.password PBPUBLIC
-
-
-
-#################################
-### Hibernate Connection Pool ###
-#################################
-
-hibernate.connection.pool_size 1
-
-
-
-###########################
-### C3P0 Connection Pool###
-###########################
-
-#hibernate.c3p0.max_size 2
-#hibernate.c3p0.min_size 2
-#hibernate.c3p0.timeout 5000
-#hibernate.c3p0.max_statements 100
-#hibernate.c3p0.idle_test_period 3000
-#hibernate.c3p0.acquire_increment 2
-#hibernate.c3p0.validate false
-
-
-
-##############################
-### Proxool Connection Pool###
-##############################
-
-## Properties for external configuration of Proxool
-
-hibernate.proxool.pool_alias pool1
-
-## Only need one of the following
-
-#hibernate.proxool.existing_pool true
-#hibernate.proxool.xml proxool.xml
-#hibernate.proxool.properties proxool.properties
-
-
-
-#################################
-### Plugin ConnectionProvider ###
-#################################
-
-## use a custom ConnectionProvider (if not set, Hibernate will choose a built-in ConnectionProvider using hueristics)
-
-#hibernate.connection.provider_class org.hibernate.connection.DriverManagerConnectionProvider
-#hibernate.connection.provider_class org.hibernate.connection.DatasourceConnectionProvider
-#hibernate.connection.provider_class org.hibernate.connection.C3P0ConnectionProvider
-#hibernate.connection.provider_class org.hibernate.connection.DBCPConnectionProvider
-#hibernate.connection.provider_class org.hibernate.connection.ProxoolConnectionProvider
-
-
-
-#######################
-### Transaction API ###
-#######################
-
-## Enable automatic flush during the JTA beforeCompletion() callback
-## (This setting is relevant with or without the Transaction API)
-
-#hibernate.transaction.flush_before_completion
-
-
-## Enable automatic session close at the end of transaction
-## (This setting is relevant with or without the Transaction API)
-
-#hibernate.transaction.auto_close_session
-
-
-## the Transaction API abstracts application code from the underlying JTA or JDBC transactions
-
-#hibernate.transaction.factory_class org.hibernate.transaction.JTATransactionFactory
-#hibernate.transaction.factory_class org.hibernate.transaction.JDBCTransactionFactory
-
-
-## to use JTATransactionFactory, Hibernate must be able to locate the UserTransaction in JNDI
-## default is java:comp/UserTransaction
-## you do NOT need this setting if you specify hibernate.transaction.manager_lookup_class
-
-#jta.UserTransaction jta/usertransaction
-#jta.UserTransaction javax.transaction.UserTransaction
-#jta.UserTransaction UserTransaction
-
-
-## to use the second-level cache with JTA, Hibernate must be able to obtain the JTA TransactionManager
-
-#hibernate.transaction.manager_lookup_class org.hibernate.transaction.JBossTransactionManagerLookup
-#hibernate.transaction.manager_lookup_class org.hibernate.transaction.WeblogicTransactionManagerLookup
-#hibernate.transaction.manager_lookup_class org.hibernate.transaction.WebSphereTransactionManagerLookup
-#hibernate.transaction.manager_lookup_class org.hibernate.transaction.OrionTransactionManagerLookup
-#hibernate.transaction.manager_lookup_class org.hibernate.transaction.ResinTransactionManagerLookup
-
-
-
-##############################
-### Miscellaneous Settings ###
-##############################
-
-## print all generated SQL to the console
-
-#hibernate.show_sql true
-
-
-## add comments to the generated SQL
-
-#hibernate.use_sql_comments true
-
-
-## generate statistics
-
-#hibernate.generate_statistics true
-
-
-## auto schema export
-
-#hibernate.hbm2ddl.auto create-drop
-#hibernate.hbm2ddl.auto create
-#hibernate.hbm2ddl.auto update
-
-
-## specify a default schema and catalog for unqualified tablenames
-
-#hibernate.default_schema test
-#hibernate.default_catalog test
-
-
-## enable ordering of SQL UPDATEs by primary key
-
-hibernate.order_updates true
-
-
-## set the maximum depth of the outer join fetch tree
-
-hibernate.max_fetch_depth 1
-
-
-## set the default batch size for batch fetching
-
-hibernate.default_batch_fetch_size 100
-
-
-## rollback generated identifier values of deleted entities to default values
-
-#hibernate.use_identifer_rollback true
-
-
-## enable CGLIB reflection optimizer (enabled by default)
-
-#hibernate.cglib.use_reflection_optimizer false
-
-
-
-#####################
-### JDBC Settings ###
-#####################
-
-## specify a JDBC isolation level
-
-#hibernate.connection.isolation 4
-
-
-## enable JDBC autocommit (not recommended!)
-
-#hibernate.connection.autocommit true
-
-
-## set the JDBC fetch size
-
-#hibernate.jdbc.fetch_size 25
-
-
-## set the maximum JDBC 2 batch size (a nonzero value enables batching)
-
-#hibernate.jdbc.batch_size 0
-
-
-## enable batch updates even for versioned data
-
-hibernate.jdbc.batch_versioned_data true
-
-
-## enable use of JDBC 2 scrollable ResultSets (specifying a Dialect will cause Hibernate to use a sensible default)
-
-#hibernate.jdbc.use_scrollable_resultset true
-
-
-## use streams when writing binary types to / from JDBC
-
-hibernate.jdbc.use_streams_for_binary true
-
-
-## use JDBC 3 PreparedStatement.getGeneratedKeys() to get the identifier of an inserted row
-
-#hibernate.jdbc.use_get_generated_keys false
-
-
-## choose a custom JDBC batcher
-
-# hibernate.jdbc.factory_class
-
-
-## enable JDBC result set column alias caching
-## (minor performance enhancement for broken JDBC drivers)
-
-# hibernate.jdbc.wrap_result_sets
-
-
-## choose a custom SQL exception converter
-
-#hibernate.jdbc.sql_exception_converter
-
-
-
-##########################
-### Second-level Cache ###
-##########################
-
-## optimize chache for minimal "puts" instead of minimal "gets" (good for clustered cache)
-
-#hibernate.cache.use_minimal_puts true
-
-
-## set a prefix for cache region names
-
-hibernate.cache.region_prefix hibernate.test
-
-
-## disable the second-level cache
-
-#hibernate.cache.use_second_level_cache false
-
-
-## enable the query cache
-
-hibernate.cache.use_query_cache true
-
-
-## store the second-level cache entries in a more human-friendly format
-
-#hibernate.cache.use_structured_entries true
-
-
-## choose a cache implementation
-
-#hibernate.cache.provider_class org.hibernate.cache.EhCacheProvider
-#hibernate.cache.provider_class org.hibernate.cache.EmptyCacheProvider
-hibernate.cache.provider_class org.hibernate.cache.HashtableCacheProvider
-#hibernate.cache.provider_class org.hibernate.cache.TreeCacheProvider
-#hibernate.cache.provider_class org.hibernate.cache.OSCacheProvider
-#hibernate.cache.provider_class org.hibernate.cache.SwarmCacheProvider
-
-
-## choose a custom query cache implementation
-
-#hibernate.cache.query_cache_factory
-
-
-
-############
-### JNDI ###
-############
-
-## specify a JNDI name for the SessionFactory
-
-#hibernate.session_factory_name hibernate/session_factory
-
-
-## Hibernate uses JNDI to bind a name to a SessionFactory and to look up the JTA UserTransaction;
-## if hibernate.jndi.* are not specified, Hibernate will use the default InitialContext() which
-## is the best approach in an application server
-
-#file system
-#hibernate.jndi.class com.sun.jndi.fscontext.RefFSContextFactory
-#hibernate.jndi.url file:/
-
-#WebSphere
-#hibernate.jndi.class com.ibm.websphere.naming.WsnInitialContextFactory
-#hibernate.jndi.url iiop://localhost:900/
-
Copied: validator/trunk/hibernate-validator-legacy/src/test/java/org (from rev 15246, validator/trunk/hibernate-validator-legacy/src/test/org)
Deleted: validator/trunk/hibernate-validator-legacy/src/test/log4j.properties
===================================================================
--- validator/trunk/hibernate-validator-legacy/src/test/log4j.properties 2008-10-03 03:03:21 UTC (rev 15252)
+++ validator/trunk/hibernate-validator-legacy/src/test/log4j.properties 2008-10-03 14:41:53 UTC (rev 15253)
@@ -1,44 +0,0 @@
-### direct log messages to stdout ###
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.Target=System.out
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
-
-### direct messages to file hibernate.log ###
-#log4j.appender.file=org.apache.log4j.FileAppender
-#log4j.appender.file.File=hibernate.log
-#log4j.appender.file.layout=org.apache.log4j.PatternLayout
-#log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
-
-### set log levels - for more verbose logging change 'info' to 'debug' ###
-
-log4j.rootLogger=warn, stdout
-
-log4j.logger.org.hibernate=info
-
-
-### log just the SQL
-log4j.logger.org.hibernate.SQL=debug
-
-#log4j.logger.org.hibernate.engine.CascadingAction=debug
-
-### log JDBC bind parameters ###
-#log4j.logger.org.hibernate.type=debug
-
-### log schema export/update ###
-log4j.logger.org.hibernate.tool.hbm2ddl=debug
-
-### log cache activity ###
-#log4j.logger.org.hibernate.cache=debug
-
-### enable the following line if you want to track down connection ###
-### leakages when using DriverManagerConnectionProvider ###
-#log4j.logger.org.hibernate.connection.DriverManagerConnectionProvider=trace
-
-### annotation logs
-#log4j.logger.org.hibernate.annotation=info
-#log4j.logger.org.hibernate.cfg=info
-#log4j.logger.org.hibernate.cfg.SettingsFactory=info
-#log4j.logger.org.hibernate.cfg.AnnotationBinder=info
-#log4j.logger.org.hibernate.cfg.AnnotationConfiguration=info
-#log4j.logger.org.hibernate.cfg.Ejb3Column=info
\ No newline at end of file
Deleted: validator/trunk/hibernate-validator-legacy/src/test/messages_en.properties
===================================================================
--- validator/trunk/hibernate-validator-legacy/src/test/messages_en.properties 2008-10-03 03:03:21 UTC (rev 15252)
+++ validator/trunk/hibernate-validator-legacy/src/test/messages_en.properties 2008-10-03 14:41:53 UTC (rev 15253)
@@ -1,15 +0,0 @@
-long=is too damn long
-floor.name=Floor
-out.of.range=lower that {min} and greater than {max}
-floor.out.of.range={floor.name} cannot (escaping #{el}) be {out.of.range}
-
-validator.assertFalse=assertion failed
-validator.assertTrue=assertion failed
-validator.length=length must be between {min} and {max}
-validator.max=must less than or equal to {value}
-validator.min=must greater than or equal to {value}
-validator.notNull=may not be null
-validator.past=must be a past date
-validator.pattern=must match "{regex}"
-validator.range=must be between {min} and {max}
-validator.size=size must be between {min} and {max}
\ No newline at end of file
Copied: validator/trunk/hibernate-validator-legacy/src/test/resources/ValidatorMessages.properties (from rev 15246, validator/trunk/hibernate-validator-legacy/src/test/ValidatorMessages.properties)
===================================================================
--- validator/trunk/hibernate-validator-legacy/src/test/resources/ValidatorMessages.properties (rev 0)
+++ validator/trunk/hibernate-validator-legacy/src/test/resources/ValidatorMessages.properties 2008-10-03 14:41:53 UTC (rev 15253)
@@ -0,0 +1,7 @@
+#overriding of default keys
+
+#specific to my project
+long=is too damn long
+floor.name=Floor
+out.of.range=lower that {min} and greater than {max}
+floor.out.of.range={floor.name} cannot be {out.of.range}
\ No newline at end of file
Property changes on: validator/trunk/hibernate-validator-legacy/src/test/resources/ValidatorMessages.properties
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ native
Copied: validator/trunk/hibernate-validator-legacy/src/test/resources/ValidatorMessages_da.properties (from rev 15246, validator/trunk/hibernate-validator-legacy/src/test/ValidatorMessages_da.properties)
===================================================================
--- validator/trunk/hibernate-validator-legacy/src/test/resources/ValidatorMessages_da.properties (rev 0)
+++ validator/trunk/hibernate-validator-legacy/src/test/resources/ValidatorMessages_da.properties 2008-10-03 14:41:53 UTC (rev 15253)
@@ -0,0 +1,7 @@
+#overriding of default keys
+
+#specific to my project
+long=is too damn long
+floor.name=Floor
+out.of.range=lower that {min} and greater than {max}
+floor.out.of.range={floor.name} cannot be {out.of.range}
\ No newline at end of file
Property changes on: validator/trunk/hibernate-validator-legacy/src/test/resources/ValidatorMessages_da.properties
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ native
Copied: validator/trunk/hibernate-validator-legacy/src/test/resources/ValidatorMessages_fr.properties (from rev 15246, validator/trunk/hibernate-validator-legacy/src/test/ValidatorMessages_fr.properties)
===================================================================
--- validator/trunk/hibernate-validator-legacy/src/test/resources/ValidatorMessages_fr.properties (rev 0)
+++ validator/trunk/hibernate-validator-legacy/src/test/resources/ValidatorMessages_fr.properties 2008-10-03 14:41:53 UTC (rev 15253)
@@ -0,0 +1,7 @@
+#overriding of default keys
+
+#specific to my project
+long=est grave trop long
+floor.name=Etage
+out.of.range=plus petit que {min} ou plus grand que {max}
+floor.out.of.range={floor.name} ne peut pas �tre {out.of.range}
\ No newline at end of file
Property changes on: validator/trunk/hibernate-validator-legacy/src/test/resources/ValidatorMessages_fr.properties
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ native
Copied: validator/trunk/hibernate-validator-legacy/src/test/resources/hibernate.properties (from rev 15246, validator/trunk/hibernate-validator-legacy/src/test/hibernate.properties)
===================================================================
--- validator/trunk/hibernate-validator-legacy/src/test/resources/hibernate.properties (rev 0)
+++ validator/trunk/hibernate-validator-legacy/src/test/resources/hibernate.properties 2008-10-03 14:41:53 UTC (rev 15253)
@@ -0,0 +1,472 @@
+######################
+### Query Language ###
+######################
+
+## define query language constants / function names
+
+hibernate.query.substitutions true 1, false 0, yes 'Y', no 'N'
+
+
+## select the classic query parser
+
+#hibernate.query.factory_class org.hibernate.hql.classic.ClassicQueryTranslatorFactory
+
+hibernate.format_sql true
+
+
+
+#################
+### Platforms ###
+#################
+
+## JNDI Datasource
+
+#hibernate.connection.datasource jdbc/test
+#hibernate.connection.username db2
+#hibernate.connection.password db2
+
+
+## HypersonicSQL
+
+hibernate.dialect org.hibernate.dialect.HSQLDialect
+hibernate.connection.driver_class org.hsqldb.jdbcDriver
+hibernate.connection.username sa
+hibernate.connection.password
+hibernate.connection.url jdbc:hsqldb:hsql://localhost
+hibernate.connection.url jdbc:hsqldb:test
+hibernate.connection.url jdbc:hsqldb:.
+
+
+## MySQL
+
+#hibernate.dialect org.hibernate.dialect.MySQLDialect
+#hibernate.dialect org.hibernate.dialect.MySQLInnoDBDialect
+#hibernate.dialect org.hibernate.dialect.MySQLMyISAMDialect
+#hibernate.connection.driver_class com.mysql.jdbc.Driver
+#hibernate.connection.url jdbc:mysql:///test
+#hibernate.connection.username emmanuel
+#hibernate.connection.password
+
+
+## Oracle
+
+#hibernate.dialect org.hibernate.dialect.OracleDialect
+#hibernate.dialect org.hibernate.dialect.Oracle9Dialect
+#hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver
+#hibernate.connection.username ora
+#hibernate.connection.password ora
+#hibernate.connection.url jdbc:oracle:thin:@localhost:1521:test
+
+
+## PostgreSQL
+
+#hibernate.dialect org.hibernate.dialect.PostgreSQLDialect
+#hibernate.connection.driver_class org.postgresql.Driver
+#hibernate.connection.url jdbc:postgresql:annotations
+#hibernate.connection.username postgres
+#hibernate.connection.password hibernate
+#hibernate.query.substitutions yes 'Y', no 'N'
+
+
+## DB2
+
+#hibernate.dialect org.hibernate.dialect.DB2Dialect
+#hibernate.connection.driver_class COM.ibm.db2.jdbc.app.DB2Driver
+#hibernate.connection.url jdbc:db2:test
+#hibernate.connection.username db2
+#hibernate.connection.password db2
+
+## TimesTen (not supported yet)
+
+#hibernate.dialect org.hibernate.dialect.TimesTenDialect
+#hibernate.connection.driver_class com.timesten.jdbc.TimesTenDriver
+#hibernate.connection.url jdbc:timesten:direct:test
+#hibernate.connection.username
+#hibernate.connection.password
+
+## DB2/400
+
+#hibernate.dialect org.hibernate.dialect.DB2400Dialect
+#hibernate.connection.username user
+#hibernate.connection.password password
+
+## Native driver
+#hibernate.connection.driver_class COM.ibm.db2.jdbc.app.DB2Driver
+#hibernate.connection.url jdbc:db2://systemname
+
+## Toolbox driver
+#hibernate.connection.driver_class com.ibm.as400.access.AS400JDBCDriver
+#hibernate.connection.url jdbc:as400://systemname
+
+
+## Derby (Not supported!)
+
+#hibernate.dialect org.hibernate.dialect.DerbyDialect
+#hibernate.connection.driver_class org.apache.derby.jdbc.EmbeddedDriver
+#hibernate.connection.username
+#hibernate.connection.password
+#hibernate.connection.url jdbc:derby:/test;create=true
+
+
+## Sybase
+
+#hibernate.dialect org.hibernate.dialect.SybaseDialect
+#hibernate.connection.driver_class com.sybase.jdbc2.jdbc.SybDriver
+#hibernate.connection.username sa
+#hibernate.connection.password sasasa
+#hibernate.connection.url jdbc:sybase:Tds:co3061835-a:5000/tempdb
+
+
+## Mckoi SQL
+
+#hibernate.dialect org.hibernate.dialect.MckoiDialect
+#hibernate.connection.driver_class com.mckoi.JDBCDriver
+#hibernate.connection.url jdbc:mckoi:///
+#hibernate.connection.url jdbc:mckoi:local://C:/mckoi1.00/db.conf
+#hibernate.connection.username admin
+#hibernate.connection.password nimda
+
+
+## SAP DB
+
+#hibernate.dialect org.hibernate.dialect.SAPDBDialect
+#hibernate.connection.driver_class com.sap.dbtech.jdbc.DriverSapDB
+#hibernate.connection.url jdbc:sapdb://localhost/TST
+#hibernate.connection.username TEST
+#hibernate.connection.password TEST
+#hibernate.query.substitutions yes 'Y', no 'N'
+
+
+## MS SQL Server
+
+#hibernate.dialect org.hibernate.dialect.SQLServerDialect
+#hibernate.connection.username sa
+#hibernate.connection.password sa
+
+## JSQL Driver
+#hibernate.connection.driver_class com.jnetdirect.jsql.JSQLDriver
+#hibernate.connection.url jdbc:JSQLConnect://1E1/test
+
+## JTURBO Driver
+#hibernate.connection.driver_class com.newatlanta.jturbo.driver.Driver
+#hibernate.connection.url jdbc:JTurbo://1E1:1433/test
+
+## WebLogic Driver
+#hibernate.connection.driver_class weblogic.jdbc.mssqlserver4.Driver
+#hibernate.connection.url jdbc:weblogic:mssqlserver4:1E1:1433
+
+## Microsoft Driver (not recommended!)
+#hibernate.connection.driver_class com.microsoft.jdbc.sqlserver.SQLServerDriver
+#hibernate.connection.url jdbc:microsoft:sqlserver://1E1;DatabaseName=test;SelectMethod=cursor
+
+## jTDS (since version 0.9)
+#hibernate.connection.driver_class net.sourceforge.jtds.jdbc.Driver
+#hibernate.connection.url jdbc:jtds:sqlserver://1E1/test
+
+## Interbase
+
+#hibernate.dialect org.hibernate.dialect.InterbaseDialect
+#hibernate.connection.username sysdba
+#hibernate.connection.password masterkey
+
+## DO NOT specify hibernate.connection.sqlDialect
+
+## InterClient
+
+#hibernate.connection.driver_class interbase.interclient.Driver
+#hibernate.connection.url jdbc:interbase://localhost:3060/C:/firebird/test.gdb
+
+## Pure Java
+
+#hibernate.connection.driver_class org.firebirdsql.jdbc.FBDriver
+#hibernate.connection.url jdbc:firebirdsql:localhost/3050:/firebird/test.gdb
+
+
+## Pointbase
+
+#hibernate.dialect org.hibernate.dialect.PointbaseDialect
+#hibernate.connection.driver_class com.pointbase.jdbc.jdbcUniversalDriver
+#hibernate.connection.url jdbc:pointbase:embedded:sample
+#hibernate.connection.username PBPUBLIC
+#hibernate.connection.password PBPUBLIC
+
+
+
+#################################
+### Hibernate Connection Pool ###
+#################################
+
+hibernate.connection.pool_size 1
+
+
+
+###########################
+### C3P0 Connection Pool###
+###########################
+
+#hibernate.c3p0.max_size 2
+#hibernate.c3p0.min_size 2
+#hibernate.c3p0.timeout 5000
+#hibernate.c3p0.max_statements 100
+#hibernate.c3p0.idle_test_period 3000
+#hibernate.c3p0.acquire_increment 2
+#hibernate.c3p0.validate false
+
+
+
+##############################
+### Proxool Connection Pool###
+##############################
+
+## Properties for external configuration of Proxool
+
+hibernate.proxool.pool_alias pool1
+
+## Only need one of the following
+
+#hibernate.proxool.existing_pool true
+#hibernate.proxool.xml proxool.xml
+#hibernate.proxool.properties proxool.properties
+
+
+
+#################################
+### Plugin ConnectionProvider ###
+#################################
+
+## use a custom ConnectionProvider (if not set, Hibernate will choose a built-in ConnectionProvider using hueristics)
+
+#hibernate.connection.provider_class org.hibernate.connection.DriverManagerConnectionProvider
+#hibernate.connection.provider_class org.hibernate.connection.DatasourceConnectionProvider
+#hibernate.connection.provider_class org.hibernate.connection.C3P0ConnectionProvider
+#hibernate.connection.provider_class org.hibernate.connection.DBCPConnectionProvider
+#hibernate.connection.provider_class org.hibernate.connection.ProxoolConnectionProvider
+
+
+
+#######################
+### Transaction API ###
+#######################
+
+## Enable automatic flush during the JTA beforeCompletion() callback
+## (This setting is relevant with or without the Transaction API)
+
+#hibernate.transaction.flush_before_completion
+
+
+## Enable automatic session close at the end of transaction
+## (This setting is relevant with or without the Transaction API)
+
+#hibernate.transaction.auto_close_session
+
+
+## the Transaction API abstracts application code from the underlying JTA or JDBC transactions
+
+#hibernate.transaction.factory_class org.hibernate.transaction.JTATransactionFactory
+#hibernate.transaction.factory_class org.hibernate.transaction.JDBCTransactionFactory
+
+
+## to use JTATransactionFactory, Hibernate must be able to locate the UserTransaction in JNDI
+## default is java:comp/UserTransaction
+## you do NOT need this setting if you specify hibernate.transaction.manager_lookup_class
+
+#jta.UserTransaction jta/usertransaction
+#jta.UserTransaction javax.transaction.UserTransaction
+#jta.UserTransaction UserTransaction
+
+
+## to use the second-level cache with JTA, Hibernate must be able to obtain the JTA TransactionManager
+
+#hibernate.transaction.manager_lookup_class org.hibernate.transaction.JBossTransactionManagerLookup
+#hibernate.transaction.manager_lookup_class org.hibernate.transaction.WeblogicTransactionManagerLookup
+#hibernate.transaction.manager_lookup_class org.hibernate.transaction.WebSphereTransactionManagerLookup
+#hibernate.transaction.manager_lookup_class org.hibernate.transaction.OrionTransactionManagerLookup
+#hibernate.transaction.manager_lookup_class org.hibernate.transaction.ResinTransactionManagerLookup
+
+
+
+##############################
+### Miscellaneous Settings ###
+##############################
+
+## print all generated SQL to the console
+
+#hibernate.show_sql true
+
+
+## add comments to the generated SQL
+
+#hibernate.use_sql_comments true
+
+
+## generate statistics
+
+#hibernate.generate_statistics true
+
+
+## auto schema export
+
+#hibernate.hbm2ddl.auto create-drop
+#hibernate.hbm2ddl.auto create
+#hibernate.hbm2ddl.auto update
+
+
+## specify a default schema and catalog for unqualified tablenames
+
+#hibernate.default_schema test
+#hibernate.default_catalog test
+
+
+## enable ordering of SQL UPDATEs by primary key
+
+hibernate.order_updates true
+
+
+## set the maximum depth of the outer join fetch tree
+
+hibernate.max_fetch_depth 1
+
+
+## set the default batch size for batch fetching
+
+hibernate.default_batch_fetch_size 100
+
+
+## rollback generated identifier values of deleted entities to default values
+
+#hibernate.use_identifer_rollback true
+
+
+## enable CGLIB reflection optimizer (enabled by default)
+
+#hibernate.cglib.use_reflection_optimizer false
+
+
+
+#####################
+### JDBC Settings ###
+#####################
+
+## specify a JDBC isolation level
+
+#hibernate.connection.isolation 4
+
+
+## enable JDBC autocommit (not recommended!)
+
+#hibernate.connection.autocommit true
+
+
+## set the JDBC fetch size
+
+#hibernate.jdbc.fetch_size 25
+
+
+## set the maximum JDBC 2 batch size (a nonzero value enables batching)
+
+#hibernate.jdbc.batch_size 0
+
+
+## enable batch updates even for versioned data
+
+hibernate.jdbc.batch_versioned_data true
+
+
+## enable use of JDBC 2 scrollable ResultSets (specifying a Dialect will cause Hibernate to use a sensible default)
+
+#hibernate.jdbc.use_scrollable_resultset true
+
+
+## use streams when writing binary types to / from JDBC
+
+hibernate.jdbc.use_streams_for_binary true
+
+
+## use JDBC 3 PreparedStatement.getGeneratedKeys() to get the identifier of an inserted row
+
+#hibernate.jdbc.use_get_generated_keys false
+
+
+## choose a custom JDBC batcher
+
+# hibernate.jdbc.factory_class
+
+
+## enable JDBC result set column alias caching
+## (minor performance enhancement for broken JDBC drivers)
+
+# hibernate.jdbc.wrap_result_sets
+
+
+## choose a custom SQL exception converter
+
+#hibernate.jdbc.sql_exception_converter
+
+
+
+##########################
+### Second-level Cache ###
+##########################
+
+## optimize chache for minimal "puts" instead of minimal "gets" (good for clustered cache)
+
+#hibernate.cache.use_minimal_puts true
+
+
+## set a prefix for cache region names
+
+hibernate.cache.region_prefix hibernate.test
+
+
+## disable the second-level cache
+
+#hibernate.cache.use_second_level_cache false
+
+
+## enable the query cache
+
+hibernate.cache.use_query_cache true
+
+
+## store the second-level cache entries in a more human-friendly format
+
+#hibernate.cache.use_structured_entries true
+
+
+## choose a cache implementation
+
+#hibernate.cache.provider_class org.hibernate.cache.EhCacheProvider
+#hibernate.cache.provider_class org.hibernate.cache.EmptyCacheProvider
+hibernate.cache.provider_class org.hibernate.cache.HashtableCacheProvider
+#hibernate.cache.provider_class org.hibernate.cache.TreeCacheProvider
+#hibernate.cache.provider_class org.hibernate.cache.OSCacheProvider
+#hibernate.cache.provider_class org.hibernate.cache.SwarmCacheProvider
+
+
+## choose a custom query cache implementation
+
+#hibernate.cache.query_cache_factory
+
+
+
+############
+### JNDI ###
+############
+
+## specify a JNDI name for the SessionFactory
+
+#hibernate.session_factory_name hibernate/session_factory
+
+
+## Hibernate uses JNDI to bind a name to a SessionFactory and to look up the JTA UserTransaction;
+## if hibernate.jndi.* are not specified, Hibernate will use the default InitialContext() which
+## is the best approach in an application server
+
+#file system
+#hibernate.jndi.class com.sun.jndi.fscontext.RefFSContextFactory
+#hibernate.jndi.url file:/
+
+#WebSphere
+#hibernate.jndi.class com.ibm.websphere.naming.WsnInitialContextFactory
+#hibernate.jndi.url iiop://localhost:900/
+
Property changes on: validator/trunk/hibernate-validator-legacy/src/test/resources/hibernate.properties
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: validator/trunk/hibernate-validator-legacy/src/test/resources/log4j.properties (from rev 15246, validator/trunk/hibernate-validator-legacy/src/test/log4j.properties)
===================================================================
--- validator/trunk/hibernate-validator-legacy/src/test/resources/log4j.properties (rev 0)
+++ validator/trunk/hibernate-validator-legacy/src/test/resources/log4j.properties 2008-10-03 14:41:53 UTC (rev 15253)
@@ -0,0 +1,44 @@
+### direct log messages to stdout ###
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target=System.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
+
+### direct messages to file hibernate.log ###
+#log4j.appender.file=org.apache.log4j.FileAppender
+#log4j.appender.file.File=hibernate.log
+#log4j.appender.file.layout=org.apache.log4j.PatternLayout
+#log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
+
+### set log levels - for more verbose logging change 'info' to 'debug' ###
+
+log4j.rootLogger=warn, stdout
+
+log4j.logger.org.hibernate=warn
+
+
+### log just the SQL
+log4j.logger.org.hibernate.SQL=debug
+
+#log4j.logger.org.hibernate.engine.CascadingAction=debug
+
+### log JDBC bind parameters ###
+#log4j.logger.org.hibernate.type=debug
+
+### log schema export/update ###
+log4j.logger.org.hibernate.tool.hbm2ddl=debug
+
+### log cache activity ###
+#log4j.logger.org.hibernate.cache=debug
+
+### enable the following line if you want to track down connection ###
+### leakages when using DriverManagerConnectionProvider ###
+#log4j.logger.org.hibernate.connection.DriverManagerConnectionProvider=trace
+
+### annotation logs
+#log4j.logger.org.hibernate.annotation=info
+#log4j.logger.org.hibernate.cfg=info
+#log4j.logger.org.hibernate.cfg.SettingsFactory=info
+#log4j.logger.org.hibernate.cfg.AnnotationBinder=info
+#log4j.logger.org.hibernate.cfg.AnnotationConfiguration=info
+#log4j.logger.org.hibernate.cfg.Ejb3Column=info
\ No newline at end of file
Property changes on: validator/trunk/hibernate-validator-legacy/src/test/resources/log4j.properties
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: validator/trunk/hibernate-validator-legacy/src/test/resources/messages_en.properties (from rev 15246, validator/trunk/hibernate-validator-legacy/src/test/messages_en.properties)
===================================================================
--- validator/trunk/hibernate-validator-legacy/src/test/resources/messages_en.properties (rev 0)
+++ validator/trunk/hibernate-validator-legacy/src/test/resources/messages_en.properties 2008-10-03 14:41:53 UTC (rev 15253)
@@ -0,0 +1,15 @@
+long=is too damn long
+floor.name=Floor
+out.of.range=lower that {min} and greater than {max}
+floor.out.of.range={floor.name} cannot (escaping #{el}) be {out.of.range}
+
+validator.assertFalse=assertion failed
+validator.assertTrue=assertion failed
+validator.length=length must be between {min} and {max}
+validator.max=must less than or equal to {value}
+validator.min=must greater than or equal to {value}
+validator.notNull=may not be null
+validator.past=must be a past date
+validator.pattern=must match "{regex}"
+validator.range=must be between {min} and {max}
+validator.size=size must be between {min} and {max}
\ No newline at end of file
Property changes on: validator/trunk/hibernate-validator-legacy/src/test/resources/messages_en.properties
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ native
17 years, 1 month
Hibernate SVN: r15252 - core/trunk/core/src/main/java/org/hibernate/transaction.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2008-10-02 23:03:21 -0400 (Thu, 02 Oct 2008)
New Revision: 15252
Modified:
core/trunk/core/src/main/java/org/hibernate/transaction/JTATransactionFactory.java
Log:
HHH-3481 : minor bug in previous JTATransactionFactory patch
Modified: core/trunk/core/src/main/java/org/hibernate/transaction/JTATransactionFactory.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transaction/JTATransactionFactory.java 2008-10-03 03:02:55 UTC (rev 15251)
+++ core/trunk/core/src/main/java/org/hibernate/transaction/JTATransactionFactory.java 2008-10-03 03:03:21 UTC (rev 15252)
@@ -156,12 +156,13 @@
* @return The appropriate {@link UserTransaction} reference.
*/
protected UserTransaction getUserTransaction() {
- log.trace( "Attempting to locate UserTransaction via JNDI [{}]", getUserTransactionName() );
+ final String utName = getUserTransactionName();
+ log.trace( "Attempting to locate UserTransaction via JNDI [{}]", utName );
try {
- UserTransaction ut = ( UserTransaction ) getInitialContext().lookup( getUserTransactionName() );
+ UserTransaction ut = ( UserTransaction ) getInitialContext().lookup( utName );
if ( ut == null ) {
- throw new TransactionException( "Naming service lookup for UserTransaction returned null [" + getUserTransactionName() +"]" );
+ throw new TransactionException( "Naming service lookup for UserTransaction returned null [" + utName +"]" );
}
log.trace( "Obtained UserTransaction" );
@@ -169,7 +170,7 @@
return ut;
}
catch ( NamingException ne ) {
- throw new TransactionException( "Could not find UserTransaction in JNDI [" + getUserTransaction() + "]", ne );
+ throw new TransactionException( "Could not find UserTransaction in JNDI [" + utName + "]", ne );
}
}
17 years, 1 month
Hibernate SVN: r15251 - core/branches/Branch_3_3/core/src/main/java/org/hibernate/transaction.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2008-10-02 23:02:55 -0400 (Thu, 02 Oct 2008)
New Revision: 15251
Modified:
core/branches/Branch_3_3/core/src/main/java/org/hibernate/transaction/JTATransactionFactory.java
Log:
HHH-3481 : minor bug in previous JTATransactionFactory patch
Modified: core/branches/Branch_3_3/core/src/main/java/org/hibernate/transaction/JTATransactionFactory.java
===================================================================
--- core/branches/Branch_3_3/core/src/main/java/org/hibernate/transaction/JTATransactionFactory.java 2008-10-03 03:02:25 UTC (rev 15250)
+++ core/branches/Branch_3_3/core/src/main/java/org/hibernate/transaction/JTATransactionFactory.java 2008-10-03 03:02:55 UTC (rev 15251)
@@ -156,12 +156,13 @@
* @return The appropriate {@link UserTransaction} reference.
*/
protected UserTransaction getUserTransaction() {
- log.trace( "Attempting to locate UserTransaction via JNDI [{}]", getUserTransactionName() );
+ final String utName = getUserTransactionName();
+ log.trace( "Attempting to locate UserTransaction via JNDI [{}]", utName );
try {
- UserTransaction ut = ( UserTransaction ) getInitialContext().lookup( getUserTransactionName() );
+ UserTransaction ut = ( UserTransaction ) getInitialContext().lookup( utName );
if ( ut == null ) {
- throw new TransactionException( "Naming service lookup for UserTransaction returned null [" + getUserTransactionName() +"]" );
+ throw new TransactionException( "Naming service lookup for UserTransaction returned null [" + utName +"]" );
}
log.trace( "Obtained UserTransaction" );
@@ -169,7 +170,7 @@
return ut;
}
catch ( NamingException ne ) {
- throw new TransactionException( "Could not find UserTransaction in JNDI [" + getUserTransaction() + "]", ne );
+ throw new TransactionException( "Could not find UserTransaction in JNDI [" + utName + "]", ne );
}
}
17 years, 1 month
Hibernate SVN: r15250 - core/branches/Branch_3_2/src/org/hibernate/transaction.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2008-10-02 23:02:25 -0400 (Thu, 02 Oct 2008)
New Revision: 15250
Modified:
core/branches/Branch_3_2/src/org/hibernate/transaction/JTATransactionFactory.java
Log:
HHH-3481 : minor bug in previous JTATransactionFactory patch
Modified: core/branches/Branch_3_2/src/org/hibernate/transaction/JTATransactionFactory.java
===================================================================
--- core/branches/Branch_3_2/src/org/hibernate/transaction/JTATransactionFactory.java 2008-10-02 21:14:24 UTC (rev 15249)
+++ core/branches/Branch_3_2/src/org/hibernate/transaction/JTATransactionFactory.java 2008-10-03 03:02:25 UTC (rev 15250)
@@ -155,12 +155,13 @@
* @return The appropriate {@link UserTransaction} reference.
*/
protected UserTransaction getUserTransaction() {
- log.trace( "Attempting to locate UserTransaction via JNDI [" + getUserTransactionName() + "]" );
+ final String utName = getUserTransactionName();
+ log.trace( "Attempting to locate UserTransaction via JNDI [" + utName + "]" );
try {
- UserTransaction ut = ( UserTransaction ) getInitialContext().lookup( getUserTransactionName() );
+ UserTransaction ut = ( UserTransaction ) getInitialContext().lookup( utName );
if ( ut == null ) {
- throw new TransactionException( "Naming service lookup for UserTransaction returned null [" + getUserTransactionName() +"]" );
+ throw new TransactionException( "Naming service lookup for UserTransaction returned null [" + utName +"]" );
}
log.trace( "Obtained UserTransaction" );
@@ -168,7 +169,7 @@
return ut;
}
catch ( NamingException ne ) {
- throw new TransactionException( "Could not find UserTransaction in JNDI [" + getUserTransaction() + "]", ne );
+ throw new TransactionException( "Could not find UserTransaction in JNDI [" + utName + "]", ne );
}
}
17 years, 1 month
Hibernate SVN: r15249 - core/branches/Branch_3_2/test/org/hibernate/test/filter.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2008-10-02 17:14:24 -0400 (Thu, 02 Oct 2008)
New Revision: 15249
Modified:
core/branches/Branch_3_2/test/org/hibernate/test/filter/DynamicFilterTest.java
Log:
HHH-530 : fixed use of auto-boxing in testcase
Modified: core/branches/Branch_3_2/test/org/hibernate/test/filter/DynamicFilterTest.java
===================================================================
--- core/branches/Branch_3_2/test/org/hibernate/test/filter/DynamicFilterTest.java 2008-10-02 20:00:39 UTC (rev 15248)
+++ core/branches/Branch_3_2/test/org/hibernate/test/filter/DynamicFilterTest.java 2008-10-02 21:14:24 UTC (rev 15249)
@@ -255,7 +255,7 @@
session.enableFilter("region").setParameter("region", "APAC");
DetachedCriteria lineItemSubquery = DetachedCriteria.forClass(LineItem.class)
- .add(Restrictions.ge("quantity", 1L))
+ .add(Restrictions.ge("quantity", new Long(1)))
.createCriteria("product")
.add(Restrictions.eq("name", "Acme Hair Gel"))
.setProjection(Property.forName("id"));
@@ -275,7 +275,7 @@
.setProjection(Property.forName("id"));
lineItemSubquery = DetachedCriteria.forClass(LineItem.class)
- .add(Restrictions.ge("quantity", 1L))
+ .add(Restrictions.ge("quantity", new Long(1)))
.createCriteria("product")
.add(Subqueries.propertyIn("id", productSubquery))
.setProjection(Property.forName("id"));
17 years, 1 month