parent
54af0800d6
commit
76b2719fed
|
@ -33,6 +33,7 @@ import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmCompositeCollectionElementType;
|
|||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmCompositeIdType;
|
||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmCompositeKeyBasicAttributeType;
|
||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmCompositeKeyManyToOneType;
|
||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmConfigParameterType;
|
||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmDiscriminatorSubclassEntityType;
|
||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmDynamicComponentType;
|
||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmEntityBaseDefinition;
|
||||
|
@ -54,6 +55,7 @@ import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmLazyWithExtraEnum;
|
|||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmLazyWithNoProxyEnum;
|
||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmListIndexType;
|
||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmListType;
|
||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmManyToAnyCollectionElementType;
|
||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmManyToManyCollectionElementType;
|
||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmManyToOneType;
|
||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmMapType;
|
||||
|
@ -98,6 +100,7 @@ import org.hibernate.boot.jaxb.mapping.spi.JaxbCheckConstraintImpl;
|
|||
import org.hibernate.boot.jaxb.mapping.spi.JaxbCollectionTableImpl;
|
||||
import org.hibernate.boot.jaxb.mapping.spi.JaxbColumnImpl;
|
||||
import org.hibernate.boot.jaxb.mapping.spi.JaxbColumnResultImpl;
|
||||
import org.hibernate.boot.jaxb.mapping.spi.JaxbConfigurationParameterImpl;
|
||||
import org.hibernate.boot.jaxb.mapping.spi.JaxbCustomSqlImpl;
|
||||
import org.hibernate.boot.jaxb.mapping.spi.JaxbDatabaseObjectImpl;
|
||||
import org.hibernate.boot.jaxb.mapping.spi.JaxbDatabaseObjectScopeImpl;
|
||||
|
@ -145,6 +148,7 @@ import org.hibernate.boot.jaxb.mapping.spi.JaxbSqlResultSetMappingImpl;
|
|||
import org.hibernate.boot.jaxb.mapping.spi.JaxbSynchronizedTableImpl;
|
||||
import org.hibernate.boot.jaxb.mapping.spi.JaxbTableImpl;
|
||||
import org.hibernate.boot.jaxb.mapping.spi.JaxbTransientImpl;
|
||||
import org.hibernate.boot.jaxb.mapping.spi.JaxbUserTypeImpl;
|
||||
import org.hibernate.boot.jaxb.mapping.spi.JaxbVersionImpl;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
import org.hibernate.internal.util.collections.CollectionHelper;
|
||||
|
@ -1272,23 +1276,19 @@ public class HbmXmlTransformer {
|
|||
attributes.getAnyMappingAttributes().add( transformAnyAttribute( any ) );
|
||||
|
||||
}
|
||||
else if ( hbmAttributeMapping instanceof PluralAttributeInfo pluralAttributeInfo ) {
|
||||
if ( pluralAttributeInfo.getElement() != null
|
||||
|| pluralAttributeInfo.getCompositeElement() != null ) {
|
||||
attributes.getElementCollectionAttributes().add( transformElementCollection( pluralAttributeInfo ) );
|
||||
else if ( hbmAttributeMapping instanceof PluralAttributeInfo hbmCollection ) {
|
||||
if ( hbmCollection.getElement() != null
|
||||
|| hbmCollection.getCompositeElement() != null ) {
|
||||
attributes.getElementCollectionAttributes().add( transformElementCollection( hbmCollection ) );
|
||||
}
|
||||
else if ( hbmCollection.getOneToMany() != null ) {
|
||||
target = new JaxbOneToMany();
|
||||
transferOneToManyInfo( hbmCollection, hbmCollection.getOneToMany(), (JaxbOneToMany) target );
|
||||
attributes.getOneToManyAttributes().add( (JaxbOneToMany) target );
|
||||
attributes.getOneToManyAttributes().add( transformOneToMany( hbmCollection ) );
|
||||
}
|
||||
else if ( hbmCollection.getManyToMany() != null ) {
|
||||
target = new JaxbManyToMany();
|
||||
transferManyToManyInfo( hbmCollection, hbmCollection.getManyToMany(), (JaxbManyToMany) target );
|
||||
attributes.getManyToManyAttributes().add( (JaxbManyToMany) target );
|
||||
attributes.getManyToManyAttributes().add( transformManyToMany( hbmCollection ) );
|
||||
}
|
||||
else if ( pluralAttributeInfo.getManyToAny() != null ) {
|
||||
attributes.getPluralAnyMappingAttributes().add( transformManyToAnyCollection( pluralAttributeInfo ) );
|
||||
else if ( hbmCollection.getManyToAny() != null ) {
|
||||
attributes.getPluralAnyMappingAttributes().add( transformPluralAny( hbmCollection ) );
|
||||
}
|
||||
else {
|
||||
throw new UnsupportedOperationException( "Unexpected node type - " + hbmCollection );
|
||||
|
@ -1310,22 +1310,22 @@ public class HbmXmlTransformer {
|
|||
basic.setAttributeAccessor( hbmProp.getAccess() );
|
||||
basic.setOptimisticLock( hbmProp.isOptimisticLock() );
|
||||
|
||||
// if ( isNotEmpty( hbmProp.getTypeAttribute() ) ) {
|
||||
// basic.setType( new JaxbHbmType() );
|
||||
// basic.getType().setName( hbmProp.getTypeAttribute() );
|
||||
// }
|
||||
// else {
|
||||
// if ( hbmProp.getType() != null ) {
|
||||
// basic.setType( new JaxbHbmType() );
|
||||
// basic.getType().setName( hbmProp.getType().getName() );
|
||||
// for ( JaxbHbmConfigParameterType hbmParam : hbmProp.getType().getConfigParameters() ) {
|
||||
// final JaxbHbmParam param = new JaxbHbmParam();
|
||||
// param.setName( hbmParam.getName() );
|
||||
// param.setValue( hbmParam.getValue() );
|
||||
// basic.getType().getParam().add( param );
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
if ( isNotEmpty( hbmProp.getTypeAttribute() ) ) {
|
||||
basic.setType( new JaxbUserTypeImpl() );
|
||||
basic.getType().setValue( hbmProp.getTypeAttribute() );
|
||||
}
|
||||
else {
|
||||
if ( hbmProp.getType() != null ) {
|
||||
basic.setType( new JaxbUserTypeImpl() );
|
||||
basic.getType().setValue( hbmProp.getType().getName() );
|
||||
for ( JaxbHbmConfigParameterType hbmParam : hbmProp.getType().getConfigParameters() ) {
|
||||
final JaxbConfigurationParameterImpl param = new JaxbConfigurationParameterImpl();
|
||||
param.setName( hbmParam.getName() );
|
||||
param.setValue( hbmParam.getValue() );
|
||||
basic.getType().getParameters().add( param );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
transferColumnsAndFormulas(
|
||||
new ColumnAndFormulaSource() {
|
||||
|
@ -1573,68 +1573,15 @@ public class HbmXmlTransformer {
|
|||
|
||||
private JaxbElementCollectionImpl transformElementCollection(final PluralAttributeInfo source) {
|
||||
final JaxbElementCollectionImpl target = new JaxbElementCollectionImpl();
|
||||
transferCollectionTable( source, target );
|
||||
transferCollectionBasicInfo( source, target );
|
||||
|
||||
if ( source instanceof JaxbHbmMapType ) {
|
||||
transferMapKey( (JaxbHbmMapType) source, target );
|
||||
}
|
||||
transferCollectionTable( source, target );
|
||||
|
||||
if ( source.getElement() != null ) {
|
||||
transferColumnsAndFormulas(
|
||||
new ColumnAndFormulaSource() {
|
||||
@Override
|
||||
public String getColumnAttribute() {
|
||||
return source.getElement().getColumnAttribute();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFormulaAttribute() {
|
||||
return source.getElement().getFormulaAttribute();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Serializable> getColumnOrFormula() {
|
||||
return source.getElement().getColumnOrFormula();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SourceColumnAdapter wrap(Serializable column) {
|
||||
return new SourceColumnAdapterJaxbHbmColumnType( (JaxbHbmColumnType) column );
|
||||
}
|
||||
},
|
||||
new ColumnAndFormulaTarget() {
|
||||
@Override
|
||||
public TargetColumnAdapter makeColumnAdapter(ColumnDefaults columnDefaults) {
|
||||
return new TargetColumnAdapterJaxbColumn( columnDefaults );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addColumn(TargetColumnAdapter column) {
|
||||
target.setColumn( ( (TargetColumnAdapterJaxbColumn) column ).getTargetColumn() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFormula(String formula) {
|
||||
target.setFormula( formula );
|
||||
}
|
||||
},
|
||||
ColumnDefaultsBasicImpl.INSTANCE,
|
||||
null
|
||||
);
|
||||
transferElementInfo( source, source.getElement(), target );
|
||||
}
|
||||
else {
|
||||
target.setTargetClass( source.getCompositeElement().getClazz() );
|
||||
|
||||
// todo : account for same embeddable used multiple times
|
||||
final JaxbEmbeddableImpl embeddedable = new JaxbEmbeddableImpl();
|
||||
embeddedable.setClazz( source.getCompositeElement().getClazz() );
|
||||
embeddedable.setAttributes( new JaxbEmbeddableAttributesContainerImpl() );
|
||||
transferAttributes(
|
||||
source.getCompositeElement().getAttributes(),
|
||||
embeddedable.getAttributes()
|
||||
);
|
||||
ormRoot.getEmbeddables().add( embeddedable );
|
||||
transferElementInfo( source, source.getCompositeElement(), target );
|
||||
}
|
||||
|
||||
return target;
|
||||
|
@ -1828,7 +1775,7 @@ public class HbmXmlTransformer {
|
|||
private void transferElementInfo(
|
||||
PluralAttributeInfo hbmCollection,
|
||||
JaxbHbmBasicCollectionElementType element,
|
||||
JaxbElementCollection target) {
|
||||
JaxbElementCollectionImpl target) {
|
||||
transferCollectionBasicInfo( hbmCollection, target );
|
||||
transferCollectionTable( hbmCollection, target );
|
||||
|
||||
|
@ -1878,7 +1825,7 @@ public class HbmXmlTransformer {
|
|||
private void transferElementInfo(
|
||||
PluralAttributeInfo hbmCollection,
|
||||
JaxbHbmCompositeCollectionElementType compositeElement,
|
||||
JaxbElementCollection target) {
|
||||
JaxbElementCollectionImpl target) {
|
||||
transferCollectionBasicInfo( hbmCollection, target );
|
||||
transferCollectionTable( hbmCollection, target );
|
||||
|
||||
|
@ -1887,9 +1834,9 @@ public class HbmXmlTransformer {
|
|||
target.setTargetClass( embeddableName );
|
||||
|
||||
// todo : account for same embeddable used multiple times
|
||||
final JaxbEmbeddable embeddable = new JaxbEmbeddable();
|
||||
final JaxbEmbeddableImpl embeddable = new JaxbEmbeddableImpl();
|
||||
embeddable.setClazz( embeddableName );
|
||||
embeddable.setAttributes( new JaxbEmbeddableAttributes() );
|
||||
embeddable.setAttributes( new JaxbEmbeddableAttributesContainerImpl() );
|
||||
transferAttributes(
|
||||
compositeElement.getAttributes(),
|
||||
embeddable.getAttributes()
|
||||
|
@ -1897,10 +1844,16 @@ public class HbmXmlTransformer {
|
|||
ormRoot.getEmbeddables().add( embeddable );
|
||||
}
|
||||
|
||||
private JaxbOneToManyImpl transformOneToMany(PluralAttributeInfo hbmCollection) {
|
||||
final JaxbOneToManyImpl target = new JaxbOneToManyImpl();
|
||||
transferOneToManyInfo( hbmCollection, hbmCollection.getOneToMany(), target );
|
||||
return target;
|
||||
}
|
||||
|
||||
private void transferOneToManyInfo(
|
||||
PluralAttributeInfo hbmAttributeInfo,
|
||||
JaxbHbmOneToManyCollectionElementType hbmOneToMany,
|
||||
JaxbOneToMany target) {
|
||||
JaxbOneToManyImpl target) {
|
||||
if ( StringHelper.isNotEmpty( hbmAttributeInfo.getCollectionType() ) ) {
|
||||
handleUnsupported( "Collection-type is not supported for transformation" );
|
||||
}
|
||||
|
@ -1942,7 +1895,7 @@ public class HbmXmlTransformer {
|
|||
|
||||
final JaxbHbmKeyType key = hbmAttributeInfo.getKey();
|
||||
if ( key != null ) {
|
||||
target.setForeignKey( new JaxbForeignKey() );
|
||||
target.setForeignKey( new JaxbForeignKeyImpl() );
|
||||
if ( StringHelper.isNotEmpty( key.getForeignKey() ) ) {
|
||||
target.getForeignKey().setName( key.getForeignKey() );
|
||||
}
|
||||
|
@ -1955,10 +1908,16 @@ public class HbmXmlTransformer {
|
|||
target.setCascade( convertCascadeType( hbmAttributeInfo.getCascade() ) );
|
||||
}
|
||||
|
||||
private JaxbManyToManyImpl transformManyToMany(PluralAttributeInfo hbmCollection) {
|
||||
final JaxbManyToManyImpl target = new JaxbManyToManyImpl();
|
||||
transferManyToManyInfo( hbmCollection, hbmCollection.getManyToMany(), target );
|
||||
return target;
|
||||
}
|
||||
|
||||
private void transferManyToManyInfo(
|
||||
PluralAttributeInfo hbmCollection,
|
||||
JaxbHbmManyToManyCollectionElementType manyToMany,
|
||||
JaxbManyToMany target) {
|
||||
JaxbManyToManyImpl target) {
|
||||
if ( StringHelper.isNotEmpty( hbmCollection.getCollectionType() ) ) {
|
||||
handleUnsupported( "Collection-type is not supported for transformation" );
|
||||
}
|
||||
|
@ -1995,6 +1954,19 @@ public class HbmXmlTransformer {
|
|||
target.setTargetEntity( StringHelper.isNotEmpty( manyToMany.getClazz() ) ? manyToMany.getClazz() : manyToMany.getEntityName() );
|
||||
}
|
||||
|
||||
private JaxbPluralAnyMappingImpl transformPluralAny(PluralAttributeInfo hbmCollection) {
|
||||
final JaxbPluralAnyMappingImpl target = new JaxbPluralAnyMappingImpl();
|
||||
transferPluralAny( hbmCollection, hbmCollection.getManyToAny(), target );
|
||||
return target;
|
||||
}
|
||||
|
||||
private void transferPluralAny(
|
||||
PluralAttributeInfo hbmCollection,
|
||||
JaxbHbmManyToAnyCollectionElementType manyToAny,
|
||||
JaxbPluralAnyMappingImpl target) {
|
||||
throw new UnsupportedOperationException( "Not yet implemented" );
|
||||
}
|
||||
|
||||
private void transferIdentifier(JaxbHbmRootEntityType source, JaxbEntityImpl target) {
|
||||
if ( source.getId() != null ) {
|
||||
target.getAttributes().getIdAttributes().add( convertSimpleId( source.getId() ) );
|
||||
|
|
|
@ -6,10 +6,9 @@
|
|||
*/
|
||||
package org.hibernate.orm.test.boot.jaxb.hbm;
|
||||
|
||||
import org.hibernate.boot.jaxb.mapping.JaxbEmbeddable;
|
||||
import org.hibernate.boot.jaxb.mapping.JaxbEmbedded;
|
||||
import org.hibernate.boot.jaxb.mapping.JaxbEntity;
|
||||
import org.hibernate.boot.jaxb.mapping.JaxbEntityMappings;
|
||||
import org.hibernate.boot.jaxb.mapping.spi.JaxbEmbeddableImpl;
|
||||
import org.hibernate.boot.jaxb.mapping.spi.JaxbEntityImpl;
|
||||
import org.hibernate.boot.jaxb.mapping.spi.JaxbEntityMappingsImpl;
|
||||
|
||||
import org.hibernate.testing.orm.junit.Jira;
|
||||
import org.hibernate.testing.orm.junit.ServiceRegistry;
|
||||
|
@ -27,7 +26,7 @@ public class BasicTransformationTests {
|
|||
|
||||
@Test
|
||||
public void testBasicTransformation(ServiceRegistryScope scope) {
|
||||
final JaxbEntityMappings transformed = TransformationHelper.transform( "xml/jaxb/mapping/basic/hbm.xml", scope.getRegistry() );
|
||||
final JaxbEntityMappingsImpl transformed = TransformationHelper.transform( "xml/jaxb/mapping/basic/hbm.xml", scope.getRegistry() );
|
||||
|
||||
assertThat( transformed ).isNotNull();
|
||||
|
||||
|
@ -41,26 +40,26 @@ public class BasicTransformationTests {
|
|||
assertThat( transformed.getEntities() ).hasSize( 1 );
|
||||
assertThat( transformed.getEmbeddables() ).hasSize( 0 );
|
||||
|
||||
final JaxbEntity ormEntity = transformed.getEntities().get( 0 );
|
||||
final JaxbEntityImpl ormEntity = transformed.getEntities().get( 0 );
|
||||
assertThat( ormEntity.getName() ).isNull();
|
||||
assertThat( ormEntity.getClazz() ).isEqualTo( "SimpleEntity" );
|
||||
|
||||
assertThat( ormEntity.getAttributes().getId() ).hasSize( 1 );
|
||||
assertThat( ormEntity.getAttributes().getIdAttributes() ).hasSize( 1 );
|
||||
assertThat( ormEntity.getAttributes().getBasicAttributes() ).hasSize( 1 );
|
||||
assertThat( ormEntity.getAttributes().getEmbeddedAttributes() ).isEmpty();
|
||||
assertThat( ormEntity.getAttributes().getOneToOneAttributes() ).isEmpty();
|
||||
assertThat( ormEntity.getAttributes().getManyToOneAttributes() ).isEmpty();
|
||||
assertThat( ormEntity.getAttributes().getDiscriminatedAssociations() ).isEmpty();
|
||||
assertThat( ormEntity.getAttributes().getAnyMappingAttributes() ).isEmpty();
|
||||
assertThat( ormEntity.getAttributes().getOneToManyAttributes() ).isEmpty();
|
||||
assertThat( ormEntity.getAttributes().getManyToManyAttributes() ).isEmpty();
|
||||
assertThat( ormEntity.getAttributes().getPluralDiscriminatedAssociations() ).isEmpty();
|
||||
assertThat( ormEntity.getAttributes().getPluralAnyMappingAttributes() ).isEmpty();
|
||||
|
||||
TransformationHelper.verifyTransformation( transformed );
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBasicTransformation2(ServiceRegistryScope scope) {
|
||||
final JaxbEntityMappings transformed = TransformationHelper.transform( "mappings/hbm/basic.xml", scope.getRegistry() );
|
||||
final JaxbEntityMappingsImpl transformed = TransformationHelper.transform( "mappings/hbm/basic.xml", scope.getRegistry() );
|
||||
|
||||
assertThat( transformed ).isNotNull();
|
||||
|
||||
|
@ -74,21 +73,21 @@ public class BasicTransformationTests {
|
|||
assertThat( transformed.getEntities() ).hasSize( 1 );
|
||||
assertThat( transformed.getEmbeddables() ).hasSize( 1 );
|
||||
|
||||
final JaxbEntity ormEntity = transformed.getEntities().get( 0 );
|
||||
final JaxbEntityImpl ormEntity = transformed.getEntities().get( 0 );
|
||||
assertThat( ormEntity.getName() ).isNull();
|
||||
assertThat( ormEntity.getClazz() ).isEqualTo( "BasicEntity" );
|
||||
|
||||
assertThat( ormEntity.getAttributes().getId() ).hasSize( 1 );
|
||||
assertThat( ormEntity.getAttributes().getIdAttributes() ).hasSize( 1 );
|
||||
assertThat( ormEntity.getAttributes().getBasicAttributes() ).hasSize( 1 );
|
||||
assertThat( ormEntity.getAttributes().getEmbeddedAttributes() ).hasSize( 1 );
|
||||
assertThat( ormEntity.getAttributes().getOneToOneAttributes() ).isEmpty();
|
||||
assertThat( ormEntity.getAttributes().getManyToOneAttributes() ).hasSize(1 );
|
||||
assertThat( ormEntity.getAttributes().getDiscriminatedAssociations() ).isEmpty();
|
||||
assertThat( ormEntity.getAttributes().getAnyMappingAttributes() ).isEmpty();
|
||||
assertThat( ormEntity.getAttributes().getOneToManyAttributes() ).hasSize( 1 );
|
||||
assertThat( ormEntity.getAttributes().getManyToManyAttributes() ).isEmpty();
|
||||
assertThat( ormEntity.getAttributes().getPluralDiscriminatedAssociations() ).isEmpty();
|
||||
assertThat( ormEntity.getAttributes().getPluralAnyMappingAttributes() ).isEmpty();
|
||||
|
||||
final JaxbEmbeddable jaxbEmbeddable = transformed.getEmbeddables().get( 0 );
|
||||
final JaxbEmbeddableImpl jaxbEmbeddable = transformed.getEmbeddables().get( 0 );
|
||||
assertThat( jaxbEmbeddable.isMetadataComplete() ).isTrue();
|
||||
assertThat( jaxbEmbeddable.getClazz() ).isEqualTo( "composition_1" );
|
||||
|
||||
|
@ -98,25 +97,25 @@ public class BasicTransformationTests {
|
|||
@Test
|
||||
@Jira( "https://hibernate.atlassian.net/browse/HHH-16822" )
|
||||
public void testSimpleTransformation(ServiceRegistryScope scope) {
|
||||
final JaxbEntityMappings transformed = TransformationHelper.transform( "mappings/hbm/simple.xml", scope.getRegistry() );
|
||||
final JaxbEntityMappingsImpl transformed = TransformationHelper.transform( "mappings/hbm/simple.xml", scope.getRegistry() );
|
||||
|
||||
assertThat( transformed ).isNotNull();
|
||||
assertThat( transformed.getEntities() ).hasSize( 1 );
|
||||
assertThat( transformed.getEmbeddables() ).hasSize( 0 );
|
||||
|
||||
final JaxbEntity ormEntity = transformed.getEntities().get( 0 );
|
||||
final JaxbEntityImpl ormEntity = transformed.getEntities().get( 0 );
|
||||
assertThat( ormEntity.getName() ).isNull();
|
||||
assertThat( ormEntity.getClazz() ).isEqualTo( "SimpleEntity" );
|
||||
|
||||
assertThat( ormEntity.getAttributes().getId() ).hasSize( 1 );
|
||||
assertThat( ormEntity.getAttributes().getIdAttributes() ).hasSize( 1 );
|
||||
assertThat( ormEntity.getAttributes().getBasicAttributes() ).hasSize( 1 );
|
||||
assertThat( ormEntity.getAttributes().getEmbeddedAttributes() ).isEmpty();
|
||||
assertThat( ormEntity.getAttributes().getOneToOneAttributes() ).isEmpty();
|
||||
assertThat( ormEntity.getAttributes().getManyToOneAttributes() ).isEmpty();
|
||||
assertThat( ormEntity.getAttributes().getDiscriminatedAssociations() ).isEmpty();
|
||||
assertThat( ormEntity.getAttributes().getAnyMappingAttributes() ).isEmpty();
|
||||
assertThat( ormEntity.getAttributes().getOneToManyAttributes() ).isEmpty();
|
||||
assertThat( ormEntity.getAttributes().getManyToManyAttributes() ).isEmpty();
|
||||
assertThat( ormEntity.getAttributes().getPluralDiscriminatedAssociations() ).isEmpty();
|
||||
assertThat( ormEntity.getAttributes().getPluralAnyMappingAttributes() ).isEmpty();
|
||||
|
||||
TransformationHelper.verifyTransformation( transformed );
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmHibernateMapping;
|
|||
import org.hibernate.boot.jaxb.hbm.transform.HbmXmlTransformer;
|
||||
import org.hibernate.boot.jaxb.hbm.transform.UnsupportedFeatureHandling;
|
||||
import org.hibernate.boot.jaxb.internal.stax.HbmEventReader;
|
||||
import org.hibernate.boot.jaxb.mapping.JaxbEntityMappings;
|
||||
import org.hibernate.boot.jaxb.mapping.spi.JaxbEntityMappingsImpl;
|
||||
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
||||
import org.hibernate.boot.xsd.MappingXsdSupport;
|
||||
import org.hibernate.orm.test.boot.jaxb.JaxbHelper;
|
||||
|
@ -38,11 +38,11 @@ import static org.hibernate.orm.test.boot.jaxb.JaxbHelper.withStaxEventReader;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public class TransformationHelper {
|
||||
public static JaxbEntityMappings transform(String resourceName, ServiceRegistry serviceRegistry) {
|
||||
public static JaxbEntityMappingsImpl transform(String resourceName, ServiceRegistry serviceRegistry) {
|
||||
return transform( resourceName, serviceRegistry.getService( ClassLoaderService.class ) );
|
||||
}
|
||||
|
||||
public static JaxbEntityMappings transform(String resourceName, ClassLoaderService cls) {
|
||||
public static JaxbEntityMappingsImpl transform(String resourceName, ClassLoaderService cls) {
|
||||
try ( final InputStream inputStream = cls.locateResourceStream( resourceName ) ) {
|
||||
return withStaxEventReader( inputStream, cls, (staxEventReader) -> {
|
||||
final XMLEventReader reader = new HbmEventReader( staxEventReader, XMLEventFactory.newInstance() );
|
||||
|
@ -77,9 +77,9 @@ public class TransformationHelper {
|
|||
* Verify correctness of the transformed mapping by marshalling and unmarshalling it
|
||||
* using the JaxbEntityMappings JAXBContext
|
||||
*/
|
||||
static void verifyTransformation(JaxbEntityMappings transformed) {
|
||||
static void verifyTransformation(JaxbEntityMappingsImpl transformed) {
|
||||
try {
|
||||
final JAXBContext jaxbContext = JAXBContext.newInstance( JaxbEntityMappings.class );
|
||||
final JAXBContext jaxbContext = JAXBContext.newInstance( JaxbEntityMappingsImpl.class );
|
||||
final Marshaller marshaller = jaxbContext.createMarshaller();
|
||||
final Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
|
||||
|
||||
|
@ -89,7 +89,7 @@ public class TransformationHelper {
|
|||
final String transformedXml = stringWriter.toString();
|
||||
|
||||
final StringReader stringReader = new StringReader( transformedXml );
|
||||
final JaxbEntityMappings unmarshalled = (JaxbEntityMappings) unmarshaller.unmarshal( stringReader );
|
||||
final JaxbEntityMappingsImpl unmarshalled = (JaxbEntityMappingsImpl) unmarshaller.unmarshal( stringReader );
|
||||
|
||||
assertThat( unmarshalled ).isNotNull();
|
||||
}
|
||||
|
|
|
@ -17,12 +17,10 @@ import org.hibernate.query.criteria.JpaCriteriaQuery;
|
|||
import org.hibernate.query.criteria.JpaCteCriteria;
|
||||
import org.hibernate.query.criteria.JpaEntityJoin;
|
||||
import org.hibernate.query.criteria.JpaJoin;
|
||||
import org.hibernate.query.criteria.JpaJoinedFrom;
|
||||
import org.hibernate.query.criteria.JpaParameterExpression;
|
||||
import org.hibernate.query.criteria.JpaRoot;
|
||||
import org.hibernate.query.criteria.JpaSubQuery;
|
||||
import org.hibernate.query.spi.QueryImplementor;
|
||||
import org.hibernate.query.sqm.tree.SqmJoinType;
|
||||
import org.hibernate.sql.ast.tree.cte.CteMaterialization;
|
||||
import org.hibernate.sql.ast.tree.cte.CteSearchClauseKind;
|
||||
|
||||
|
@ -34,9 +32,11 @@ import org.hibernate.testing.orm.domain.contacts.Address;
|
|||
import org.hibernate.testing.orm.domain.contacts.Contact;
|
||||
import org.hibernate.testing.orm.junit.DialectFeatureChecks;
|
||||
import org.hibernate.testing.orm.junit.DomainModel;
|
||||
import org.hibernate.testing.orm.junit.Jira;
|
||||
import org.hibernate.testing.orm.junit.RequiresDialectFeature;
|
||||
import org.hibernate.testing.orm.junit.SessionFactory;
|
||||
import org.hibernate.testing.orm.junit.SessionFactoryScope;
|
||||
import org.hibernate.testing.orm.junit.SkipForDialect;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
@ -111,7 +111,7 @@ public class CteTests {
|
|||
final JpaCteCriteria<Tuple> femaleContacts = cq.with( cte );
|
||||
|
||||
final JpaRoot<Contact> root = cq.from( Contact.class );
|
||||
final JpaJoinedFrom<?, Tuple> join = root.join( femaleContacts );
|
||||
final JpaJoin<?, Tuple> join = root.join( femaleContacts );
|
||||
join.on( root.get( "id" ).equalTo( join.get( "id" ) ) );
|
||||
|
||||
cq.multiselect( root.get( "id" ), root.get( "name" ) );
|
||||
|
|
|
@ -33,13 +33,13 @@ import org.hibernate.boot.jaxb.mapping.spi.JaxbMapKeyClassImpl;
|
|||
import org.hibernate.boot.jaxb.mapping.spi.JaxbMappedSuperclassImpl;
|
||||
import org.hibernate.boot.jaxb.mapping.spi.JaxbOneToManyImpl;
|
||||
import org.hibernate.boot.jaxb.mapping.spi.JaxbOneToOneImpl;
|
||||
import org.hibernate.processor.Context;
|
||||
import org.hibernate.processor.ImportContextImpl;
|
||||
import org.hibernate.processor.MetaModelGenerationException;
|
||||
import org.hibernate.processor.model.ImportContext;
|
||||
import org.hibernate.processor.model.MetaAttribute;
|
||||
import org.hibernate.processor.model.Metamodel;
|
||||
import org.hibernate.processor.util.AccessTypeInformation;
|
||||
import org.hibernate.processor.Context;
|
||||
import org.hibernate.processor.util.Constants;
|
||||
import org.hibernate.processor.util.NullnessUtil;
|
||||
import org.hibernate.processor.util.StringUtil;
|
||||
|
@ -49,8 +49,6 @@ import jakarta.persistence.AccessType;
|
|||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
import static jakarta.persistence.AccessType.FIELD;
|
||||
import static org.hibernate.jpamodelgen.util.StringUtil.determineFullyQualifiedClassName;
|
||||
import static org.hibernate.jpamodelgen.util.TypeUtils.getElementKindForAccessType;
|
||||
import static java.util.Collections.emptyList;
|
||||
import static org.hibernate.processor.util.StringUtil.determineFullyQualifiedClassName;
|
||||
import static org.hibernate.processor.util.TypeUtils.extractClosestRealTypeAsString;
|
||||
|
|
Loading…
Reference in New Issue