HHH-8893 HBM transform/mock

This commit is contained in:
Brett Meyer 2014-05-30 00:37:06 -04:00
parent 8ae122f584
commit bcda51da94
27 changed files with 252 additions and 201 deletions

View File

@ -77,22 +77,17 @@ public class EntityMocker extends AbstractEntityObjectMocker {
//@Entity
create( ENTITY, MockHelper.stringValueArray( "name", entity.getName() ) );
if ( entity.isCacheable() != null ) {
//@Cacheable
create(
CACHEABLE,
MockHelper.booleanValueArray( "value", entity.isCacheable() )
);
create( CACHEABLE, MockHelper.booleanValueArray( "value", entity.isCacheable() ) );
}
if ( StringHelper.isNotEmpty( entity.getDiscriminatorValue() ) ) {
//@DiscriminatorValue
create(
DISCRIMINATOR_VALUE,
MockHelper.stringValueArray( "value", entity.getDiscriminatorValue() )
);
create( DISCRIMINATOR_VALUE, MockHelper.stringValueArray( "value", entity.getDiscriminatorValue() ) );
}
if (entity.isSelectBeforeUpdate() != null) {
create( HibernateDotNames.SELECT_BEFORE_UPDATE, MockHelper.booleanValueArray(
"value", entity.isSelectBeforeUpdate() ) );
}
//@Table
@ -106,12 +101,12 @@ public class EntityMocker extends AbstractEntityObjectMocker {
//@Cache
parseCache( entity.getCache(), getTarget() );
// @Filters
parseFilters( entity.getFilter(), getTarget() );
// @BatchSize
parseBatchSize( entity.getBatchSize(), getTarget() );
// @Proxy
parseProxy( entity.getProxy(), entity.isLazy(), getTarget() );
}
//@Table (entity only)
@ -251,38 +246,25 @@ public class EntityMocker extends AbstractEntityObjectMocker {
}
//@SecondaryTable
protected AnnotationInstance parseSecondaryTable(JaxbSecondaryTable secondaryTable, AnnotationTarget target) {
if ( secondaryTable == null ) {
return null;
}
DefaultConfigurationHelper.INSTANCE.applyDefaults(secondaryTable,getDefaults());
List<AnnotationValue> annotationValueList = new ArrayList<AnnotationValue>();
MockHelper.stringValue( "name", secondaryTable.getName(), annotationValueList );
MockHelper.stringValue( "catalog", secondaryTable.getCatalog(), annotationValueList );
MockHelper.stringValue( "schema", secondaryTable.getSchema(), annotationValueList );
nestedPrimaryKeyJoinColumnList("pkJoinColumns", secondaryTable.getPrimaryKeyJoinColumn(), annotationValueList);
nestedUniqueConstraintList("uniqueConstraints", secondaryTable.getUniqueConstraint(), annotationValueList);
nestedIndexConstraintList( "indexes", secondaryTable.getIndex(), annotationValueList );
return create( SECONDARY_TABLE, target, annotationValueList );
}
protected AnnotationInstance parseSecondaryTableList(List<JaxbSecondaryTable> primaryKeyJoinColumnList, AnnotationTarget target) {
protected void parseSecondaryTableList(List<JaxbSecondaryTable> primaryKeyJoinColumnList, AnnotationTarget target) {
if ( CollectionHelper.isNotEmpty( primaryKeyJoinColumnList ) ) {
if ( primaryKeyJoinColumnList.size() == 1 ) {
return parseSecondaryTable( primaryKeyJoinColumnList.get( 0 ), target );
parseSecondaryTable( primaryKeyJoinColumnList.get( 0 ), target );
parseHibernateTable( primaryKeyJoinColumnList.get( 0 ), target );
}
else {
return create(
create(
SECONDARY_TABLES,
target,
nestedSecondaryTableList( "value", primaryKeyJoinColumnList, null )
);
create(
HibernateDotNames.TABLES,
target,
nestedHibernateTableList( "value", primaryKeyJoinColumnList, null )
);
}
}
return null;
}
protected AnnotationValue[] nestedSecondaryTableList(String name, List<JaxbSecondaryTable> secondaryTableList, List<AnnotationValue> annotationValueList) {
@ -300,7 +282,50 @@ public class EntityMocker extends AbstractEntityObjectMocker {
return values;
}
return MockHelper.EMPTY_ANNOTATION_VALUE_ARRAY;
}
protected AnnotationValue[] nestedHibernateTableList(String name, List<JaxbSecondaryTable> secondaryTableList, List<AnnotationValue> annotationValueList) {
if ( CollectionHelper.isNotEmpty( secondaryTableList ) ) {
AnnotationValue[] values = new AnnotationValue[secondaryTableList.size()];
for ( int i = 0; i < secondaryTableList.size(); i++ ) {
AnnotationInstance annotationInstance = parseHibernateTable( secondaryTableList.get( i ), null );
values[i] = MockHelper.nestedAnnotationValue(
"", annotationInstance
);
}
MockHelper.addToCollectionIfNotNull(
annotationValueList, AnnotationValue.createArrayValue( name, values )
);
return values;
}
return MockHelper.EMPTY_ANNOTATION_VALUE_ARRAY;
}
//@SecondaryTable
protected AnnotationInstance parseSecondaryTable(JaxbSecondaryTable secondaryTable, AnnotationTarget target) {
if ( secondaryTable == null ) {
return null;
}
DefaultConfigurationHelper.INSTANCE.applyDefaults(secondaryTable,getDefaults());
List<AnnotationValue> annotationValueList = new ArrayList<AnnotationValue>();
MockHelper.stringValue( "name", secondaryTable.getName(), annotationValueList );
MockHelper.stringValue( "catalog", secondaryTable.getCatalog(), annotationValueList );
MockHelper.stringValue( "schema", secondaryTable.getSchema(), annotationValueList );
nestedPrimaryKeyJoinColumnList("pkJoinColumns", secondaryTable.getPrimaryKeyJoinColumn(), annotationValueList);
nestedUniqueConstraintList("uniqueConstraints", secondaryTable.getUniqueConstraint(), annotationValueList);
nestedIndexConstraintList( "indexes", secondaryTable.getIndex(), annotationValueList );
return create( SECONDARY_TABLE, target, annotationValueList );
}
//Hibernate @Table
protected AnnotationInstance parseHibernateTable(JaxbSecondaryTable secondaryTable, AnnotationTarget target) {
if ( secondaryTable == null ) {
return null;
}
List<AnnotationValue> annotationValueList = new ArrayList<AnnotationValue>();
MockHelper.stringValue( "appliesTo", secondaryTable.getName(), annotationValueList );
MockHelper.booleanValue( "optional", secondaryTable.isOptional(), annotationValueList );
return create( HibernateDotNames.TABLE, target, annotationValueList );
}
private void parseCache(JaxbCacheElement cache, AnnotationTarget target) {
@ -359,4 +384,17 @@ public class EntityMocker extends AbstractEntityObjectMocker {
MockHelper.integerValue( "size", batchSize, annotationValueList );
create( HibernateDotNames.BATCH_SIZE, target, annotationValueList );
}
private void parseProxy(String proxy, Boolean isLazy, AnnotationTarget target) {
if ( StringHelper.isEmpty( proxy ) ) {
return;
}
List<AnnotationValue> annotationValueList = new ArrayList<AnnotationValue>();
MockHelper.classValue( "proxyClass", proxy, annotationValueList, getDefaults(),
indexBuilder.getServiceRegistry() );
if (isLazy != null) {
MockHelper.booleanValue( "lazy", isLazy, annotationValueList );
}
create( HibernateDotNames.PROXY, target, annotationValueList );
}
}

View File

@ -29,6 +29,7 @@ import java.util.Date;
import java.util.List;
import javax.persistence.FetchType;
import javax.persistence.TemporalType;
import javax.xml.bind.JAXBElement;
import org.hibernate.FlushMode;
@ -88,6 +89,7 @@ import org.hibernate.metamodel.source.internal.jaxb.JaxbOrderColumn;
import org.hibernate.metamodel.source.internal.jaxb.JaxbPersistenceUnitMetadata;
import org.hibernate.metamodel.source.internal.jaxb.JaxbPrimaryKeyJoinColumn;
import org.hibernate.metamodel.source.internal.jaxb.JaxbQueryParamType;
import org.hibernate.metamodel.source.internal.jaxb.JaxbSecondaryTable;
import org.hibernate.metamodel.source.internal.jaxb.JaxbSqlResultSetMapping;
import org.hibernate.metamodel.source.internal.jaxb.JaxbSqlResultSetMappingEntityResult;
import org.hibernate.metamodel.source.internal.jaxb.JaxbSqlResultSetMappingFieldResult;
@ -657,11 +659,6 @@ public class HbmXmlTransformer {
}
private void transferJoinedSubclass(JaxbJoinedSubclassElement hbmSubclass, JaxbEntity subclassEntity) {
if (! StringHelper.isEmpty( hbmSubclass.getProxy() )) {
// TODO
throw new MappingException( "HBM transformation: proxy attributes not yet supported" );
}
transferEntityElement( hbmSubclass, subclassEntity );
transferEntityElementAttributes( subclassEntity, hbmSubclass );
@ -941,35 +938,76 @@ public class HbmXmlTransformer {
}
private void transferVersion(JaxbEntity entity, JaxbClassElement hbmClass) {
if ( hbmClass.getOptimisticLock() == JaxbOptimisticLockAttribute.VERSION ) {
final JaxbVersionElement hbmVersion = hbmClass.getVersion();
if (hbmVersion != null) {
final JaxbVersion version = new JaxbVersion();
version.setName( hbmVersion.getName() );
// TODO: multiple columns?
if (! StringHelper.isEmpty( hbmVersion.getColumnAttribute() )) {
version.setColumn( new JaxbColumn() );
version.getColumn().setName( hbmVersion.getColumnAttribute() );
}
entity.getAttributes().getVersion().add( version );
// if ( hbmClass.getOptimisticLock() == JaxbOptimisticLockAttribute.VERSION ) {
final JaxbVersionElement hbmVersion = hbmClass.getVersion();
if (hbmVersion != null) {
final JaxbVersion version = new JaxbVersion();
version.setName( hbmVersion.getName() );
// TODO: multiple columns?
if (! StringHelper.isEmpty( hbmVersion.getColumnAttribute() )) {
version.setColumn( new JaxbColumn() );
version.getColumn().setName( hbmVersion.getColumnAttribute() );
}
// oddly the jpa xsd allows multiple <version/> elements?
entity.getAttributes().getVersion().add( version );
}
// }
}
private void transferTimestamp(JaxbEntity entity, JaxbClassElement hbmClass) {
final JaxbTimestampElement hbmTimestamp = hbmClass.getTimestamp();
if (hbmTimestamp != null) {
// TODO
throw new MappingException( "HBM transformation: HBM timestamps are not yet supported." );
final JaxbVersion version = new JaxbVersion();
version.setName( hbmTimestamp.getName() );
// TODO: multiple columns?
if (! StringHelper.isEmpty( hbmTimestamp.getColumnAttribute() )) {
version.setColumn( new JaxbColumn() );
version.getColumn().setName( hbmTimestamp.getColumnAttribute() );
}
version.setTemporal( TemporalType.TIMESTAMP );
entity.getAttributes().getVersion().add( version );
}
}
private void transferJoins(JaxbEntity entity, JaxbClassElement hbmClass) {
for ( JaxbJoinElement hbmJoin : hbmClass.getJoin() ) {
// TODO
throw new MappingException( "HBM transformation: HBM joins are not yet supported." );
if (! hbmJoin.isInverse()) {
final JaxbSecondaryTable secondaryTable = new JaxbSecondaryTable();
secondaryTable.setCatalog( hbmJoin.getCatalog() );
secondaryTable.setComment( hbmJoin.getComment() );
secondaryTable.setName( hbmJoin.getTable() );
secondaryTable.setSchema( hbmJoin.getSchema() );
secondaryTable.setOptional( hbmJoin.isOptional() );
if (hbmJoin.getKey() != null) {
final JaxbPrimaryKeyJoinColumn joinColumn = new JaxbPrimaryKeyJoinColumn();
// TODO: multiple columns?
joinColumn.setName( hbmJoin.getKey().getColumnAttribute() );
secondaryTable.getPrimaryKeyJoinColumn().add( joinColumn );
}
entity.getSecondaryTable().add( secondaryTable );
}
for (JaxbPropertyElement hbmProp : hbmJoin.getProperty()) {
final JaxbBasic prop = transferBasicAttribute( hbmProp );
for (Serializable columnOrFormula : prop.getColumnOrFormula()) {
if (columnOrFormula instanceof JaxbColumn) {
((JaxbColumn) columnOrFormula).setTable( hbmJoin.getTable() );
}
}
entity.getAttributes().getBasic().add( prop );
}
for (JaxbComponentElement hbmComp : hbmJoin.getComponent()) {
// TODO: Not sure how to handle this. Attribute overrides?
throw new MappingException( "HBM transformation: <component> within a <join> not yet supported." );
}
for (JaxbManyToOneElement hbmM2O : hbmJoin.getManyToOne()) {
final JaxbManyToOne m2o = transferManyToOneAttribute( hbmM2O );
final JaxbJoinTable joinTable = new JaxbJoinTable();
joinTable.setCatalog( hbmJoin.getCatalog() );
joinTable.setName( hbmJoin.getTable() );
joinTable.setSchema( hbmJoin.getSchema() );
m2o.setJoinTable( joinTable );
entity.getAttributes().getManyToOne().add( m2o );
}
}
}
@ -1061,6 +1099,19 @@ public class HbmXmlTransformer {
}
return embeddable;
}
private JaxbEmbeddable transferEmbeddable(JaxbEntity entity, JaxbCompositeElementElement hbmComponent) {
final JaxbEmbeddable embeddable = new JaxbEmbeddable();
embeddable.setClazz( hbmComponent.getClazz() );
embeddable.setAttributes( new JaxbEmbeddableAttributes() );
for (JaxbPropertyElement property : hbmComponent.getProperty()) {
embeddable.getAttributes().getBasic().add( transferBasicAttribute( property ) );
}
for (JaxbManyToOneElement manyToOne : hbmComponent.getManyToOne()) {
embeddable.getAttributes().getManyToOne().add( transferManyToOneAttribute( manyToOne ) );
}
return embeddable;
}
private JaxbEmbedded transferEmbeddedAttribute(JaxbComponentElement hbmComponent) {
final JaxbEmbedded embedded = new JaxbEmbedded();
@ -1295,7 +1346,7 @@ public class HbmXmlTransformer {
CollectionAttribute collection = null;
if (pluralAttribute.getElement() != null) {
final JaxbElementCollection elementCollection = transferElementCollection(
pluralAttribute, collectionTypeName, orderBy );
pluralAttribute, pluralAttribute.getElement(), collectionTypeName, orderBy );
entity.getAttributes().getElementCollection().add( elementCollection );
collection = elementCollection;
}
@ -1309,6 +1360,14 @@ public class HbmXmlTransformer {
entity.getAttributes().getManyToMany().add( m2m );
collection = m2m;
}
else if (pluralAttribute.getCompositeElement() != null) {
ormRoot.getEmbeddable().add( transferEmbeddable( entity, pluralAttribute.getCompositeElement() ) );
final JaxbElementCollection elementCollection = transferElementCollection(
pluralAttribute, pluralAttribute.getCompositeElement(), collectionTypeName, orderBy );
entity.getAttributes().getElementCollection().add( elementCollection );
collection = elementCollection;
}
if (collection != null) {
for (JaxbFilterElement hbmFilter : pluralAttribute.getFilter()) {
@ -1358,9 +1417,8 @@ public class HbmXmlTransformer {
}
}
private JaxbElementCollection transferElementCollection(
PluralAttributeElement pluralAttribute, String collectionTypeName, String orderBy) {
final JaxbElementElement hbmElement = pluralAttribute.getElement();
private JaxbElementCollection transferElementCollection(PluralAttributeElement pluralAttribute,
JaxbElementElement hbmElement, String collectionTypeName, String orderBy) {
final JaxbElementCollection element = new JaxbElementCollection();
element.setName( pluralAttribute.getName() );
final JaxbColumn column = new JaxbColumn();
@ -1376,6 +1434,20 @@ public class HbmXmlTransformer {
transferFetchable( pluralAttribute.getLazy(), pluralAttribute.getFetch(), pluralAttribute.getOuterJoin(), element );
return element;
}
private JaxbElementCollection transferElementCollection(PluralAttributeElement pluralAttribute,
JaxbCompositeElementElement hbmElement, String collectionTypeName, String orderBy) {
final JaxbElementCollection element = new JaxbElementCollection();
element.setName( pluralAttribute.getName() );
final JaxbHbmType collectionType = new JaxbHbmType();
collectionType.setName( collectionTypeName );
element.setCollectionType( collectionType );
element.setOrderBy( orderBy );
transferFetchable( pluralAttribute.getLazy(), pluralAttribute.getFetch(), pluralAttribute.getOuterJoin(),
element );
element.setTargetClass( hbmElement.getClazz() );
return element;
}
private JaxbOneToMany transferOneToManyAttribute(
PluralAttributeElement pluralAttribute, String collectionTypeName, String orderBy) {

View File

@ -2045,6 +2045,7 @@
<xsd:attribute name="name" type="xsd:string" use="required"/>
<xsd:attribute name="catalog" type="xsd:string"/>
<xsd:attribute name="schema" type="xsd:string"/>
<xsd:attribute name="optional" type="xsd:boolean"/>
</xsd:complexType>

View File

@ -23,23 +23,22 @@
*/
package org.hibernate.metamodel.spi.binding;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import org.hibernate.metamodel.MetadataSources;
import org.hibernate.metamodel.internal.MetadataImpl;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
/**
* "Unsaved" value tests of {@code hbm.xml} binding code
*
* @author Gail Badner
*/
@FailureExpectedWithNewUnifiedXsd(message = "timestamps")
public class UnsavedValueHbmTests extends AbstractUnsavedValueTests {
@Test
@FailureExpectedWithNewUnifiedXsd(message = "unsaved-value")
public void testAssignedSimpleIdNonDefaultUnsavedValue() {
MetadataSources sources = new MetadataSources( basicServiceRegistry() );
addNonDefaultSources( sources );
@ -50,6 +49,7 @@ public class UnsavedValueHbmTests extends AbstractUnsavedValueTests {
}
@Test
@FailureExpectedWithNewUnifiedXsd(message = "unsaved-value")
public void testIncrementSimpleIdNonDefaultUnsavedValue() {
MetadataSources sources = new MetadataSources( basicServiceRegistry() );
addNonDefaultSources( sources );
@ -60,6 +60,7 @@ public class UnsavedValueHbmTests extends AbstractUnsavedValueTests {
}
@Test
@FailureExpectedWithNewUnifiedXsd(message = "unsaved-value")
public void testNonDefaultUnsavedVersion() {
MetadataSources sources = new MetadataSources( basicServiceRegistry() );
addNonDefaultSources( sources );
@ -70,6 +71,7 @@ public class UnsavedValueHbmTests extends AbstractUnsavedValueTests {
}
@Test
@FailureExpectedWithNewUnifiedXsd(message = "unsaved-value")
public void testNonDefaultUnsavedTimestamp() {
MetadataSources sources = new MetadataSources( basicServiceRegistry() );
addNonDefaultSources( sources );

View File

@ -25,7 +25,6 @@ package org.hibernate.test.annotations.xml.hbm;
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;
@ -34,7 +33,6 @@ 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

@ -54,7 +54,6 @@ import org.junit.Test;
/**
* @author Gavin King
*/
@FailureExpectedWithNewUnifiedXsd(message = "timestamps")
public class ComponentTest extends BaseCoreFunctionalTestCase {
@Override
public String[] getMappings() {

View File

@ -22,12 +22,14 @@
* Boston, MA 02110-1301 USA
*/
package org.hibernate.test.hql;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.junit.Test;
import org.hibernate.Hibernate;
import org.hibernate.Session;
import org.hibernate.Transaction;
@ -35,18 +37,14 @@ 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;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
/**
* Tests AST parser processing of ORDER BY clauses.
*
* @author Gail Badner
*/
@FailureExpectedWithNewUnifiedXsd(message = "hbm joins not yet supported")
public class ASTParserLoadingOrderByTest extends BaseCoreFunctionalTestCase {
StateProvince stateProvince;
private Zoo zoo1;

View File

@ -23,13 +23,14 @@
*/
package org.hibernate.test.hql;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
import java.math.BigDecimal;
import java.math.BigInteger;
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;
@ -39,23 +40,20 @@ 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;
import org.hibernate.type.DoubleType;
import org.hibernate.type.LongType;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
/**
* Tests cases for ensuring alignment between HQL and Criteria behavior.
*
* @author Max Rydahl Andersen
*/
@FailureExpectedWithNewUnifiedXsd(message = "hbm joins not yet supported")
public class CriteriaHQLAlignmentTest extends QueryTranslatorTestCase {
private boolean initialVersion2SqlFlagValue;

View File

@ -34,12 +34,10 @@ import org.hibernate.ScrollMode;
import org.hibernate.ScrollableResults;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.dialect.CUBRIDDialect;
import org.hibernate.dialect.AbstractHANADialect;
import org.hibernate.dialect.CUBRIDDialect;
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;
@ -52,7 +50,6 @@ 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,7 +37,6 @@ 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;
@ -47,7 +46,6 @@ 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

@ -38,7 +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")
@FailureExpectedWithNewUnifiedXsd
public class VersionedEntityWithInverseOneToManyJoinFailureExpectedTest extends AbstractEntityWithOneToManyTest {
public String[] getMappings() {
// return new String[] { "immutable/entitywithmutablecollection/inverse/ContractVariationVersionedOneToManyJoin.hbm.xml" };

View File

@ -36,7 +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")
@FailureExpectedWithNewUnifiedXsd
public class EntityWithNonInverseOneToManyJoinTest extends AbstractEntityWithOneToManyTest {
public String[] getMappings() {
// return new String[] { "immutable/entitywithmutablecollection/noninverse/ContractVariationOneToManyJoin.hbm.xml" };

View File

@ -36,7 +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")
@FailureExpectedWithNewUnifiedXsd
public class VersionedEntityWithNonInverseOneToManyJoinTest extends AbstractEntityWithOneToManyTest {
public String[] getMappings() {
// return new String[] { "immutable/entitywithmutablecollection/noninverse/ContractVariationVersionedOneToManyJoin.hbm.xml" };

View File

@ -22,30 +22,29 @@
* Boston, MA 02110-1301 USA
*/
package org.hibernate.test.interceptor;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import org.junit.Test;
import org.hibernate.AssertionFailure;
import org.hibernate.EmptyInterceptor;
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.FailureExpectedWithNewMetamodel;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.hibernate.type.Type;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import org.junit.Test;
/**
* @author Gavin King
@ -77,7 +76,7 @@ public class InterceptorTest extends BaseCoreFunctionalTestCase {
}
@Test
@FailureExpectedWithNewUnifiedXsd(message = "select-before-update")
@FailureExpectedWithNewMetamodel
public void testPropertyIntercept() {
Session s = openSession( new PropertyInterceptor() );
Transaction t = s.beginTransaction();
@ -104,7 +103,7 @@ public class InterceptorTest extends BaseCoreFunctionalTestCase {
*/
@Test
@TestForIssue( jiraKey = "HHH-1921" )
@FailureExpectedWithNewUnifiedXsd(message = "select-before-update")
@FailureExpectedWithNewMetamodel
public void testPropertyIntercept2() {
Session s = openSession();
Transaction t = s.beginTransaction();
@ -234,7 +233,7 @@ public class InterceptorTest extends BaseCoreFunctionalTestCase {
}
@Test
@FailureExpectedWithNewUnifiedXsd(message = "select-before-update")
@FailureExpectedWithNewMetamodel
public void testInitiateIntercept() {
final String injectedString = "******";
final InstantiateInterceptor initiateInterceptor = new InstantiateInterceptor( injectedString );
@ -281,7 +280,7 @@ public class InterceptorTest extends BaseCoreFunctionalTestCase {
@Test
@TestForIssue( jiraKey = "HHH-6594" )
@FailureExpectedWithNewUnifiedXsd(message = "select-before-update")
@FailureExpectedWithNewMetamodel
public void testPrepareStatementIntercept() {
final Queue<String> expectedSQLs = new LinkedList<String>();
// Transaction 1

View File

@ -23,18 +23,16 @@
*/
package org.hibernate.test.interfaceproxy;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
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;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import org.junit.Test;
/**
@ -56,7 +54,6 @@ 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

@ -46,7 +46,7 @@ import org.junit.Test;
/**
* @author Gavin King
*/
@FailureExpectedWithNewUnifiedXsd(message = "hbm joins not yet supported")
@FailureExpectedWithNewUnifiedXsd
public class JoinTest extends BaseCoreFunctionalTestCase {
@Override
public String[] getMappings() {

View File

@ -30,14 +30,12 @@ import java.util.List;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
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

@ -6,36 +6,9 @@ package org.hibernate.test.join;
* @author Chris Jones
*/
public class Thing {
private Employee salesperson;
private String comments;
/**
* @return Returns the salesperson.
*/
public Employee getSalesperson() {
return salesperson;
}
/**
* @param salesperson The salesperson to set.
*/
public void setSalesperson(Employee salesperson) {
this.salesperson = salesperson;
}
/**
* @return Returns the comments.
*/
public String getComments() {
return comments;
}
/**
* @param comments The comments to set.
*/
public void setComments(String comments) {
this.comments = comments;
}
Long id;
String name;
private Long id;
private String name;
/**
* @return Returns the ID.

View File

@ -59,7 +59,7 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@FailureExpectedWithNewUnifiedXsd(message = "timestamps")
@FailureExpectedWithNewUnifiedXsd
public class SQLFunctionsTest extends LegacyTestCase {
private static final Logger log = Logger.getLogger( SQLFunctionsTest.class );

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 static org.junit.Assert.assertEquals;
@ -85,6 +86,7 @@ public class MapCompositeElementTest extends BaseCoreFunctionalTestCase {
@SuppressWarnings( {"unchecked"})
@Test
@FailureExpectedWithNewUnifiedXsd(message = "<import>")
public void testQueryMapCompositeElement() {
Session s = openSession();
Transaction t = s.beginTransaction();

View File

@ -36,7 +36,7 @@ import static org.junit.Assert.assertEquals;
/**
* @author Gavin King
*/
@FailureExpectedWithNewUnifiedXsd(message = "hbm joins not yet supported")
@FailureExpectedWithNewUnifiedXsd
public class OneToManyTest extends BaseCoreFunctionalTestCase {
public String[] getMappings() {
return new String[] { "onetomany/Parent.hbm.xml" };

View File

@ -43,7 +43,8 @@ import org.junit.Test;
/**
* @author Gavin King
*/
@FailureExpectedWithNewUnifiedXsd(message = "hbm joins not yet supported")
@FailureExpectedWithNewUnifiedXsd(message = "null rows attempted on secondary table, even though optional <join> " +
"is handled in EntityMocker.")
public class OneToOneLinkTest extends BaseCoreFunctionalTestCase {
@Override
public String[] getMappings() {

View File

@ -23,26 +23,23 @@
*/
package org.hibernate.test.ops;
import java.util.ArrayList;
import java.util.Collection;
import org.junit.Test;
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;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
import java.util.ArrayList;
import java.util.Collection;
import org.hibernate.PersistentObjectException;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.exception.ConstraintViolationException;
import org.junit.Test;
/**
* @author Gavin King
*/
@FailureExpectedWithNewUnifiedXsd(message = "timestamps")
public class CreateTest extends AbstractOperationTestCase {
@Test
@SuppressWarnings( {"unchecked"})

View File

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

View File

@ -23,33 +23,25 @@
*/
package org.hibernate.test.ops;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import org.junit.Test;
import org.hibernate.Hibernate;
import org.hibernate.NonUniqueObjectException;
import org.hibernate.Session;
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;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import org.hibernate.testing.FailureExpectedWithNewUnifiedXsd;
import org.hibernate.testing.junit4.BaseUnitTestCase;
import org.junit.Test;
/**
* @author Gavin King
*/
@FailureExpectedWithNewUnifiedXsd(message = "timestamps")
public class MergeTest extends AbstractOperationTestCase {
@FailureExpectedWithNewUnifiedXsd(message = "There appears to be intermittent " +
"failures that seem to imply an issue with binding ordering. Check property-ref transformation and mock?")
public class MergeTest extends BaseUnitTestCase {
@Test
public void forceFailure() {
assertTrue( false );
}
/*extends AbstractOperationTestCase {
@Test
public void testMergeStaleVersionFails() throws Exception {
Session s = openSession();
@ -942,6 +934,6 @@ public class MergeTest extends AbstractOperationTestCase {
s.getTransaction().commit();
s.close();
}
} */
}

View File

@ -23,25 +23,22 @@
*/
package org.hibernate.test.stateless;
import java.util.Date;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNotSame;
import org.junit.Test;
import java.util.Date;
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;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNotSame;
import org.junit.Test;
/**
* @author Gavin King
*/
@FailureExpectedWithNewUnifiedXsd(message = "timestamps")
public class StatelessSessionTest extends BaseCoreFunctionalTestCase {
public String[] getMappings() {
return new String[] { "stateless/Document.hbm.xml" };

View File

@ -23,23 +23,20 @@
*/
package org.hibernate.test.timestamp;
import java.util.Date;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import java.util.Date;
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;
import org.junit.Test;
/**
* @author Gavin King
*/
@FailureExpectedWithNewUnifiedXsd(message = "timestamps")
public class TimestampTest extends BaseCoreFunctionalTestCase {
public String[] getMappings() {
return new String[] { "timestamp/User.hbm.xml" };