HHH-8893 HBM transform/mock

asdf
This commit is contained in:
Brett Meyer 2014-05-05 14:52:02 -04:00
parent 3e1d73cae8
commit 51d09c53cb
93 changed files with 1093 additions and 362 deletions

View File

@ -64,23 +64,9 @@ public class HibernateTypeSourceImpl implements HibernateTypeSource, JavaTypeDes
}
public HibernateTypeSourceImpl(final PluralAttributeElementDetails element) {
this.nameHolder = new ValueHolder<String>(
new ValueHolder.DeferredInitializer<String>() {
@Override
public String initialize() {
return element.getTypeResolver().getExplicitHibernateTypeName();
}
}
);
this.parameterHolder = new ValueHolder<Map<String, String>>(
new ValueHolder.DeferredInitializer<Map<String, String>>() {
@Override
public Map<String, String> initialize() {
return element.getTypeResolver().getExplicitHibernateTypeParameters();
}
}
);
this.javaType = element.getJavaType();
this.name = element.getTypeResolver().getExplicitHibernateTypeName();
this.parameters = element.getTypeResolver().getExplicitHibernateTypeParameters();
this.javaTypeDescriptor = element.getJavaType();
}
@Override

View File

@ -43,6 +43,7 @@ import org.hibernate.annotations.DiscriminatorOptions;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.hibernate.annotations.FetchProfile;
import org.hibernate.annotations.FetchProfiles;
import org.hibernate.annotations.Filter;
@ -138,6 +139,7 @@ public interface HibernateDotNames {
DotName DYNAMIC_INSERT = DotName.createSimple( DynamicInsert.class.getName() );
DotName DYNAMIC_UPDATE = DotName.createSimple( DynamicUpdate.class.getName() );
DotName FETCH = DotName.createSimple( Fetch.class.getName() );
DotName FETCH_MODE = DotName.createSimple( FetchMode.class.getName() );
DotName FETCH_PROFILE = DotName.createSimple( FetchProfile.class.getName() );
DotName FETCH_PROFILES = DotName.createSimple( FetchProfiles.class.getName() );
DotName FETCH_OVERRIDE = DotName.createSimple( FetchProfile.FetchOverride.class.getName() );

View File

@ -25,13 +25,13 @@ package org.hibernate.metamodel.source.internal.jandex;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.AccessType;
import org.hibernate.internal.util.collections.CollectionHelper;
import org.hibernate.metamodel.source.internal.annotations.util.JPADotNames;
import org.hibernate.metamodel.source.internal.jaxb.JaxbIndex;
import org.hibernate.metamodel.source.internal.jaxb.JaxbUniqueConstraint;
import org.jboss.jandex.AnnotationInstance;
import org.jboss.jandex.AnnotationTarget;
import org.jboss.jandex.AnnotationValue;

View File

@ -162,7 +162,15 @@ public abstract class AnnotationMocker extends AbstractMocker {
if ( column == null ) {
return null;
}
// TODO: Not sure if this should be here...
List<AnnotationValue> annotationValueList = new ArrayList<AnnotationValue>();
MockHelper.stringValue( "forColumn", column.getName(), annotationValueList );
MockHelper.stringValue( "read", column.getRead(), annotationValueList );
MockHelper.stringValue( "write", column.getWrite(), annotationValueList );
create( HibernateDotNames.COLUMN_TRANSFORMER, target, annotationValueList );
annotationValueList = new ArrayList<AnnotationValue>();
MockHelper.stringValue( "name", column.getName(), annotationValueList );
MockHelper.stringValue( "columnDefinition", column.getColumnDefinition(), annotationValueList );
MockHelper.stringValue( "table", column.getTable(), annotationValueList );

View File

@ -59,6 +59,10 @@ public class AttributesBuilder extends AbstractAttributesBuilder {
@Override
protected void parse() {
if (getAttributesContainer() == null) {
return;
}
super.parse();
if ( attributes.getNaturalId() != null ) {

View File

@ -84,6 +84,7 @@ public class ElementCollectionMocker extends PropertyMocker {
parseMapKey( elementCollection.getMapKey(), getTarget() );
parseMapKeyColumn( elementCollection.getMapKeyColumn(), getTarget() );
parseMapKeyClass( elementCollection.getMapKeyClass(), getTarget() );
parseMapKeyType( elementCollection.getMapKeyType(), getTarget() );
parseMapKeyEnumerated( elementCollection.getMapKeyEnumerated(), getTarget() );
parseMapKeyTemporal( elementCollection.getMapKeyTemporal(), getTarget() );
}

View File

@ -23,6 +23,7 @@
*/
package org.hibernate.metamodel.source.internal.jandex;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -38,6 +39,7 @@ import org.hibernate.metamodel.source.internal.jaxb.JaxbCacheElement;
import org.hibernate.metamodel.source.internal.jaxb.JaxbDiscriminatorColumn;
import org.hibernate.metamodel.source.internal.jaxb.JaxbEntity;
import org.hibernate.metamodel.source.internal.jaxb.JaxbEntityListeners;
import org.hibernate.metamodel.source.internal.jaxb.JaxbHbmFilter;
import org.hibernate.metamodel.source.internal.jaxb.JaxbIdClass;
import org.hibernate.metamodel.source.internal.jaxb.JaxbInheritance;
import org.hibernate.metamodel.source.internal.jaxb.JaxbPostLoad;
@ -103,7 +105,13 @@ public class EntityMocker extends AbstractEntityObjectMocker {
parseSecondaryTableList( entity.getSecondaryTable(), getTarget() );
//@Cache
parseCache( entity.getCache() );
parseCache( entity.getCache(), getTarget() );
// @Filters
parseFilters( entity.getFilter(), getTarget() );
// @BatchSize
parseBatchSize( entity.getBatchSize(), getTarget() );
}
//@Table (entity only)
@ -295,7 +303,7 @@ public class EntityMocker extends AbstractEntityObjectMocker {
}
private void parseCache(JaxbCacheElement cache) {
private void parseCache(JaxbCacheElement cache, AnnotationTarget target) {
if ( cache == null ) {
return;
}
@ -304,6 +312,51 @@ public class EntityMocker extends AbstractEntityObjectMocker {
MockHelper.stringValue( "include", cache.getInclude(), annotationValueList );
MockHelper.enumValue( "usage", HibernateDotNames.CACHE_CONCURRENCY_STRATEGY,
CacheConcurrencyStrategy.parse( cache.getUsage() ), annotationValueList );
create( HibernateDotNames.CACHE, annotationValueList );
create( HibernateDotNames.CACHE, target, annotationValueList );
}
private void parseFilters(List<JaxbHbmFilter> filters, AnnotationTarget target) {
if (! filters.isEmpty() ) {
AnnotationValue[] filterAnnotations = new AnnotationValue[filters.size()];
int i = 0;
for ( JaxbHbmFilter filter : filters ) {
List<AnnotationValue> annotationValueList = new ArrayList<AnnotationValue>();
MockHelper.stringValue( "name", filter.getName(), annotationValueList );
String condition = "";
if (! StringHelper.isEmpty( filter.getConditionAttribute() )) {
condition = filter.getConditionAttribute();
}
for (Serializable contentElement : filter.getContent()) {
if ( String.class.isInstance( contentElement ) ) {
String s = (String) contentElement;
condition = s.trim();
}
// TODO: Could be aliases -- see xsd
}
MockHelper.stringValue( "condition", condition, annotationValueList );
AnnotationInstance annotationInstance = create(
HibernateDotNames.FILTER, null, annotationValueList );
filterAnnotations[i++] = MockHelper.nestedAnnotationValue( "", annotationInstance );
}
List<AnnotationValue> annotationValueList = new ArrayList<AnnotationValue>();
MockHelper.addToCollectionIfNotNull( annotationValueList,
AnnotationValue.createArrayValue( "value", filterAnnotations ) );
create( HibernateDotNames.FILTERS, target, annotationValueList );
}
}
private void parseBatchSize(Integer batchSize, AnnotationTarget target) {
if ( batchSize == null ) {
return;
}
List<AnnotationValue> annotationValueList = new ArrayList<AnnotationValue>();
MockHelper.integerValue( "size", batchSize, annotationValueList );
create( HibernateDotNames.BATCH_SIZE, target, annotationValueList );
}
}

View File

@ -27,8 +27,14 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.hibernate.annotations.FetchMode;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.internal.util.collections.CollectionHelper;
import org.hibernate.metamodel.source.internal.annotations.util.HibernateDotNames;
import org.hibernate.metamodel.source.internal.jaxb.JaxbHbmFilterDef;
import org.hibernate.metamodel.source.internal.jaxb.JaxbHbmFetchProfile.JaxbFetch;
import org.hibernate.metamodel.source.internal.jaxb.JaxbHbmFilterDef.JaxbFilterParam;
import org.hibernate.metamodel.source.internal.jaxb.JaxbHbmFetchProfile;
import org.hibernate.metamodel.source.internal.jaxb.JaxbNamedNativeQuery;
import org.hibernate.metamodel.source.internal.jaxb.JaxbNamedQuery;
import org.hibernate.metamodel.source.internal.jaxb.JaxbQueryHint;
@ -39,6 +45,7 @@ import org.hibernate.metamodel.source.internal.jaxb.JaxbSqlResultSetMappingEntit
import org.hibernate.metamodel.source.internal.jaxb.JaxbSqlResultSetMappingFieldResult;
import org.hibernate.metamodel.source.internal.jaxb.JaxbTableGenerator;
import org.jboss.jandex.AnnotationInstance;
import org.jboss.jandex.AnnotationTarget;
import org.jboss.jandex.AnnotationValue;
/**
@ -73,6 +80,12 @@ public class GlobalAnnotationMocker extends AbstractMocker {
if ( !globalAnnotations.getSqlResultSetMappingMap().isEmpty() ) {
parseSqlResultSetMappings( globalAnnotations.getSqlResultSetMappingMap().values() );
}
if ( !globalAnnotations.getFilterDefMap().isEmpty() ) {
parseFilterDefs( globalAnnotations.getFilterDefMap().values() );
}
if ( !globalAnnotations.getFetchProfileMap().isEmpty() ) {
parseFetchProfiles( globalAnnotations.getFetchProfileMap().values() );
}
indexBuilder.finishGlobalConfigurationMocking( globalAnnotations );
}
@ -309,6 +322,100 @@ public class GlobalAnnotationMocker extends AbstractMocker {
);
}
private void parseFilterDefs(Collection<JaxbHbmFilterDef> filterDefs) {
if (! filterDefs.isEmpty() ) {
AnnotationValue[] filterDefAnnotations = new AnnotationValue[filterDefs.size()];
int i = 0;
for ( JaxbHbmFilterDef filterDef : filterDefs ) {
List<AnnotationValue> annotationValueList = new ArrayList<AnnotationValue>();
MockHelper.stringValue( "name", filterDef.getName(), annotationValueList );
MockHelper.stringValue( "defaultCondition", filterDef.getCondition(), annotationValueList );
nestedFilterParams( filterDef.getFilterParam(), annotationValueList );
AnnotationInstance annotationInstance = create(
HibernateDotNames.FILTER_DEF, null, annotationValueList );
filterDefAnnotations[i++] = MockHelper.nestedAnnotationValue( "", annotationInstance );
}
List<AnnotationValue> annotationValueList = new ArrayList<AnnotationValue>();
MockHelper.addToCollectionIfNotNull( annotationValueList,
AnnotationValue.createArrayValue( "value", filterDefAnnotations ) );
create( HibernateDotNames.FILTER_DEFS, null, annotationValueList );
}
}
private void nestedFilterParams(List<JaxbFilterParam> filterParams, List<AnnotationValue> annotationValueList) {
if (! filterParams.isEmpty() ) {
AnnotationValue[] filterParamAnnotations = new AnnotationValue[filterParams.size()];
int i = 0;
for ( JaxbFilterParam filterParam : filterParams ) {
List<AnnotationValue> filterParamannotationValueList = new ArrayList<AnnotationValue>();
MockHelper.stringValue( "name", filterParam.getName(), filterParamannotationValueList );
MockHelper.stringValue( "type", filterParam.getType(), filterParamannotationValueList );
AnnotationInstance annotationInstance = create(
HibernateDotNames.PARAM_DEF, null, filterParamannotationValueList );
filterParamAnnotations[i++] = MockHelper.nestedAnnotationValue( "", annotationInstance );
}
MockHelper.addToCollectionIfNotNull( annotationValueList,
AnnotationValue.createArrayValue( "parameters", filterParamAnnotations ) );
}
}
private void parseFetchProfiles(Collection<JaxbHbmFetchProfile> fetchProfiles) {
if (! fetchProfiles.isEmpty() ) {
AnnotationValue[] fetchProfileAnnotations = new AnnotationValue[fetchProfiles.size()];
int i = 0;
for ( JaxbHbmFetchProfile fetchProfile : fetchProfiles ) {
AnnotationInstance annotationInstance = parseFetchProfile( fetchProfile );
fetchProfileAnnotations[i++] = MockHelper.nestedAnnotationValue( "", annotationInstance );
}
List<AnnotationValue> annotationValueList = new ArrayList<AnnotationValue>();
MockHelper.addToCollectionIfNotNull( annotationValueList,
AnnotationValue.createArrayValue( "value", fetchProfileAnnotations ) );
create( HibernateDotNames.FETCH_PROFILES, null, annotationValueList );
}
}
private AnnotationInstance parseFetchProfile(JaxbHbmFetchProfile fetchProfile) {
List<AnnotationValue> annotationValueList = new ArrayList<AnnotationValue>();
MockHelper.stringValue( "name", fetchProfile.getName(), annotationValueList );
AnnotationValue[] fetchAnnotations = new AnnotationValue[fetchProfile.getFetch().size()];
int i = 0;
for ( JaxbFetch fetch : fetchProfile.getFetch() ) {
List<AnnotationValue> fetchAnnotationValueList = new ArrayList<AnnotationValue>();
MockHelper.stringValue( "association", fetch.getAssociation(), fetchAnnotationValueList );
MockHelper.classValue( "entity", fetch.getEntity(), fetchAnnotationValueList, getDefaults(),
indexBuilder.getServiceRegistry() );
MockHelper.enumValue( "mode", HibernateDotNames.FETCH_MODE, convertFetchMode( fetch.getStyle() ),
fetchAnnotationValueList );
AnnotationInstance annotationInstance = create(
HibernateDotNames.FETCH_OVERRIDE, null, fetchAnnotationValueList );
fetchAnnotations[i++] = MockHelper.nestedAnnotationValue( "", annotationInstance );
}
MockHelper.addToCollectionIfNotNull( annotationValueList,
AnnotationValue.createArrayValue( "fetchOverrides", fetchAnnotations ) );
return create(HibernateDotNames.FETCH_PROFILE, null, annotationValueList );
}
private FetchMode convertFetchMode(String fetchMode) {
if (fetchMode.equalsIgnoreCase( "join" )) {
return FetchMode.JOIN;
}
else if (fetchMode.equalsIgnoreCase( "subselect" )) {
return FetchMode.SUBSELECT;
}
else {
return FetchMode.SELECT;
}
}
@Override
protected AnnotationInstance push(AnnotationInstance annotationInstance) {

View File

@ -35,10 +35,14 @@ import org.hibernate.internal.CoreLogging;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.internal.util.collections.CollectionHelper;
import org.hibernate.metamodel.source.internal.annotations.util.HibernateDotNames;
import org.hibernate.metamodel.source.internal.annotations.util.JPADotNames;
import org.hibernate.metamodel.source.internal.jaxb.JaxbAttributes;
import org.hibernate.metamodel.source.internal.jaxb.JaxbEntity;
import org.hibernate.metamodel.source.internal.jaxb.JaxbEntityMappings;
import org.hibernate.metamodel.source.internal.jaxb.JaxbHbmFetchProfile;
import org.hibernate.metamodel.source.internal.jaxb.JaxbHbmFetchProfile.JaxbFetch;
import org.hibernate.metamodel.source.internal.jaxb.JaxbHbmFilterDef;
import org.hibernate.metamodel.source.internal.jaxb.JaxbId;
import org.hibernate.metamodel.source.internal.jaxb.JaxbNamedNativeQuery;
import org.hibernate.metamodel.source.internal.jaxb.JaxbNamedQuery;
@ -47,7 +51,6 @@ import org.hibernate.metamodel.source.internal.jaxb.JaxbSqlResultSetMapping;
import org.hibernate.metamodel.source.internal.jaxb.JaxbTableGenerator;
import org.hibernate.metamodel.source.internal.jaxb.SchemaAware;
import org.hibernate.metamodel.source.spi.MappingException;
import org.jboss.jandex.AnnotationInstance;
import org.jboss.jandex.AnnotationValue;
import org.jboss.jandex.DotName;
@ -55,6 +58,7 @@ import org.jboss.jandex.DotName;
/**
* @author Strong Liu
*/
// TODO: Much of this class is unnecessary -- use simple lists and let duplication be checked later on?
public class GlobalAnnotations implements JPADotNames {
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( GlobalAnnotations.class );
@ -65,6 +69,8 @@ public class GlobalAnnotations implements JPADotNames {
private final Map<String, JaxbSqlResultSetMapping> sqlResultSetMappingMap = new HashMap<String, JaxbSqlResultSetMapping>();
private final Map<DotName, List<AnnotationInstance>> annotationInstanceMap = new HashMap<DotName, List<AnnotationInstance>>();
private final List<AnnotationInstance> indexedAnnotationInstanceList = new ArrayList<AnnotationInstance>();
private final Map<String, JaxbHbmFilterDef> filterDefMap = new HashMap<String, JaxbHbmFilterDef>();
private final Map<String, JaxbHbmFetchProfile> fetchProfileMap = new HashMap<String, JaxbHbmFetchProfile>();
//---------------------------
private final Set<String> defaultNamedNativeQueryNames = new HashSet<String>();
private final Set<String> defaultNamedQueryNames = new HashSet<String>();
@ -103,7 +109,9 @@ public class GlobalAnnotations implements JPADotNames {
&& namedNativeQueryMap.isEmpty()
&& sequenceGeneratorMap.isEmpty()
&& tableGeneratorMap.isEmpty()
&& sqlResultSetMappingMap.isEmpty() );
&& sqlResultSetMappingMap.isEmpty()
&& filterDefMap.isEmpty()
&& fetchProfileMap.isEmpty() );
}
Map<String, JaxbNamedNativeQuery> getNamedNativeQueryMap() {
@ -126,6 +134,14 @@ public class GlobalAnnotations implements JPADotNames {
return tableGeneratorMap;
}
Map<String, JaxbHbmFilterDef> getFilterDefMap() {
return filterDefMap;
}
Map<String, JaxbHbmFetchProfile> getFetchProfileMap() {
return fetchProfileMap;
}
public void filterIndexedAnnotations() {
for ( AnnotationInstance annotationInstance : indexedAnnotationInstanceList ) {
@ -150,7 +166,9 @@ public class GlobalAnnotations implements JPADotNames {
( annName.equals( SEQUENCE_GENERATOR ) && !sequenceGeneratorMap.containsKey( name ) ) ||
( annName.equals( NAMED_QUERY ) && !namedQueryMap.containsKey( name ) ) ||
( annName.equals( NAMED_NATIVE_QUERY ) && !namedNativeQueryMap.containsKey( name ) ) ||
( annName.equals( SQL_RESULT_SET_MAPPING ) && !sqlResultSetMappingMap.containsKey( name ) );
( annName.equals( SQL_RESULT_SET_MAPPING ) && !sqlResultSetMappingMap.containsKey( name ) ) ||
( annName.equals( HibernateDotNames.FILTER_DEF ) && !filterDefMap.containsKey( name ) ) ||
( annName.equals( HibernateDotNames.FETCH_PROFILE ) && !fetchProfileMap.containsKey( name ) );
}
}
if ( isNotExist ) {
@ -179,6 +197,14 @@ public class GlobalAnnotations implements JPADotNames {
put( sqlResultSetMapping );
defaultSqlResultSetMappingNames.add( sqlResultSetMapping.getName() );
}
for ( JaxbHbmFilterDef filterDef : entityMappings.getFilterDef() ) {
if (filterDef != null) {
filterDefMap.put( filterDef.getName(), filterDef );
}
}
for ( JaxbHbmFetchProfile fetchProfile : entityMappings.getFetchProfile() ) {
put( fetchProfile, entityMappings.getPackage(), null );
}
}
void collectGlobalMappings(JaxbEntity entity, Default defaults) {
@ -228,6 +254,10 @@ public class GlobalAnnotations implements JPADotNames {
}
}
}
for (JaxbHbmFetchProfile fetchProfile : entity.getFetchProfile()) {
put( fetchProfile, defaults.getPackageName(), entity.getClazz() );
}
}
/**
@ -290,4 +320,14 @@ public class GlobalAnnotations implements JPADotNames {
}
}
}
public void put(JaxbHbmFetchProfile fetchProfile, String packageName, String defaultClassName) {
if (fetchProfile != null) {
for (JaxbFetch fetch : fetchProfile.getFetch()) {
String entityName = StringHelper.isEmpty( fetch.getEntity() ) ? defaultClassName : fetch.getEntity();
fetch.setEntity( MockHelper.buildSafeClassName( entityName, packageName ) );
}
fetchProfileMap.put( fetchProfile.getName(), fetchProfile );
}
}
}

View File

@ -62,6 +62,12 @@ public class ManyToManyMocker extends PropertyMocker {
MockHelper.stringValue( "hbmKey", manyToMany.getHbmKey(), annotationValueList );
create( HibernateDotNames.INVERSE, getTarget(), annotationValueList );
}
if (manyToMany.getHbmFetchMode() != null) {
List<AnnotationValue> annotationValueList = new ArrayList<AnnotationValue>();
MockHelper.enumValue( "value", HibernateDotNames.FETCH_MODE, manyToMany.getHbmFetchMode(),
annotationValueList );
create( HibernateDotNames.FETCH, getTarget(), annotationValueList );
}
List<AnnotationValue> annotationValueList = new ArrayList<AnnotationValue>();
MockHelper.classValue( "targetEntity", manyToMany.getTargetEntity(), annotationValueList, getDefaults(),
indexBuilder.getServiceRegistry() );

View File

@ -26,9 +26,10 @@ package org.hibernate.metamodel.source.internal.jandex;
import java.util.ArrayList;
import java.util.List;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.metamodel.source.internal.annotations.util.HibernateDotNames;
import org.hibernate.metamodel.source.internal.jaxb.JaxbManyToOne;
import org.hibernate.metamodel.source.internal.jaxb.PersistentAttribute;
import org.jboss.jandex.AnnotationValue;
import org.jboss.jandex.ClassInfo;
@ -51,12 +52,14 @@ public class ManyToOneMocker extends PropertyMocker {
@Override
protected void doProcess() {
List<AnnotationValue> annotationValueList = new ArrayList<AnnotationValue>();
MockHelper.classValue( "targetEntity", manyToOne.getTargetEntity(), annotationValueList, getDefaults(),
indexBuilder.getServiceRegistry() );
MockHelper.classValue( "targetEntity",
StringHelper.qualifyIfNot( getDefaults().getPackageName(), manyToOne.getTargetEntity() ),
annotationValueList, getDefaults(), indexBuilder.getServiceRegistry() );
MockHelper.enumValue( "fetch", FETCH_TYPE, manyToOne.getFetch(), annotationValueList );
MockHelper.booleanValue( "optional", manyToOne.isOptional(), annotationValueList );
MockHelper.cascadeValue( "cascade", manyToOne.getCascade(), isDefaultCascadePersist(), annotationValueList );
create( MANY_TO_ONE, annotationValueList );
parseJoinColumnList( manyToOne.getJoinColumn(), getTarget() );
parseJoinTable( manyToOne.getJoinTable(), getTarget() );
if ( manyToOne.getMapsId() != null ) {
@ -65,5 +68,9 @@ public class ManyToOneMocker extends PropertyMocker {
if ( manyToOne.isId() != null && manyToOne.isId() ) {
create( ID );
}
annotationValueList = new ArrayList<AnnotationValue>();
MockHelper.cascadeValue( "value", manyToOne.getHbmCascade(), annotationValueList );
create( HibernateDotNames.CASCADE, getTarget(), annotationValueList );
}
}

View File

@ -43,9 +43,9 @@ import org.hibernate.internal.util.collections.CollectionHelper;
import org.hibernate.metamodel.source.internal.annotations.util.JPADotNames;
import org.hibernate.metamodel.source.internal.jaxb.JaxbCacheModeType;
import org.hibernate.metamodel.source.internal.jaxb.JaxbCascadeType;
import org.hibernate.metamodel.source.internal.jaxb.JaxbEmptyType;
import org.hibernate.metamodel.source.internal.jaxb.JaxbHbmCascadeType;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.type.ArrayType;
import org.hibernate.type.BagType;
import org.hibernate.type.ListType;
import org.hibernate.type.MapType;
@ -232,6 +232,7 @@ public class MockHelper {
addIfNotNull( cascadeType.getCascadeSaveUpdate(), enumList , org.hibernate.annotations.CascadeType.SAVE_UPDATE );
addIfNotNull( cascadeType.getCascadeReplicate(), enumList , org.hibernate.annotations.CascadeType.REPLICATE );
addIfNotNull( cascadeType.getCascadeLock(), enumList , org.hibernate.annotations.CascadeType.LOCK );
addIfNotNull( cascadeType.getCascadeDelete(), enumList , org.hibernate.annotations.CascadeType.DELETE );
}
if ( !enumList.isEmpty() ) {
MockHelper.enumArrayValue( name, JPADotNames.CASCADE_TYPE, enumList, annotationValueList );
@ -545,6 +546,9 @@ public class MockHelper {
if (collectionTypeName.equalsIgnoreCase( "map" )) {
collectionTypeName = MapType.class.getName();
}
if (collectionTypeName.equalsIgnoreCase( "array" )) {
collectionTypeName = ArrayType.class.getName();
}
return collectionTypeName;
}
}

View File

@ -57,10 +57,16 @@ public class OneToManyMocker extends PropertyMocker {
MockHelper.stringValue( "type", collectionTypeName, annotationValueList );
create( HibernateDotNames.COLLECTION_TYPE, annotationValueList );
}
if (oneToMany.isInverse()) {
if (oneToMany.isInverse() != null && oneToMany.isInverse()) {
List<AnnotationValue> annotationValueList = new ArrayList<AnnotationValue>();
create( HibernateDotNames.INVERSE, getTarget(), annotationValueList );
}
if (oneToMany.getHbmFetchMode() != null) {
List<AnnotationValue> annotationValueList = new ArrayList<AnnotationValue>();
MockHelper.enumValue( "value", HibernateDotNames.FETCH_MODE, oneToMany.getHbmFetchMode(),
annotationValueList );
create( HibernateDotNames.FETCH, getTarget(), annotationValueList );
}
List<AnnotationValue> annotationValueList = new ArrayList<AnnotationValue>();
MockHelper.classValue( "targetEntity", oneToMany.getTargetEntity(), annotationValueList, getDefaults(),
indexBuilder.getServiceRegistry() );
@ -80,6 +86,7 @@ public class OneToManyMocker extends PropertyMocker {
parseJoinColumnList( oneToMany.getJoinColumn(), getTarget() );
parseOrderColumn( oneToMany.getOrderColumn(), getTarget() );
parseJoinTable( oneToMany.getJoinTable(), getTarget() );
parseOnDelete( oneToMany.getOnDelete(), getTarget() );
if ( oneToMany.getOrderBy() != null ) {
create( ORDER_BY, getTarget(), MockHelper.stringValueArray( "value", oneToMany.getOrderBy() ) );
}

View File

@ -31,6 +31,7 @@ import javax.persistence.EnumType;
import javax.persistence.TemporalType;
import org.hibernate.HibernateException;
import org.hibernate.annotations.OnDeleteAction;
import org.hibernate.internal.util.collections.CollectionHelper;
import org.hibernate.metamodel.source.internal.annotations.util.HibernateDotNames;
import org.hibernate.metamodel.source.internal.jaxb.JaxbHbmType;
@ -38,6 +39,7 @@ import org.hibernate.metamodel.source.internal.jaxb.JaxbMapKey;
import org.hibernate.metamodel.source.internal.jaxb.JaxbMapKeyClass;
import org.hibernate.metamodel.source.internal.jaxb.JaxbMapKeyColumn;
import org.hibernate.metamodel.source.internal.jaxb.JaxbMapKeyJoinColumn;
import org.hibernate.metamodel.source.internal.jaxb.JaxbOnDeleteType;
import org.hibernate.metamodel.source.internal.jaxb.PersistentAttribute;
import org.jboss.jandex.AnnotationInstance;
import org.jboss.jandex.AnnotationTarget;
@ -264,8 +266,26 @@ public abstract class PropertyMocker extends AnnotationMocker {
//@Type
protected AnnotationInstance parseType(String name, AnnotationTarget target) {
List<AnnotationValue> typeAnnotationValueList = new ArrayList<AnnotationValue>();
MockHelper.stringValue( "type", name, typeAnnotationValueList );
return create( HibernateDotNames.TYPE, target, typeAnnotationValueList );
List<AnnotationValue> annotationValueList = new ArrayList<AnnotationValue>();
MockHelper.stringValue( "type", name, annotationValueList );
return create( HibernateDotNames.TYPE, target, annotationValueList );
}
//@OnDelete
protected void parseOnDelete(JaxbOnDeleteType onDelete, AnnotationTarget target) {
if (onDelete != null) {
List<AnnotationValue> annotationValueList = new ArrayList<AnnotationValue>();
OnDeleteAction action;
switch (onDelete) {
case CASCADE:
action = OnDeleteAction.CASCADE;
break;
default:
action = OnDeleteAction.NO_ACTION;
}
MockHelper.enumValue( "action", DotName.createSimple( OnDeleteAction.class.getName() ), action,
annotationValueList );
create( HibernateDotNames.ON_DELETE, target, annotationValueList );
}
}
}

View File

@ -29,11 +29,19 @@ import javax.persistence.EnumType;
import javax.persistence.TemporalType;
/**
* Common interface for JAXB bindings that represent persistent attributes supporting Map collection types.
* Common interface for JAXB bindings that represent persistent collection attributes.
*
* @author Brett Meyer
*/
public interface MapAttribute {
public interface CollectionAttribute extends FetchableAttribute {
public String getOrderBy();
public void setOrderBy(String value);
public JaxbOrderColumn getOrderColumn();
public void setOrderColumn(JaxbOrderColumn value);
public JaxbMapKey getMapKey();

View File

@ -0,0 +1,44 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2014, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.source.internal.jaxb;
import javax.persistence.FetchType;
import org.hibernate.annotations.FetchMode;
/**
* Common interface for JAXB bindings that represent attributes with laziness and fetch style.
*
* @author Brett Meyer
*/
public interface FetchableAttribute {
public FetchType getFetch();
public void setFetch(FetchType value);
public FetchMode getHbmFetchMode();
public void setHbmFetchMode(FetchMode value);
}

View File

@ -0,0 +1,41 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2014, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.source.internal.jaxb.marshalling;
import org.hibernate.annotations.FetchMode;
/**
* Marshalling support for dealing with Hibernate FetchMode enums. Plugged into JAXB for binding
*
* @author Brett Meyer
*/
public class FetchModeMarshalling {
public static FetchMode fromXml(String name) {
return FetchMode.valueOf( name );
}
public static String toXml(FetchMode fetchMode) {
return fetchMode.name();
}
}

View File

@ -173,7 +173,7 @@ public abstract class AbstractPropertyMapping implements PropertyMapping {
final String[] formulaTemplates,
final Mapping factory)
throws MappingException {
if ( columns.length != type.getColumnSpan(factory) ) {
throw new MappingException(
"broken column mapping [" + getEntityName() + '#' + path

View File

@ -498,6 +498,20 @@
<xsd:element name="cascade-lock" type="orm:emptyType" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<!-- **************************************************** -->
<xsd:simpleType name="on-delete-type">
<xsd:annotation>
<xsd:documentation>
org.hibernate.annotations.OnDeleteAction enum values
</xsd:documentation>
</xsd:annotation>
<xsd:restriction base="xsd:token">
<xsd:enumeration value="NO_ACTION"/>
<xsd:enumeration value="CASCADE"/>
</xsd:restriction>
</xsd:simpleType>
<!-- **************************************************** -->
@ -702,6 +716,7 @@
<xsd:attribute name="name" type="xsd:string" use="required"/>
<xsd:attribute name="target-class" type="xsd:string"/>
<xsd:attribute name="fetch" type="orm:fetch-type"/>
<xsd:attribute name="hbm-fetch-mode" type="orm:hbm-fetch-mode"/>
<xsd:attribute name="access" type="orm:access-type"/>
<xsd:attribute name="attribute-accessor" type="xsd:string" />
</xsd:complexType>
@ -1024,6 +1039,22 @@
</xsd:simpleType>
<!-- **************************************************** -->
<xsd:simpleType name="hbm-fetch-mode">
<xsd:annotation>
<xsd:documentation>
org.hibernate.annotations.FetchMode enum values
</xsd:documentation>
</xsd:annotation>
<xsd:restriction base="xsd:token">
<xsd:enumeration value="SELECT"/>
<xsd:enumeration value="JOIN"/>
<xsd:enumeration value="SUBSELECT"/>
</xsd:restriction>
</xsd:simpleType>
<!-- **************************************************** -->
<xsd:simpleType name="flush-mode-type">
@ -1357,11 +1388,13 @@
<xsd:attribute name="name" type="xsd:string" use="required"/>
<xsd:attribute name="target-entity" type="xsd:string"/>
<xsd:attribute name="fetch" type="orm:fetch-type"/>
<xsd:attribute name="hbm-fetch-mode" type="orm:hbm-fetch-mode"/>
<xsd:attribute name="access" type="orm:access-type"/>
<xsd:attribute name="attribute-accessor" type="xsd:string" />
<xsd:attribute name="mapped-by" type="xsd:string"/>
<xsd:attribute name="inverse" type="xsd:boolean"/> <!-- DEPRECATED -->
<xsd:attribute name="hbmKey" type="xsd:string"/> <!-- DEPRECATED (needed to carry the inverse side's <key> -->
<xsd:attribute name="hbm-key" type="xsd:string"/> <!-- DEPRECATED (needed to carry the inverse side's <key> -->
<xsd:attribute name="orphan-removal" type="xsd:boolean"/>
</xsd:complexType>
@ -1386,11 +1419,13 @@
</xsd:choice>
<xsd:element name="cascade" type="orm:cascade-type" minOccurs="0"/>
<xsd:element name="hbm-cascade" type="orm:hbm-cascade-type" minOccurs="0"/>
<xsd:element name="on-delete" type="orm:on-delete-type" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required"/>
<xsd:attribute name="target-entity" type="xsd:string"/>
<xsd:attribute name="fetch" type="orm:fetch-type"/>
<xsd:attribute name="hbm-fetch-mode" type="orm:hbm-fetch-mode"/>
<xsd:attribute name="optional" type="xsd:boolean"/>
<xsd:attribute name="access" type="orm:access-type"/>
<xsd:attribute name="attribute-accessor" type="xsd:string" />
@ -1736,12 +1771,14 @@
</xsd:choice>
<xsd:element name="cascade" type="orm:cascade-type" minOccurs="0"/>
<xsd:element name="hbm-cascade" type="orm:hbm-cascade-type" minOccurs="0"/>
<xsd:element name="on-delete" type="orm:on-delete-type" minOccurs="0"/>
<xsd:element name="collection-type" minOccurs="0" type="orm:hbm-type"/>
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required"/>
<xsd:attribute name="target-entity" type="xsd:string"/>
<xsd:attribute name="fetch" type="orm:fetch-type"/>
<xsd:attribute name="hbm-fetch-mode" type="orm:hbm-fetch-mode"/>
<xsd:attribute name="access" type="orm:access-type"/>
<xsd:attribute name="attribute-accessor" type="xsd:string" />
<xsd:attribute name="mapped-by" type="xsd:string"/>
@ -1778,6 +1815,7 @@
<xsd:attribute name="name" type="xsd:string" use="required"/>
<xsd:attribute name="target-entity" type="xsd:string"/>
<xsd:attribute name="fetch" type="orm:fetch-type"/>
<xsd:attribute name="hbm-fetch-mode" type="orm:hbm-fetch-mode"/>
<xsd:attribute name="optional" type="xsd:boolean"/>
<xsd:attribute name="access" type="orm:access-type"/>
<xsd:attribute name="attribute-accessor" type="xsd:string" />
@ -2333,6 +2371,7 @@
<xsd:attribute name="name" use="required" type="xsd:string"/>
<xsd:attribute name="autoAliasInjection" type="xsd:boolean"/>
<xsd:attribute name="conditionAttribute" type="xsd:string"/>
</xsd:complexType>

View File

@ -41,6 +41,12 @@
printMethod="org.hibernate.metamodel.source.internal.jaxb.marshalling.FetchTypeMarshalling.toXml" />
</bindings>
<bindings node="//xsd:simpleType[@name='hbm-fetch-mode']">
<javaType name="org.hibernate.annotations.FetchMode"
parseMethod="org.hibernate.metamodel.source.internal.jaxb.marshalling.FetchModeMarshalling.fromXml"
printMethod="org.hibernate.metamodel.source.internal.jaxb.marshalling.FetchModeMarshalling.toXml" />
</bindings>
<bindings node="//xsd:simpleType[@name='flush-mode-type']">
<javaType name="org.hibernate.FlushMode"
parseMethod="org.hibernate.metamodel.source.internal.jaxb.marshalling.FlushModeMarshalling.fromXml"
@ -148,13 +154,15 @@
</bindings>
<bindings node="//xsd:complexType[@name='many-to-one']">
<inheritance:implements>org.hibernate.metamodel.source.internal.jaxb.PersistentAttribute</inheritance:implements>
<inheritance:implements>org.hibernate.metamodel.source.internal.jaxb.FetchableAttribute</inheritance:implements>
</bindings>
<bindings node="//xsd:complexType[@name='one-to-many']">
<inheritance:implements>org.hibernate.metamodel.source.internal.jaxb.PersistentAttribute</inheritance:implements>
<inheritance:implements>org.hibernate.metamodel.source.internal.jaxb.MapAttribute</inheritance:implements>
<inheritance:implements>org.hibernate.metamodel.source.internal.jaxb.CollectionAttribute</inheritance:implements>
</bindings>
<bindings node="//xsd:complexType[@name='one-to-one']">
<inheritance:implements>org.hibernate.metamodel.source.internal.jaxb.PersistentAttribute</inheritance:implements>
<inheritance:implements>org.hibernate.metamodel.source.internal.jaxb.FetchableAttribute</inheritance:implements>
</bindings>
<bindings node="//xsd:complexType[@name='embedded-id']">
<inheritance:implements>org.hibernate.metamodel.source.internal.jaxb.PersistentAttribute</inheritance:implements>
@ -164,11 +172,11 @@
</bindings>
<bindings node="//xsd:complexType[@name='many-to-many']">
<inheritance:implements>org.hibernate.metamodel.source.internal.jaxb.PersistentAttribute</inheritance:implements>
<inheritance:implements>org.hibernate.metamodel.source.internal.jaxb.MapAttribute</inheritance:implements>
<inheritance:implements>org.hibernate.metamodel.source.internal.jaxb.CollectionAttribute</inheritance:implements>
</bindings>
<bindings node="//xsd:complexType[@name='element-collection']">
<inheritance:implements>org.hibernate.metamodel.source.internal.jaxb.PersistentAttribute</inheritance:implements>
<inheritance:implements>org.hibernate.metamodel.source.internal.jaxb.MapAttribute</inheritance:implements>
<inheritance:implements>org.hibernate.metamodel.source.internal.jaxb.CollectionAttribute</inheritance:implements>
</bindings>
<bindings node="//xsd:complexType[@name='any']">
<inheritance:implements>org.hibernate.metamodel.source.internal.jaxb.PersistentAttribute</inheritance:implements>

View File

@ -32,6 +32,7 @@ import org.hibernate.metamodel.MetadataSources;
import org.hibernate.metamodel.internal.MetadataImpl;
import org.hibernate.metamodel.spi.relational.Column;
import org.hibernate.metamodel.spi.relational.Identifier;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseUnitTestCase;
import org.junit.After;
@ -41,6 +42,7 @@ import org.junit.Test;
/**
* @author Gail Badner
*/
@FailureExpectedWithNewUnifiedXsd(message = "extra lazy not yet supported in the unified schema")
public class UnidirectionalManyToManyBindingTests extends BaseUnitTestCase {
private StandardServiceRegistryImpl serviceRegistry;

View File

@ -27,6 +27,7 @@ import org.junit.Test;
import org.hibernate.metamodel.MetadataSources;
import org.hibernate.metamodel.internal.MetadataImpl;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import static org.junit.Assert.assertEquals;
@ -35,6 +36,7 @@ import static org.junit.Assert.assertEquals;
*
* @author Gail Badner
*/
@FailureExpectedWithNewUnifiedXsd(message = "timestamps")
public class UnsavedValueHbmTests extends AbstractUnsavedValueTests {
@Test

View File

@ -24,10 +24,12 @@
package org.hibernate.metamodel.spi.binding.basiccollections;
import org.hibernate.metamodel.MetadataSources;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
/**
* @author Hardy Ferentschik
*/
@FailureExpectedWithNewUnifiedXsd(message = "extra lazy")
public class HbmBasicCollectionBindingTests extends AbstractBasicCollectionBindingTests {
public void addSources(MetadataSources sources) {
sources.addResource( "org/hibernate/metamodel/spi/binding/basiccollections/EntityWithBasicCollections.hbm.xml" );

View File

@ -24,10 +24,12 @@
package org.hibernate.metamodel.spi.binding.onetomany;
import org.hibernate.metamodel.MetadataSources;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
/**
* @author Hardy Ferentschik
*/
@FailureExpectedWithNewUnifiedXsd(message = "extra lazy not yet supported in the unified schema")
public class HbmUnidirectionalOneToManyBindingTests extends AbstractUnidirectionalOneToManyBindingTests {
@Override
public void addSources(MetadataSources sources) {

View File

@ -27,6 +27,7 @@ import org.hibernate.boot.registry.BootstrapServiceRegistryBuilder;
import org.hibernate.metamodel.MetadataSources;
import org.hibernate.metamodel.source.spi.InvalidMappingException;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.junit.Test;
@ -34,6 +35,7 @@ import org.junit.Test;
import static org.junit.Assert.fail;
@TestForIssue(jiraKey = "HHH-6271")
@FailureExpectedWithNewUnifiedXsd
public class NonExistentOrmVersionTest extends BaseCoreFunctionalTestCase {
@Test
public void testNonExistentOrmVersion() {

View File

@ -23,17 +23,18 @@
*/
package org.hibernate.test.annotations.xml.hbm;
import org.junit.Test;
import org.hibernate.Session;
import org.hibernate.testing.DialectChecks;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.RequiresDialectFeature;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.junit.Test;
/**
* @author Emmanuel Bernard
*/
@RequiresDialectFeature(DialectChecks.SupportsIdentityColumns.class)
@FailureExpectedWithNewUnifiedXsd(message = "proxy attributes")
public class HbmWithIdentityTest extends BaseCoreFunctionalTestCase {
@Test
public void testManyToOneAndInterface() throws Exception {

View File

@ -35,6 +35,7 @@ import org.hibernate.cfg.AvailableSettings;
import org.hibernate.cfg.Configuration;
import org.hibernate.loader.BatchFetchStyle;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import static org.junit.Assert.assertEquals;
@ -44,6 +45,7 @@ import static org.junit.Assert.assertTrue;
/**
* @author Gavin King
*/
@FailureExpectedWithNewUnifiedXsd(message = "New schema only defines batch-size at the class level, not collections.")
public class BatchFetchTest extends BaseCoreFunctionalTestCase {
@Override
public String[] getMappings() {

View File

@ -40,12 +40,14 @@ import org.hibernate.Transaction;
import org.hibernate.engine.query.spi.HQLQueryPlan;
import org.hibernate.exception.SQLGrammarException;
import org.hibernate.hql.spi.QueryTranslator;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.junit.Test;
/**
* @author Gavin King
*/
@FailureExpectedWithNewUnifiedXsd(message = "MultipleBagFetchException")
public class CompositeIdTest extends BaseCoreFunctionalTestCase {
@Override
public String[] getMappings() {

View File

@ -22,12 +22,13 @@
* Boston, MA 02110-1301 USA
*/
package org.hibernate.test.component.basic;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.junit.Test;
import org.hibernate.Hibernate;
import org.hibernate.Session;
import org.hibernate.Transaction;
@ -43,17 +44,17 @@ import org.hibernate.mapping.Component;
import org.hibernate.mapping.Formula;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.testing.FailureExpected;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.RequiresDialect;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.hibernate.type.StandardBasicTypes;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import org.junit.Test;
/**
* @author Gavin King
*/
@FailureExpectedWithNewUnifiedXsd(message = "timestamps")
public class ComponentTest extends BaseCoreFunctionalTestCase {
@Override
public String[] getMappings() {
@ -172,6 +173,7 @@ public class ComponentTest extends BaseCoreFunctionalTestCase {
}
@Test
@FailureExpectedWithNewUnifiedXsd
public void testComponentQueries() {
Session s = openSession();
Transaction t = s.beginTransaction();

View File

@ -22,9 +22,12 @@
* Boston, MA 02110-1301 USA
*/
package org.hibernate.test.fetchprofiles.join;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import org.junit.Test;
import java.util.List;
import org.hibernate.Hibernate;
import org.hibernate.Session;
@ -32,18 +35,16 @@ import org.hibernate.UnknownProfileException;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import org.junit.Test;
/**
* Various tests related to join-style fetch profiles.
*
* @author Steve Ebersole
*/
@FailureExpectedWithNewUnifiedXsd(message = "appears using component.field as the association path is failing")
public class JoinFetchProfileTest extends BaseCoreFunctionalTestCase {
public String[] getMappings() {
return new String[] { "fetchprofiles/join/Mappings.hbm.xml" };

View File

@ -49,11 +49,10 @@ import org.hibernate.dialect.SybaseASE15Dialect;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.persister.collection.CollectionPersister;
import org.hibernate.transform.DistinctRootEntityResultTransformer;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.SkipForDialect;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.junit.Test;
import org.jboss.logging.Logger;
import static org.junit.Assert.assertEquals;
@ -66,6 +65,7 @@ import static org.junit.Assert.assertTrue;
*
* @author Steve Ebersole
*/
@FailureExpectedWithNewUnifiedXsd( message = "<filter> within a collection not supported by schema" )
@SkipForDialect( value = SybaseASE15Dialect.class, jiraKey = "HHH-3637")
public class DynamicFilterTest extends BaseCoreFunctionalTestCase {
private static final Logger log = Logger.getLogger( DynamicFilterTest.class );

View File

@ -25,6 +25,7 @@ package org.hibernate.test.filter.hql;
import java.util.Date;
import org.hibernate.dialect.CUBRIDDialect;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.SkipForDialect;
import org.junit.Test;
@ -41,6 +42,7 @@ import static org.junit.Assert.assertEquals;
comment = "As of verion 8.4.1 CUBRID doesn't support temporary tables. This test fails with" +
"HibernateException: cannot doAfterTransactionCompletion multi-table deletes using dialect not supporting temp tables"
)
@FailureExpectedWithNewUnifiedXsd(message = "joined subclass not getting columns defined by superclass")
public class JoinedFilteredBulkManipulationTest extends BaseCoreFunctionalTestCase {
public String[] getMappings() {
return new String[] {

View File

@ -28,7 +28,6 @@ import java.util.Map;
import java.util.Set;
import org.junit.Test;
import org.hibernate.Hibernate;
import org.hibernate.Session;
import org.hibernate.Transaction;
@ -36,6 +35,7 @@ import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
import org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory;
import org.hibernate.testing.FailureExpected;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import static org.junit.Assert.assertEquals;
@ -46,6 +46,7 @@ import static org.junit.Assert.assertTrue;
*
* @author Gail Badner
*/
@FailureExpectedWithNewUnifiedXsd(message = "hbm joins not yet supported")
public class ASTParserLoadingOrderByTest extends BaseCoreFunctionalTestCase {
StateProvince stateProvince;
private Zoo zoo1;

View File

@ -30,7 +30,6 @@ import java.util.Collections;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.criterion.Projections;
@ -40,6 +39,7 @@ import org.hibernate.hql.internal.ast.tree.SelectClause;
import org.hibernate.hql.internal.classic.ClassicQueryTranslatorFactory;
import org.hibernate.hql.spi.QueryTranslator;
import org.hibernate.hql.spi.QueryTranslatorFactory;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.TestForIssue;
import org.hibernate.type.BigDecimalType;
import org.hibernate.type.BigIntegerType;
@ -55,6 +55,7 @@ import static org.junit.Assert.fail;
*
* @author Max Rydahl Andersen
*/
@FailureExpectedWithNewUnifiedXsd(message = "hbm joins not yet supported")
public class CriteriaHQLAlignmentTest extends QueryTranslatorTestCase {
private boolean initialVersion2SqlFlagValue;

View File

@ -39,6 +39,7 @@ import org.hibernate.dialect.AbstractHANADialect;
import org.hibernate.dialect.SybaseASE15Dialect;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.testing.DialectChecks;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.RequiresDialectFeature;
import org.hibernate.testing.SkipForDialect;
import org.hibernate.testing.SkipForDialects;
@ -51,6 +52,7 @@ import org.junit.Test;
*
* @author Steve Ebersole
*/
@FailureExpectedWithNewUnifiedXsd(message = "hbm joins not yet supported")
public class ScrollableCollectionFetchingTest extends BaseCoreFunctionalTestCase {
public String[] getMappings() {
return new String[] { "hql/Animal.hbm.xml" };

View File

@ -37,6 +37,7 @@ import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.hql.internal.ast.InvalidWithClauseException;
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.junit.Test;
@ -46,6 +47,7 @@ import org.junit.Test;
*
* @author Steve Ebersole
*/
@FailureExpectedWithNewUnifiedXsd(message = "hbm joins not yet supported")
public class WithClauseTest extends BaseCoreFunctionalTestCase {
public String[] getMappings() {
return new String[] { "hql/Animal.hbm.xml", "hql/SimpleEntityWithAssociation.hbm.xml" };

View File

@ -29,6 +29,7 @@ import org.hibernate.Session;
import org.hibernate.id.IdentifierGeneratorHelper.BasicHolder;
import org.hibernate.id.enhanced.SequenceStyleGenerator;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
@ -76,6 +77,7 @@ public class BasicSequenceTest extends BaseCoreFunctionalTestCase {
@Test
@TestForIssue(jiraKey = "HHH-6790")
@FailureExpectedWithNewUnifiedXsd(message = "multiple mappings of the same class/table")
public void testSequencePerEntity() {
final String overriddenEntityName = "SpecialEntity";
EntityPersister persister = sessionFactory().getEntityPersister( overriddenEntityName );

View File

@ -24,9 +24,9 @@
package org.hibernate.test.immutable.entitywithmutablecollection.inverse;
import org.hibernate.dialect.CUBRIDDialect;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.SkipForDialect;
import org.junit.Test;
import org.hibernate.test.immutable.entitywithmutablecollection.AbstractEntityWithOneToManyTest;
import org.hibernate.testing.FailureExpected;
@ -38,6 +38,7 @@ import org.hibernate.testing.FailureExpected;
comment = "As of verion 8.4.1 CUBRID doesn't support temporary tables. This test fails with" +
"HibernateException: cannot doAfterTransactionCompletion multi-table deletes using dialect not supporting temp tables"
)
@FailureExpectedWithNewUnifiedXsd(message = "hbm joins not yet supported")
public class VersionedEntityWithInverseOneToManyJoinFailureExpectedTest extends AbstractEntityWithOneToManyTest {
public String[] getMappings() {
return new String[] { "immutable/entitywithmutablecollection/inverse/ContractVariationVersionedOneToManyJoin.hbm.xml" };

View File

@ -24,10 +24,12 @@
package org.hibernate.test.immutable.entitywithmutablecollection.noninverse;
import org.hibernate.test.immutable.entitywithmutablecollection.AbstractEntityWithManyToManyTest;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
/**
* @author Gail Badner
*/
@FailureExpectedWithNewUnifiedXsd(message = "mapping looks off -- shouldn't Contract#parties be inverse?")
public class EntityWithNonInverseManyToManyTest extends AbstractEntityWithManyToManyTest {
@Override
public String[] getMappings() {

View File

@ -25,6 +25,7 @@ package org.hibernate.test.immutable.entitywithmutablecollection.noninverse;
import org.hibernate.dialect.CUBRIDDialect;
import org.hibernate.test.immutable.entitywithmutablecollection.AbstractEntityWithOneToManyTest;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.SkipForDialect;
/**
@ -35,6 +36,7 @@ import org.hibernate.testing.SkipForDialect;
comment = "As of verion 8.4.1 CUBRID doesn't support temporary tables. This test fails with" +
"HibernateException: cannot doAfterTransactionCompletion multi-table deletes using dialect not supporting temp tables"
)
@FailureExpectedWithNewUnifiedXsd(message = "hbm joins not yet supported")
public class EntityWithNonInverseOneToManyJoinTest extends AbstractEntityWithOneToManyTest {
public String[] getMappings() {
return new String[] { "immutable/entitywithmutablecollection/noninverse/ContractVariationOneToManyJoin.hbm.xml" };

View File

@ -24,10 +24,12 @@
package org.hibernate.test.immutable.entitywithmutablecollection.noninverse;
import org.hibernate.test.immutable.entitywithmutablecollection.AbstractEntityWithOneToManyTest;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
/**
* @author Gail Badner
*/
@FailureExpectedWithNewUnifiedXsd(message = "mapping looks off -- shouldn't Contract#parties be inverse?")
public class EntityWithNonInverseOneToManyTest extends AbstractEntityWithOneToManyTest {
public String[] getMappings() {
return new String[] { "immutable/entitywithmutablecollection/noninverse/ContractVariation.hbm.xml" };

View File

@ -24,10 +24,12 @@
package org.hibernate.test.immutable.entitywithmutablecollection.noninverse;
import org.hibernate.test.immutable.entitywithmutablecollection.AbstractEntityWithManyToManyTest;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
/**
* @author Gail Badner
*/
@FailureExpectedWithNewUnifiedXsd(message = "mapping looks off -- shouldn't Contract#parties be inverse?")
public class VersionedEntityWithNonInverseManyToManyTest extends AbstractEntityWithManyToManyTest {
@Override
public String[] getMappings() {

View File

@ -25,6 +25,7 @@ package org.hibernate.test.immutable.entitywithmutablecollection.noninverse;
import org.hibernate.dialect.CUBRIDDialect;
import org.hibernate.test.immutable.entitywithmutablecollection.AbstractEntityWithOneToManyTest;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.SkipForDialect;
/**
@ -35,6 +36,7 @@ import org.hibernate.testing.SkipForDialect;
comment = "As of verion 8.4.1 CUBRID doesn't support temporary tables. This test fails with" +
"HibernateException: cannot doAfterTransactionCompletion multi-table deletes using dialect not supporting temp tables"
)
@FailureExpectedWithNewUnifiedXsd(message = "hbm joins not yet supported")
public class VersionedEntityWithNonInverseOneToManyJoinTest extends AbstractEntityWithOneToManyTest {
public String[] getMappings() {
return new String[] { "immutable/entitywithmutablecollection/noninverse/ContractVariationVersionedOneToManyJoin.hbm.xml" };

View File

@ -24,10 +24,12 @@
package org.hibernate.test.immutable.entitywithmutablecollection.noninverse;
import org.hibernate.test.immutable.entitywithmutablecollection.AbstractEntityWithOneToManyTest;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
/**
* @author Gail Badner
*/
@FailureExpectedWithNewUnifiedXsd(message = "mapping looks off -- shouldn't Contract#parties be inverse?")
public class VersionedEntityWithNonInverseOneToManyTest extends AbstractEntityWithOneToManyTest {
public String[] getMappings() {
return new String[] { "immutable/entitywithmutablecollection/noninverse/ContractVariationVersioned.hbm.xml" };

View File

@ -35,6 +35,7 @@ import org.hibernate.Interceptor;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.TransactionException;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.hibernate.type.Type;
@ -50,6 +51,7 @@ import static org.junit.Assert.fail;
* @author Gavin King
* @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com)
*/
@FailureExpectedWithNewUnifiedXsd(message = "select-before-update")
public class InterceptorTest extends BaseCoreFunctionalTestCase {
@Override
public String[] getMappings() {

View File

@ -28,6 +28,7 @@ import org.junit.Test;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.testing.DialectChecks;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.RequiresDialectFeature;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
@ -55,6 +56,7 @@ public class InterfaceProxyTest extends BaseCoreFunctionalTestCase {
value = DialectChecks.SupportsExpectedLobUsagePattern.class,
comment = "database/driver does not support expected LOB usage pattern"
)
@FailureExpectedWithNewUnifiedXsd(message = "proxy attributes")
public void testInterfaceProxies() {
Session s = openSession( new DocumentInterceptor() );
Transaction t = s.beginTransaction();

View File

@ -39,12 +39,14 @@ import org.hibernate.Transaction;
import org.hibernate.criterion.Restrictions;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.jdbc.AbstractWork;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.junit.Test;
/**
* @author Gavin King
*/
@FailureExpectedWithNewUnifiedXsd(message = "hbm joins not yet supported")
public class JoinTest extends BaseCoreFunctionalTestCase {
@Override
public String[] getMappings() {

View File

@ -23,20 +23,21 @@
*/
package org.hibernate.test.join;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import org.junit.Test;
import java.util.List;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import org.junit.Test;
/**
* @author Chris Jones and Gail Badner
*/
@FailureExpectedWithNewUnifiedXsd(message = "hbm joins not yet supported")
public class OptionalJoinTest extends BaseCoreFunctionalTestCase {
@Override
public String[] getMappings() {

View File

@ -25,11 +25,11 @@ package org.hibernate.test.jpa.fetch;
import java.util.Date;
import org.junit.Test;
import org.hibernate.Hibernate;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.test.jpa.AbstractJPATest;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@ -38,6 +38,7 @@ import static org.junit.Assert.assertTrue;
/**
* @author Emmanuel Bernard
*/
@FailureExpectedWithNewUnifiedXsd(message = "extra lazy not yet supported in the unified schema")
public class FetchingTest extends AbstractJPATest {
@Override
public String[] getMappings() {

View File

@ -29,6 +29,7 @@ import org.junit.Assert;
import org.junit.Test;
import org.hibernate.testing.DialectChecks;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.RequiresDialectFeature;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
@ -37,6 +38,7 @@ import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
* @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com)
*/
@RequiresDialectFeature(DialectChecks.SupportsCascadeDeleteCheck.class)
@FailureExpectedWithNewUnifiedXsd(message = "metamodel doesn't appear to be able to handle the composite-id key-many-to-one's on-delete (translated to @OnDelete)")
public class KeyManyToOneCascadeDeleteTest extends BaseCoreFunctionalTestCase {
@Override
public String[] getMappings() {

View File

@ -125,7 +125,7 @@ public class OneToOneCacheTest extends LegacyTestCase {
Serializable id = generatedId;
MainObject mo = ( MainObject ) session.load( MainObject.class, id );
MainObject mo = ( MainObject ) session.get( MainObject.class, id );
tx.commit();
session.close();

View File

@ -52,12 +52,14 @@ import org.hibernate.dialect.SybaseDialect;
import org.hibernate.dialect.TimesTenDialect;
import org.hibernate.dialect.function.SQLFunction;
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@FailureExpectedWithNewUnifiedXsd(message = "timestamps")
public class SQLFunctionsTest extends LegacyTestCase {
private static final Logger log = Logger.getLogger( SQLFunctionsTest.class );

View File

@ -33,8 +33,8 @@ import org.hibernate.loader.plan.spi.EntityReturn;
import org.hibernate.loader.plan.spi.FetchSource;
import org.hibernate.loader.plan.spi.LoadPlan;
import org.hibernate.persister.entity.OuterJoinLoadable;
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.junit4.BaseUnitTestCase;
import org.hibernate.test.annotations.Country;
import org.hibernate.test.annotations.cid.keymanytoone.Card;
@ -61,6 +61,7 @@ import static org.junit.Assert.assertTrue;
*
* @author Steve Ebersole
*/
@FailureExpectedWithNewUnifiedXsd(message = "one-to-one refers to entity-name")
public class LoadPlanStructureAssertionTest extends BaseUnitTestCase {
@Test
public void testJoinedOneToOne() {
@ -82,6 +83,7 @@ public class LoadPlanStructureAssertionTest extends BaseUnitTestCase {
}
@Test
@FailureExpectedWithNewUnifiedXsd(message = "formulas not yet supported in associations")
public void testSpecialOneToOne() {
// tests the mappings defined in org.hibernate.test.onetoone.joined.JoinedSubclassOneToOneTest

View File

@ -42,9 +42,8 @@ import org.hibernate.loader.plan.exec.spi.LoadQueryDetails;
import org.hibernate.loader.plan.spi.LoadPlan;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.type.Type;
import org.junit.Test;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.hibernate.test.onetoone.formula.Address;
import org.hibernate.test.onetoone.formula.Person;
@ -55,6 +54,7 @@ import static org.junit.Assert.assertNotNull;
/**
* @author Steve Ebersole
*/
@FailureExpectedWithNewUnifiedXsd(message = "formulas not yet supported in associations")
public class NonEncapsulatedCompositeIdResultSetProcessorTest extends BaseCoreFunctionalTestCase {
@Override

View File

@ -25,15 +25,15 @@ package org.hibernate.test.loadplans.walking;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.persister.walking.spi.MetamodelGraphWalker;
import org.junit.Test;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.hibernate.test.onetoone.formula.Address;
/**
* @author Steve Ebersole
*/
@FailureExpectedWithNewUnifiedXsd(message = "formulas not yet supported in associations")
public class KeyManyToOneWalkingTest extends BaseCoreFunctionalTestCase {
@Override
protected String[] getMappings() {

View File

@ -24,13 +24,13 @@
package org.hibernate.test.manytomany;
import org.junit.Test;
import org.hibernate.FetchMode;
import org.hibernate.Hibernate;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import static org.junit.Assert.assertEquals;
@ -40,6 +40,7 @@ import static org.junit.Assert.assertTrue;
/**
* @author Gavin King
*/
@FailureExpectedWithNewUnifiedXsd(message = "formulas not yet supported in associations")
public class ManyToManyTest extends BaseCoreFunctionalTestCase {
@Override
public String[] getMappings() {

View File

@ -23,8 +23,13 @@
*/
package org.hibernate.test.manytomany.batchload;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.List;
import junit.framework.Assert;
import org.hibernate.EmptyInterceptor;
import org.hibernate.Hibernate;
import org.hibernate.Interceptor;
@ -37,14 +42,9 @@ import org.hibernate.engine.jdbc.batch.spi.Batch;
import org.hibernate.engine.jdbc.batch.spi.BatchKey;
import org.hibernate.engine.jdbc.spi.JdbcCoordinator;
import org.hibernate.stat.CollectionStatistics;
import org.junit.Test;
import junit.framework.Assert;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
/**
* Tests loading of many-to-many collection which should trigger
@ -52,6 +52,7 @@ import static org.junit.Assert.assertTrue;
*
* @author Steve Ebersole
*/
@FailureExpectedWithNewUnifiedXsd(message = "New schema only defines batch-size at the class level, not collections.")
public class BatchedManyToManyTest extends BaseCoreFunctionalTestCase {
@Override
public String[] getMappings() {

View File

@ -23,6 +23,7 @@
*
*/
package org.hibernate.test.manytomanyassociationclass;
import java.io.Serializable;
/**

View File

@ -31,6 +31,7 @@ import org.hibernate.exception.ConstraintViolationException;
import org.hibernate.test.manytomanyassociationclass.AbstractManyToManyAssociationClassTest;
import org.hibernate.test.manytomanyassociationclass.Membership;
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import static org.junit.Assert.fail;
@ -39,6 +40,7 @@ import static org.junit.Assert.fail;
*
* @author Gail Badner
*/
@FailureExpectedWithNewUnifiedXsd(message = "mapping looks off: Membership and subclass have Serializable id, but mapping uses type=long")
public class ManyToManyAssociationClassGeneratedIdTest extends AbstractManyToManyAssociationClassTest {
@Override
public String[] getMappings() {

View File

@ -24,9 +24,9 @@
package org.hibernate.test.mapelemformula;
import org.junit.Test;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import static org.junit.Assert.assertEquals;
@ -34,6 +34,7 @@ import static org.junit.Assert.assertEquals;
/**
* @author Gavin King
*/
@FailureExpectedWithNewUnifiedXsd(message = "formulas not yet supported in associations")
public class MapElementFormulaTest extends BaseCoreFunctionalTestCase {
public String[] getMappings() {
return new String[] { "mapelemformula/UserGroup.hbm.xml" };

View File

@ -19,6 +19,7 @@ import org.hibernate.metamodel.source.spi.InvalidMappingException;
import org.hibernate.metamodel.source.spi.MappingNotFoundException;
import org.hibernate.xml.spi.SourceType;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.junit4.BaseUnitTestCase;
import org.junit.Test;
@ -34,6 +35,7 @@ import static org.junit.Assert.fail;
*/
public class MappingExceptionTest extends BaseUnitTestCase {
@Test
@FailureExpectedWithNewUnifiedXsd
public void testNotFound() throws MappingException, MalformedURLException {
Configuration cfg = new Configuration();

View File

@ -23,22 +23,23 @@
*/
package org.hibernate.test.mixed;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.dialect.SybaseASE15Dialect;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.SkipForDialect;
import org.hibernate.testing.SkipLog;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import org.junit.Test;
/**
* @author Gavin King
*/
@SkipForDialect( SybaseASE15Dialect.class )
@FailureExpectedWithNewUnifiedXsd(message = "multiple mappings of the same class/table")
public class MixedTest extends BaseCoreFunctionalTestCase {
@Override
public String[] getMappings() {

View File

@ -33,6 +33,7 @@ import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
import org.hibernate.stat.Statistics;
import org.hibernate.testing.DialectChecks;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.RequiresDialectFeature;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
@ -43,6 +44,7 @@ import static org.junit.Assert.assertTrue;
/**
* @author Gavin King
*/
@FailureExpectedWithNewUnifiedXsd
public class OnDeleteTest extends BaseCoreFunctionalTestCase {
@Override
public String[] getMappings() {

View File

@ -24,9 +24,9 @@
package org.hibernate.test.onetomany;
import org.hibernate.dialect.CUBRIDDialect;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.SkipForDialect;
import org.junit.Test;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
@ -36,6 +36,7 @@ import static org.junit.Assert.assertEquals;
/**
* @author Gavin King
*/
@FailureExpectedWithNewUnifiedXsd(message = "hbm joins not yet supported")
public class OneToManyTest extends BaseCoreFunctionalTestCase {
public String[] getMappings() {
return new String[] { "onetomany/Parent.hbm.xml" };

View File

@ -24,7 +24,6 @@
package org.hibernate.test.onetoone.formula;
import org.junit.Test;
import org.hibernate.FetchMode;
import org.hibernate.Hibernate;
import org.hibernate.Session;
@ -34,6 +33,7 @@ import org.hibernate.cfg.Environment;
import org.hibernate.criterion.Property;
import org.hibernate.dialect.Oracle8iDialect;
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.hibernate.type.AbstractSingleColumnStandardBasicType;
import org.hibernate.type.TextType;
@ -49,6 +49,7 @@ import static org.junit.Assert.assertTrue;
/**
* @author Gavin King
*/
@FailureExpectedWithNewUnifiedXsd(message = "formulas not yet supported in associations")
public class OneToOneFormulaTest extends BaseCoreFunctionalTestCase {
private static class TextAsMaterializedClobType extends AbstractSingleColumnStandardBasicType<String> {
public final static TextAsMaterializedClobType INSTANCE = new TextAsMaterializedClobType();

View File

@ -26,10 +26,10 @@ package org.hibernate.test.onetoone.link;
import java.util.Date;
import org.junit.Test;
import org.hibernate.Hibernate;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import static org.junit.Assert.assertEquals;
@ -41,6 +41,7 @@ import static org.junit.Assert.assertTrue;
/**
* @author Gavin King
*/
@FailureExpectedWithNewUnifiedXsd(message = "hbm joins not yet supported")
public class OneToOneLinkTest extends BaseCoreFunctionalTestCase {
@Override
public String[] getMappings() {

View File

@ -6,5 +6,4 @@ package org.hibernate.test.onetoone.optional;
*/
public class Person extends Entity {
public Address address;
public Address mailingAddress;
}

View File

@ -32,6 +32,7 @@ import org.hibernate.PersistentObjectException;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.exception.ConstraintViolationException;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@ -41,6 +42,7 @@ import static org.junit.Assert.fail;
/**
* @author Gavin King
*/
@FailureExpectedWithNewUnifiedXsd(message = "timestamps")
public class CreateTest extends AbstractOperationTestCase {
@Test
@SuppressWarnings( {"unchecked"})

View File

@ -26,10 +26,12 @@ package org.hibernate.test.ops;
import org.junit.Test;
import org.hibernate.Session;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
/**
* @author Steve Ebersole
*/
@FailureExpectedWithNewUnifiedXsd(message = "timestamps")
public class DeleteTest extends AbstractOperationTestCase {
@Test
@SuppressWarnings( {"unchecked"})

View File

@ -36,6 +36,7 @@ import org.hibernate.StaleObjectStateException;
import org.hibernate.Transaction;
import org.hibernate.criterion.Projections;
import org.hibernate.testing.FailureExpected;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@ -47,6 +48,7 @@ import static org.junit.Assert.fail;
/**
* @author Gavin King
*/
@FailureExpectedWithNewUnifiedXsd(message = "timestamps")
public class MergeTest extends AbstractOperationTestCase {
@Test
public void testMergeStaleVersionFails() throws Exception {

View File

@ -24,7 +24,7 @@
package org.hibernate.test.optlock;
import org.junit.Test;
import static org.junit.Assert.fail;
import org.hibernate.JDBCException;
import org.hibernate.Session;
@ -32,10 +32,10 @@ import org.hibernate.StaleObjectStateException;
import org.hibernate.StaleStateException;
import org.hibernate.dialect.SQLServerDialect;
import org.hibernate.testing.DialectChecks;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.RequiresDialectFeature;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import static org.junit.Assert.fail;
import org.junit.Test;
/**
* Tests relating to the optimistic-lock mapping option.
@ -47,6 +47,7 @@ import static org.junit.Assert.fail;
value = DialectChecks.DoesRepeatableReadNotCauseReadersToBlockWritersCheck.class,
comment = "potential deadlock"
)
@FailureExpectedWithNewUnifiedXsd(message = "multiple mappings of the same class/table")
public class OptimisticLockTest extends BaseCoreFunctionalTestCase {
@Override
public String[] getMappings() {

View File

@ -29,10 +29,12 @@ import java.util.List;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.junit.Test;
@FailureExpectedWithNewUnifiedXsd(message = "many-to-manys w/ orphan removal not yet supported")
public class ManyToManyOrphanTest extends BaseCoreFunctionalTestCase {
@Override

View File

@ -28,6 +28,7 @@ import java.util.List;
import org.junit.Test;
import org.hibernate.Session;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
@ -38,6 +39,7 @@ import static org.junit.Assert.assertNull;
/**
* @author Steve Ebersole
*/
@FailureExpectedWithNewUnifiedXsd(message = "m2o with orphan removal")
public class DeleteOneToOneOrphansTest extends BaseCoreFunctionalTestCase {
@Override
public String[] getMappings() {

View File

@ -30,6 +30,7 @@ import static org.junit.Assert.assertNull;
import java.util.List;
import org.hibernate.Session;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.junit.Test;
@ -37,6 +38,7 @@ import org.junit.Test;
/**
* @author Steve Ebersole
*/
@FailureExpectedWithNewUnifiedXsd(message = "m2o with orphan removal")
public class DeleteOneToOneOrphansTest extends BaseCoreFunctionalTestCase {
public String[] getMappings() {
return new String[] { "orphan/one2one/fk/reversed/unidirectional/Mapping.hbm.xml" };

View File

@ -24,9 +24,9 @@
package org.hibernate.test.readonly;
import org.junit.Test;
import org.hibernate.Session;
import org.hibernate.testing.FailureExpected;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@ -36,6 +36,7 @@ import static org.junit.Assert.assertSame;
/**
* @author Gail Badner
*/
@FailureExpectedWithNewUnifiedXsd(message = "statistics are failing")
public class ReadOnlyVersionedNodesTest extends AbstractReadOnlyTest {
@Override
public String[] getMappings() {

View File

@ -26,26 +26,26 @@
*/
package org.hibernate.test.resulttransformer;
import java.sql.ResultSet;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.ScrollableResults;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.dialect.AbstractHANADialect;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.hibernate.transform.ResultTransformer;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
/**
* @author Sharath Reddy
*/
@FailureExpectedWithNewUnifiedXsd(message = "named query return-join")
public class ResultTransformerTest extends BaseCoreFunctionalTestCase {
@Override
public String[] getMappings() {

View File

@ -31,6 +31,7 @@ import org.hibernate.ScrollMode;
import org.hibernate.ScrollableResults;
import org.hibernate.StatelessSession;
import org.hibernate.Transaction;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import static org.junit.Assert.assertEquals;
@ -40,6 +41,7 @@ import static org.junit.Assert.assertNotSame;
/**
* @author Gavin King
*/
@FailureExpectedWithNewUnifiedXsd(message = "timestamps")
public class StatelessSessionTest extends BaseCoreFunctionalTestCase {
public String[] getMappings() {
return new String[] { "stateless/Document.hbm.xml" };

View File

@ -36,6 +36,7 @@ import org.hibernate.cfg.Configuration;
import org.hibernate.stat.QueryStatistics;
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.junit4.BaseUnitTestCase;
import org.junit.Test;
@ -48,6 +49,7 @@ import static org.junit.Assert.assertNotNull;
*
* @author Emmanuel Bernard
*/
@FailureExpectedWithNewUnifiedXsd(message = "What does <import> translate to in annotations?")
public class StatsTest extends BaseUnitTestCase {
public String[] getMappings() {
return new String[] { "stats/Continent.hbm.xml" };

View File

@ -29,9 +29,9 @@ import java.util.Iterator;
import java.util.List;
import org.junit.Test;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import static org.junit.Assert.assertEquals;
@ -39,6 +39,7 @@ import static org.junit.Assert.assertEquals;
/**
* @author Steve Ebersole
*/
@FailureExpectedWithNewUnifiedXsd( message = "<filter> within a collection not supported by schema" )
public class DiscrimSubclassFilterTest extends BaseCoreFunctionalTestCase {
public final String[] getMappings() {
return new String[] { "subclassfilter/discrim-subclass.hbm.xml" };

View File

@ -29,6 +29,7 @@ import java.util.Iterator;
import java.util.List;
import org.hibernate.dialect.CUBRIDDialect;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.SkipForDialect;
import org.junit.Test;
@ -46,6 +47,7 @@ import static org.junit.Assert.assertEquals;
comment = "As of verion 8.4.1 CUBRID doesn't support temporary tables. This test fails with" +
"HibernateException: cannot doAfterTransactionCompletion multi-table deletes using dialect not supporting temp tables"
)
@FailureExpectedWithNewUnifiedXsd(message = "single filter used across joined-subclasses")
public class JoinedSubclassFilterTest extends BaseCoreFunctionalTestCase {
public final String[] getMappings() {
return new String[] { "subclassfilter/joined-subclass.hbm.xml" };

View File

@ -31,6 +31,7 @@ import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import static org.junit.Assert.assertEquals;
@ -38,6 +39,7 @@ import static org.junit.Assert.assertEquals;
/**
* @author Gavin King
*/
@FailureExpectedWithNewUnifiedXsd(message = "timestamps")
public class TimestampTest extends BaseCoreFunctionalTestCase {
public String[] getMappings() {
return new String[] { "timestamp/User.hbm.xml" };

View File

@ -26,11 +26,11 @@ package org.hibernate.test.typedmanytoone;
import java.util.List;
import org.junit.Test;
import org.hibernate.Hibernate;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import static org.junit.Assert.assertEquals;
@ -41,6 +41,7 @@ import static org.junit.Assert.assertTrue;
/**
* @author Gavin King
*/
@FailureExpectedWithNewUnifiedXsd(message = "formulas not yet supported in associations")
public class TypedManyToOneTest extends BaseCoreFunctionalTestCase {
public String[] getMappings() {
return new String[] { "typedmanytoone/Customer.hbm.xml" };

View File

@ -35,6 +35,7 @@ import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.jdbc.Work;
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.junit.Test;
@ -43,6 +44,7 @@ import org.junit.Test;
*
* @author Michael Gloegl
*/
@FailureExpectedWithNewMetamodel
public class TypeParameterTest extends BaseCoreFunctionalTestCase {
public String[] getMappings() {
return new String[] {

View File

@ -32,12 +32,14 @@ import org.hibernate.Hibernate;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.criterion.Restrictions;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.junit.Test;
/**
* @author Gavin King
*/
@FailureExpectedWithNewUnifiedXsd(message = "formulas not yet supported in associations")
public class UnconstrainedTest extends BaseCoreFunctionalTestCase {
@Override
public String[] getMappings() {

View File

@ -23,9 +23,13 @@
*/
package org.hibernate.test.unionsubclass;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import java.util.List;
import org.hibernate.FetchMode;
import org.hibernate.Hibernate;
@ -33,18 +37,15 @@ import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.criterion.Order;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
/**
* @author Gavin King
*/
@SuppressWarnings("unchecked")
@FailureExpectedWithNewUnifiedXsd(message = "no support for JaxbInheritanceType.UNION_SUBCLASS")
public class UnionSubclassTest extends BaseCoreFunctionalTestCase {
@Override
public String[] getMappings() {

View File

@ -23,21 +23,22 @@
*/
package org.hibernate.test.unionsubclass.alias;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import org.junit.Test;
/**
* @author Strong Liu <stliu@redhat.com>
*/
@TestForIssue( jiraKey = "HHH-4825" )
@FailureExpectedWithNewUnifiedXsd(message = "no support for JaxbInheritanceType.UNION_SUBCLASS")
public class SellCarTest extends BaseCoreFunctionalTestCase {
public String[] getMappings() {
return new String[] { "unionsubclass/alias/mapping.hbm.xml" };

View File

@ -23,27 +23,28 @@
*/
package org.hibernate.test.unionsubclass2;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import java.math.BigDecimal;
import java.util.List;
import org.junit.Test;
import org.hibernate.Hibernate;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.criterion.Property;
import org.hibernate.criterion.Restrictions;
import org.hibernate.dialect.HSQLDialect;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
/**
* @author Gavin King
*/
@FailureExpectedWithNewUnifiedXsd(message = "no support for JaxbInheritanceType.UNION_SUBCLASS")
public class UnionSubclassTest extends BaseCoreFunctionalTestCase {
protected String[] getMappings() {
return new String[] { "unionsubclass2/Person.hbm.xml" };

View File

@ -23,16 +23,16 @@
*/
package org.hibernate.test.version;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.hibernate.Hibernate;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
/**
* @author Max Rydahl Andersen
@ -74,6 +74,7 @@ public class VersionTest extends BaseCoreFunctionalTestCase {
}
@Test
@FailureExpectedWithNewUnifiedXsd
public void testCollectionVersion() {
Session s = openSession();
Transaction t = s.beginTransaction();

View File

@ -29,6 +29,7 @@ import org.junit.Test;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.hibernate.type.StandardBasicTypes;
@ -38,6 +39,7 @@ import static org.junit.Assert.assertTrue;
/**
* @author Steve Ebersole
*/
@FailureExpectedWithNewUnifiedXsd(message = "New schema only defines batch-size at the class level, not collections.")
public class DbVersionTest extends BaseCoreFunctionalTestCase {
@Override
public String[] getMappings() {

View File

@ -28,6 +28,7 @@ import org.junit.Test;
import org.hibernate.FetchMode;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import static org.junit.Assert.assertEquals;
@ -35,6 +36,7 @@ import static org.junit.Assert.assertEquals;
/**
* @author Max Rydahl Andersen
*/
@FailureExpectedWithNewUnifiedXsd(message = "New schema only defines where at the class level, not collections.")
public class WhereTest extends BaseCoreFunctionalTestCase {
public String[] getMappings() {
return new String[] { "where/File.hbm.xml" };

View File

@ -26,6 +26,9 @@ package org.hibernate.envers.configuration.internal;
import java.sql.Date;
import java.util.Collection;
import org.dom4j.Document;
import org.dom4j.DocumentFactory;
import org.dom4j.Element;
import org.hibernate.MappingException;
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
import org.hibernate.envers.DefaultRevisionEntity;
@ -46,21 +49,17 @@ import org.hibernate.envers.internal.revisioninfo.RevisionInfoNumberReader;
import org.hibernate.envers.internal.revisioninfo.RevisionInfoQueryCreator;
import org.hibernate.envers.internal.tools.MutableBoolean;
import org.hibernate.envers.internal.tools.Tools;
import org.hibernate.internal.util.xml.XMLHelper;
import org.hibernate.metamodel.source.internal.annotations.util.JPADotNames;
import org.hibernate.metamodel.source.internal.annotations.util.JandexHelper;
import org.hibernate.metamodel.spi.AdditionalJaxbRootProducer.AdditionalJaxbRootProducerContext;
import org.hibernate.metamodel.spi.InFlightMetadataCollector;
import org.hibernate.metamodel.spi.binding.EntityBinding;
import org.hibernate.metamodel.spi.binding.AttributeBinding;
import org.hibernate.metamodel.spi.binding.EntityBinding;
import org.hibernate.metamodel.spi.binding.HibernateTypeDescriptor;
import org.hibernate.metamodel.spi.binding.SetBinding;
import org.hibernate.type.IntegerType;
import org.hibernate.type.LongType;
import org.hibernate.type.Type;
import org.dom4j.Document;
import org.dom4j.Element;
import org.jboss.jandex.AnnotationInstance;
import org.jboss.jandex.AnnotationTarget;
import org.jboss.jandex.ClassInfo;
@ -68,8 +67,6 @@ import org.jboss.jandex.FieldInfo;
import org.jboss.jandex.IndexView;
import org.jboss.jandex.MethodInfo;
import static org.hibernate.metamodel.spi.AdditionalJaxbRootProducer.AdditionalJaxbRootProducerContext;
/**
* @author Adam Warski (adam at warski dot org)
* @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com)
@ -102,7 +99,7 @@ public class RevisionInfoConfiguration {
}
private Document generateDefaultRevisionInfoXmlMapping() {
final Document document = XMLHelper.getDocumentFactory().createDocument();
final Document document = DocumentFactory.getInstance().createDocument();
final Element classMapping = MetadataTools.createEntity(
document,
@ -185,7 +182,7 @@ public class RevisionInfoConfiguration {
}
private Element generateRevisionInfoRelationMapping() {
final Document document = XMLHelper.getDocumentFactory().createDocument();
final Document document = DocumentFactory.getInstance().createDocument();
final Element revRelMapping = document.addElement( "key-many-to-one" );
// TODO: this does not belong here; does it belong somewhere else????
//revRelMapping.addAttribute( "type", revisionPropType );

View File

@ -1,28 +1,12 @@
package org.hibernate.envers.event.spi;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.jboss.jandex.AnnotationInstance;
import org.jboss.jandex.ClassInfo;
import org.jboss.jandex.DotName;
import org.jboss.jandex.IndexView;
import org.jboss.logging.Logger;
import org.hibernate.MappingException;
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
import org.hibernate.envers.configuration.internal.AnnotationProxyBuilder;
import org.hibernate.envers.configuration.internal.AuditEntitiesConfiguration;
@ -38,10 +22,14 @@ import org.hibernate.metamodel.spi.InFlightMetadataCollector;
import org.hibernate.metamodel.spi.binding.EntityBinding;
import org.hibernate.metamodel.spi.domain.Attribute;
import org.hibernate.metamodel.spi.domain.AttributeContainer;
import org.hibernate.xml.internal.jaxb.MappingXmlBinder;
import org.hibernate.xml.spi.BindResult;
import org.hibernate.xml.spi.Origin;
import org.hibernate.xml.spi.SourceType;
import org.jboss.jandex.AnnotationInstance;
import org.jboss.jandex.ClassInfo;
import org.jboss.jandex.DotName;
import org.jboss.jandex.IndexView;
import org.jboss.logging.Logger;
/**
* @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com)
@ -72,7 +60,6 @@ public class EnversJaxbRootProducer implements AdditionalJaxbRootProducer {
private final InFlightMetadataCollector metadataCollector;
private final AdditionalJaxbRootProducerContext additionalJaxbRootProducerContext;
private final AnnotationProxyBuilder annotationProxyBuilder = new AnnotationProxyBuilder();
private final MappingXmlBinder jaxbProcessor;
private final List<BindResult> bindResults = new ArrayList<BindResult>();
private final Origin origin = new Origin( SourceType.DOM, Origin.UNKNOWN_FILE_PATH );
private final GlobalConfiguration globalCfg;
@ -88,9 +75,6 @@ public class EnversJaxbRootProducer implements AdditionalJaxbRootProducer {
final RevisionInfoConfiguration revInfoCfg = new RevisionInfoConfiguration( globalCfg );
this.revInfoCfgResult = revInfoCfg.configure( metadataCollector, additionalJaxbRootProducerContext );
this.auditEntCfg = new AuditEntitiesConfiguration( additionalJaxbRootProducerContext.getServiceRegistry(), revInfoCfgResult.getRevisionInfoEntityName() );
jaxbProcessor = new MappingXmlBinder(
additionalJaxbRootProducerContext.getServiceRegistry()
);
}
@Override
@ -175,22 +159,7 @@ public class EnversJaxbRootProducer implements AdditionalJaxbRootProducer {
@Override
public void addDocument(org.w3c.dom.Document document) {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
Source xmlSource = new DOMSource( document );
Result outputTarget = new StreamResult( outputStream );
try {
TransformerFactory.newInstance().newTransformer().transform(xmlSource, outputTarget);
}
catch ( TransformerConfigurationException ex ){
throw new MappingException( ex );
}
catch ( TransformerException ex ) {
throw new MappingException( ex );
}
InputStream is = new ByteArrayInputStream(outputStream.toByteArray());
bindResults.add( jaxbProcessor.bind( is, origin ) );
// TODO
}
private List<BindResult> getBindResults() {