HHH-17377 - Migrate to JPA 3.2
https://hibernate.atlassian.net/browse/HHH-17377 hibernate-models
This commit is contained in:
parent
d948206758
commit
a1361853ed
|
@ -16,9 +16,6 @@ import org.jboss.logging.Logger;
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public class HbmTransformationLogging {
|
public class HbmTransformationLogging {
|
||||||
public static final String TRANSFORMATION_LOGGER_NAME = JaxbLogger.LOGGER_NAME + ".hbm-transformation";
|
public static final String TRANSFORMATION_LOGGER_NAME = JaxbLogger.LOGGER_NAME + ".hbm-transform";
|
||||||
public static final Logger TRANSFORMATION_LOGGER = Logger.getLogger( TRANSFORMATION_LOGGER_NAME );
|
public static final Logger TRANSFORMATION_LOGGER = Logger.getLogger( TRANSFORMATION_LOGGER_NAME );
|
||||||
|
|
||||||
public static final boolean TRACE_ENABLED = TRANSFORMATION_LOGGER.isTraceEnabled();
|
|
||||||
public static final boolean DEBUG_ENABLED = TRANSFORMATION_LOGGER.isDebugEnabled();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,6 +80,7 @@ import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmSetType;
|
||||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmSimpleIdType;
|
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmSimpleIdType;
|
||||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmSynchronizeType;
|
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmSynchronizeType;
|
||||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmTimestampAttributeType;
|
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmTimestampAttributeType;
|
||||||
|
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmTypeDefinitionType;
|
||||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmUnionSubclassEntityType;
|
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmUnionSubclassEntityType;
|
||||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmVersionAttributeType;
|
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmVersionAttributeType;
|
||||||
import org.hibernate.boot.jaxb.hbm.spi.PluralAttributeInfo;
|
import org.hibernate.boot.jaxb.hbm.spi.PluralAttributeInfo;
|
||||||
|
@ -248,25 +249,33 @@ public class HbmXmlTransformer {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleUnsupported(String message, Object... messageArgs) {
|
private void handleUnsupported(String message, Object... messageArgs) {
|
||||||
if ( options.unsupportedFeatureHandling() == UnsupportedFeatureHandling.ERROR ) {
|
handleUnsupported(
|
||||||
throw new UnsupportedOperationException(
|
null,
|
||||||
|
message,
|
||||||
|
messageArgs
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@FunctionalInterface
|
||||||
|
private interface PickHandler {
|
||||||
|
void handlePick(String message, Object... messageArgs);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleUnsupported(PickHandler pickHandler, String message, Object... messageArgs) {
|
||||||
|
switch ( options.unsupportedFeatureHandling() ) {
|
||||||
|
case ERROR -> throw new UnsupportedOperationException(
|
||||||
String.format(
|
String.format(
|
||||||
Locale.ROOT,
|
Locale.ROOT,
|
||||||
message,
|
message,
|
||||||
messageArgs
|
messageArgs
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
case PICK -> {
|
||||||
|
if ( pickHandler != null ) pickHandler.handlePick( message, messageArgs );
|
||||||
|
}
|
||||||
|
case IGNORE -> TRANSFORMATION_LOGGER.debugf( message, messageArgs );
|
||||||
|
case WARN -> TRANSFORMATION_LOGGER.warnf( message, messageArgs );
|
||||||
}
|
}
|
||||||
|
|
||||||
final Logger.Level logLevel = options.unsupportedFeatureHandling() == UnsupportedFeatureHandling.WARN
|
|
||||||
? Logger.Level.WARN
|
|
||||||
: Logger.Level.DEBUG;
|
|
||||||
//noinspection deprecation
|
|
||||||
TRANSFORMATION_LOGGER.log(
|
|
||||||
logLevel,
|
|
||||||
message,
|
|
||||||
messageArgs
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void transferTypeDefs() {
|
private void transferTypeDefs() {
|
||||||
|
@ -301,8 +310,6 @@ public class HbmXmlTransformer {
|
||||||
ormRoot.getGenericGenerators().add( generatorDef );
|
ormRoot.getGenericGenerators().add( generatorDef );
|
||||||
generatorDef.setName( hbmGenerator.getName() );
|
generatorDef.setName( hbmGenerator.getName() );
|
||||||
generatorDef.setClazz( hbmGenerator.getClazz() );
|
generatorDef.setClazz( hbmGenerator.getClazz() );
|
||||||
|
|
||||||
// todo : parameters
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,7 +339,7 @@ public class HbmXmlTransformer {
|
||||||
for ( Object content : hbmFilterDef.getContent() ) {
|
for ( Object content : hbmFilterDef.getContent() ) {
|
||||||
if ( content instanceof String ) {
|
if ( content instanceof String ) {
|
||||||
final String condition = ( (String) content ).trim();
|
final String condition = ( (String) content ).trim();
|
||||||
if (! StringHelper.isEmpty( condition )) {
|
if ( !StringHelper.isEmpty( condition ) ) {
|
||||||
foundCondition = true;
|
foundCondition = true;
|
||||||
filterDef.setDefaultCondition( condition );
|
filterDef.setDefaultCondition( condition );
|
||||||
}
|
}
|
||||||
|
@ -581,10 +588,9 @@ public class HbmXmlTransformer {
|
||||||
query.setTimeout( hbmQuery.getTimeout() );
|
query.setTimeout( hbmQuery.getTimeout() );
|
||||||
|
|
||||||
for ( Object content : hbmQuery.getContent() ) {
|
for ( Object content : hbmQuery.getContent() ) {
|
||||||
if ( content instanceof String ) {
|
if ( content instanceof String qryString ) {
|
||||||
String s = (String) content;
|
qryString = qryString.trim();
|
||||||
s = s.trim();
|
query.setQuery( qryString );
|
||||||
query.setQuery( s );
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@SuppressWarnings("unchecked") final JAXBElement<JaxbHbmQueryParamType> element = (JAXBElement<JaxbHbmQueryParamType>) content;
|
@SuppressWarnings("unchecked") final JAXBElement<JaxbHbmQueryParamType> element = (JAXBElement<JaxbHbmQueryParamType>) content;
|
||||||
|
@ -639,15 +645,13 @@ public class HbmXmlTransformer {
|
||||||
|
|
||||||
// JaxbQueryElement#content elements can be either the query or parameters
|
// JaxbQueryElement#content elements can be either the query or parameters
|
||||||
for ( Object content : hbmQuery.getContent() ) {
|
for ( Object content : hbmQuery.getContent() ) {
|
||||||
if ( content instanceof String ) {
|
if ( content instanceof String qryString ) {
|
||||||
String s = (String) content;
|
qryString = qryString.trim();
|
||||||
s = s.trim();
|
query.setQuery( qryString );
|
||||||
query.setQuery( s );
|
|
||||||
}
|
}
|
||||||
else if ( content instanceof JAXBElement ) {
|
else if ( content instanceof JAXBElement ) {
|
||||||
final Object element = ( (JAXBElement<?>) content ).getValue();
|
final Object element = ( (JAXBElement<?>) content ).getValue();
|
||||||
if ( element instanceof JaxbHbmQueryParamType ) {
|
if ( element instanceof JaxbHbmQueryParamType hbmQueryParam ) {
|
||||||
final JaxbHbmQueryParamType hbmQueryParam = (JaxbHbmQueryParamType) element;
|
|
||||||
final JaxbQueryParamTypeImpl queryParam = new JaxbQueryParamTypeImpl();
|
final JaxbQueryParamTypeImpl queryParam = new JaxbQueryParamTypeImpl();
|
||||||
queryParam.setName( hbmQueryParam.getName() );
|
queryParam.setName( hbmQueryParam.getName() );
|
||||||
queryParam.setType( hbmQueryParam.getType() );
|
queryParam.setType( hbmQueryParam.getType() );
|
||||||
|
@ -711,8 +715,7 @@ public class HbmXmlTransformer {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if ( element instanceof JaxbHbmSynchronizeType ) {
|
else if ( element instanceof JaxbHbmSynchronizeType hbmSynchronize ) {
|
||||||
final JaxbHbmSynchronizeType hbmSynchronize = (JaxbHbmSynchronizeType) element;
|
|
||||||
final JaxbSynchronizedTableImpl synchronize = new JaxbSynchronizedTableImpl();
|
final JaxbSynchronizedTableImpl synchronize = new JaxbSynchronizedTableImpl();
|
||||||
synchronize.setTable( hbmSynchronize.getTable() );
|
synchronize.setTable( hbmSynchronize.getTable() );
|
||||||
query.getSynchronizations().add( synchronize );
|
query.getSynchronizations().add( synchronize );
|
||||||
|
@ -767,7 +770,7 @@ public class HbmXmlTransformer {
|
||||||
private void transferEntities() {
|
private void transferEntities() {
|
||||||
// thoughts...
|
// thoughts...
|
||||||
// 1) We only need to transfer the "extends" attribute if the model is dynamic (map mode),
|
// 1) We only need to transfer the "extends" attribute if the model is dynamic (map mode),
|
||||||
// otherwise it will be discovered via jandex
|
// otherwise it will be discovered via hibernate-models
|
||||||
// 2) ?? Have abstract hbm class mappings become MappedSuperclass mappings ??
|
// 2) ?? Have abstract hbm class mappings become MappedSuperclass mappings ??
|
||||||
|
|
||||||
for ( JaxbHbmRootEntityType hbmClass : hbmXmlMapping.getClazz() ) {
|
for ( JaxbHbmRootEntityType hbmClass : hbmXmlMapping.getClazz() ) {
|
||||||
|
@ -837,7 +840,10 @@ public class HbmXmlTransformer {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( hbmClass.getLoader() != null ) {
|
if ( hbmClass.getLoader() != null ) {
|
||||||
throw new UnsupportedOperationException( "<loader/> is not supported in mapping.xsd - use <sql-select/> or <hql-select/> instead" );
|
handleUnsupported(
|
||||||
|
"<loader/> is not supported in mapping.xsd - use <sql-select/> or <hql-select/> instead: ",
|
||||||
|
origin
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( hbmClass.getSqlInsert() != null ) {
|
if ( hbmClass.getSqlInsert() != null ) {
|
||||||
|
@ -970,6 +976,7 @@ public class HbmXmlTransformer {
|
||||||
throw new IllegalArgumentException( "Unrecognized cache-inclusions value : " + hbmInclusion );
|
throw new IllegalArgumentException( "Unrecognized cache-inclusions value : " + hbmInclusion );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
private PolymorphismType convert(JaxbHbmPolymorphismEnum polymorphism) {
|
private PolymorphismType convert(JaxbHbmPolymorphismEnum polymorphism) {
|
||||||
if ( polymorphism == null ) {
|
if ( polymorphism == null ) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -983,19 +990,13 @@ public class HbmXmlTransformer {
|
||||||
transfer( hbmClass::getEntityName, entity::setName );
|
transfer( hbmClass::getEntityName, entity::setName );
|
||||||
transfer( hbmClass::getName, entity::setClazz );
|
transfer( hbmClass::getName, entity::setClazz );
|
||||||
|
|
||||||
if ( hbmClass instanceof Discriminatable ) {
|
if ( hbmClass instanceof Discriminatable discriminatable ) {
|
||||||
final Discriminatable discriminatable = (Discriminatable) hbmClass;
|
|
||||||
transfer( discriminatable::getDiscriminatorValue, entity::setDiscriminatorValue );
|
transfer( discriminatable::getDiscriminatorValue, entity::setDiscriminatorValue );
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo (6.1) : what to do with abstract? add abstract attribute to mapping xsd, or handle as mapped-superclass?
|
|
||||||
if ( hbmClass.isAbstract() != null ) {
|
if ( hbmClass.isAbstract() != null ) {
|
||||||
handleUnsupported(
|
// todo : handle hbm abstract as mapping abstract or as mapped-superclass?
|
||||||
"Transformation of abstract entity mappings is not supported : `%s` - `%s`",
|
entity.setAbstract( hbmClass.isAbstract() );
|
||||||
extractEntityName( hbmClass ),
|
|
||||||
origin
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( hbmClass.getPersister() != null ) {
|
if ( hbmClass.getPersister() != null ) {
|
||||||
|
@ -1238,17 +1239,14 @@ public class HbmXmlTransformer {
|
||||||
|
|
||||||
private void transferAttributes(List hbmAttributeMappings, JaxbAttributesContainer attributes) {
|
private void transferAttributes(List hbmAttributeMappings, JaxbAttributesContainer attributes) {
|
||||||
for ( Object hbmAttributeMapping : hbmAttributeMappings ) {
|
for ( Object hbmAttributeMapping : hbmAttributeMappings ) {
|
||||||
if ( hbmAttributeMapping instanceof JaxbHbmBasicAttributeType ) {
|
if ( hbmAttributeMapping instanceof JaxbHbmBasicAttributeType basic ) {
|
||||||
final JaxbHbmBasicAttributeType basic = (JaxbHbmBasicAttributeType) hbmAttributeMapping;
|
|
||||||
attributes.getBasicAttributes().add( transformBasicAttribute( basic ) );
|
attributes.getBasicAttributes().add( transformBasicAttribute( basic ) );
|
||||||
}
|
}
|
||||||
else if ( hbmAttributeMapping instanceof JaxbHbmCompositeAttributeType ) {
|
else if ( hbmAttributeMapping instanceof JaxbHbmCompositeAttributeType hbmComponent ) {
|
||||||
final JaxbHbmCompositeAttributeType hbmComponent = (JaxbHbmCompositeAttributeType) hbmAttributeMapping;
|
|
||||||
ormRoot.getEmbeddables().add( convertEmbeddable( hbmComponent ) );
|
ormRoot.getEmbeddables().add( convertEmbeddable( hbmComponent ) );
|
||||||
attributes.getEmbeddedAttributes().add( transformEmbedded( hbmComponent ) );
|
attributes.getEmbeddedAttributes().add( transformEmbedded( hbmComponent ) );
|
||||||
}
|
}
|
||||||
else if ( hbmAttributeMapping instanceof JaxbHbmPropertiesType ) {
|
else if ( hbmAttributeMapping instanceof JaxbHbmPropertiesType hbmProperties ) {
|
||||||
final JaxbHbmPropertiesType hbmProperties = (JaxbHbmPropertiesType) hbmAttributeMapping;
|
|
||||||
transferAttributes( hbmProperties.getAttributes(), attributes );
|
transferAttributes( hbmProperties.getAttributes(), attributes );
|
||||||
}
|
}
|
||||||
else if ( hbmAttributeMapping instanceof JaxbHbmDynamicComponentType ) {
|
else if ( hbmAttributeMapping instanceof JaxbHbmDynamicComponentType ) {
|
||||||
|
@ -1258,33 +1256,20 @@ public class HbmXmlTransformer {
|
||||||
name
|
name
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if ( hbmAttributeMapping instanceof JaxbHbmOneToOneType ) {
|
else if ( hbmAttributeMapping instanceof JaxbHbmOneToOneType o2o ) {
|
||||||
final JaxbHbmOneToOneType o2o = (JaxbHbmOneToOneType) hbmAttributeMapping;
|
|
||||||
transferOneToOne( o2o, attributes );
|
transferOneToOne( o2o, attributes );
|
||||||
}
|
}
|
||||||
else if ( hbmAttributeMapping instanceof JaxbHbmManyToOneType ) {
|
else if ( hbmAttributeMapping instanceof JaxbHbmManyToOneType m2o ) {
|
||||||
final JaxbHbmManyToOneType m2o = (JaxbHbmManyToOneType) hbmAttributeMapping;
|
|
||||||
attributes.getManyToOneAttributes().add( transformManyToOne( m2o ) );
|
attributes.getManyToOneAttributes().add( transformManyToOne( m2o ) );
|
||||||
}
|
}
|
||||||
else if ( hbmAttributeMapping instanceof JaxbHbmAnyAssociationType ) {
|
else if ( hbmAttributeMapping instanceof JaxbHbmAnyAssociationType any ) {
|
||||||
final JaxbHbmAnyAssociationType any = (JaxbHbmAnyAssociationType) hbmAttributeMapping;
|
|
||||||
attributes.getAnyMappingAttributes().add( transformAnyAttribute( any ) );
|
attributes.getAnyMappingAttributes().add( transformAnyAttribute( any ) );
|
||||||
|
|
||||||
}
|
}
|
||||||
else if ( hbmAttributeMapping instanceof PluralAttributeInfo ) {
|
else if ( hbmAttributeMapping instanceof PluralAttributeInfo pluralAttributeInfo ) {
|
||||||
final PluralAttributeInfo hbmCollection = (PluralAttributeInfo) hbmAttributeMapping;
|
if ( pluralAttributeInfo.getElement() != null
|
||||||
final CollectionAttribute target;
|
|| pluralAttributeInfo.getCompositeElement() != null ) {
|
||||||
|
attributes.getElementCollectionAttributes().add( transformElementCollection( pluralAttributeInfo ) );
|
||||||
if ( hbmCollection.getElement() != null
|
|
||||||
|| hbmCollection.getCompositeElement() != null ) {
|
|
||||||
target = new JaxbElementCollection();
|
|
||||||
if ( hbmCollection.getElement() != null ) {
|
|
||||||
transferElementInfo( hbmCollection, hbmCollection.getElement(), (JaxbElementCollection) target );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
transferElementInfo( hbmCollection, hbmCollection.getCompositeElement(), (JaxbElementCollection) target );
|
|
||||||
}
|
|
||||||
attributes.getElementCollectionAttributes().add( (JaxbElementCollection) target );
|
|
||||||
}
|
}
|
||||||
else if ( hbmCollection.getOneToMany() != null ) {
|
else if ( hbmCollection.getOneToMany() != null ) {
|
||||||
target = new JaxbOneToMany();
|
target = new JaxbOneToMany();
|
||||||
|
@ -1674,7 +1659,7 @@ public class HbmXmlTransformer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Serializable> getColumnOrFormula() {
|
public List<Serializable> getColumnOrFormula() {
|
||||||
return new ArrayList<Serializable>( source.getKey().getColumn() );
|
return new ArrayList<>( source.getKey().getColumn() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1720,13 +1705,11 @@ public class HbmXmlTransformer {
|
||||||
target.setAttributeAccessor( source.getAccess() );
|
target.setAttributeAccessor( source.getAccess() );
|
||||||
target.setFetchMode( convert( source.getFetch() ) );
|
target.setFetchMode( convert( source.getFetch() ) );
|
||||||
|
|
||||||
if ( source instanceof JaxbHbmSetType ) {
|
if ( source instanceof JaxbHbmSetType set ) {
|
||||||
final JaxbHbmSetType set = (JaxbHbmSetType) source;
|
|
||||||
target.setSort( set.getSort() );
|
target.setSort( set.getSort() );
|
||||||
target.setOrderBy( set.getOrderBy() );
|
target.setOrderBy( set.getOrderBy() );
|
||||||
}
|
}
|
||||||
else if ( source instanceof JaxbHbmMapType ) {
|
else if ( source instanceof JaxbHbmMapType map ) {
|
||||||
final JaxbHbmMapType map = (JaxbHbmMapType) source;
|
|
||||||
target.setSort( map.getSort() );
|
target.setSort( map.getSort() );
|
||||||
target.setOrderBy( map.getOrderBy() );
|
target.setOrderBy( map.getOrderBy() );
|
||||||
|
|
||||||
|
@ -1825,17 +1808,11 @@ public class HbmXmlTransformer {
|
||||||
|
|
||||||
private JaxbPluralFetchModeImpl convert(JaxbHbmFetchStyleWithSubselectEnum fetch) {
|
private JaxbPluralFetchModeImpl convert(JaxbHbmFetchStyleWithSubselectEnum fetch) {
|
||||||
if ( fetch != null ) {
|
if ( fetch != null ) {
|
||||||
switch ( fetch ) {
|
return switch ( fetch ) {
|
||||||
case SELECT: {
|
case SELECT -> JaxbPluralFetchModeImpl.SELECT;
|
||||||
return JaxbPluralFetchModeImpl.SELECT;
|
case JOIN -> JaxbPluralFetchModeImpl.JOIN;
|
||||||
}
|
case SUBSELECT -> JaxbPluralFetchModeImpl.SUBSELECT;
|
||||||
case JOIN: {
|
};
|
||||||
return JaxbPluralFetchModeImpl.JOIN;
|
|
||||||
}
|
|
||||||
case SUBSELECT: {
|
|
||||||
return JaxbPluralFetchModeImpl.SUBSELECT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -2023,13 +2000,8 @@ public class HbmXmlTransformer {
|
||||||
final boolean isAggregate;
|
final boolean isAggregate;
|
||||||
if ( isNotEmpty( hbmCompositeId.getClazz() ) ) {
|
if ( isNotEmpty( hbmCompositeId.getClazz() ) ) {
|
||||||
// we have <composite-id class="XYZ">.
|
// we have <composite-id class="XYZ">.
|
||||||
if ( hbmCompositeId.isMapped() ) {
|
// user explicitly said the class is an "IdClass"
|
||||||
// user explicitly said the class is an "IdClass"
|
isAggregate = !hbmCompositeId.isMapped();
|
||||||
isAggregate = false;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
isAggregate = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// there was no class specified, can only be non-aggregated
|
// there was no class specified, can only be non-aggregated
|
||||||
|
@ -2045,8 +2017,7 @@ public class HbmXmlTransformer {
|
||||||
embeddable.setClazz( hbmCompositeId.getClazz() );
|
embeddable.setClazz( hbmCompositeId.getClazz() );
|
||||||
embeddable.setAttributes( new JaxbEmbeddableAttributesContainerImpl() );
|
embeddable.setAttributes( new JaxbEmbeddableAttributesContainerImpl() );
|
||||||
for ( Object hbmCompositeAttribute : hbmCompositeId.getKeyPropertyOrKeyManyToOne() ) {
|
for ( Object hbmCompositeAttribute : hbmCompositeId.getKeyPropertyOrKeyManyToOne() ) {
|
||||||
if ( hbmCompositeAttribute instanceof JaxbHbmCompositeKeyBasicAttributeType ) {
|
if ( hbmCompositeAttribute instanceof JaxbHbmCompositeKeyBasicAttributeType keyProp ) {
|
||||||
final JaxbHbmCompositeKeyBasicAttributeType keyProp = (JaxbHbmCompositeKeyBasicAttributeType) hbmCompositeAttribute;
|
|
||||||
final JaxbBasicImpl basic = new JaxbBasicImpl();
|
final JaxbBasicImpl basic = new JaxbBasicImpl();
|
||||||
basic.setName( keyProp.getName() );
|
basic.setName( keyProp.getName() );
|
||||||
basic.setAttributeAccessor( keyProp.getAccess() );
|
basic.setAttributeAccessor( keyProp.getAccess() );
|
||||||
|
@ -2080,8 +2051,7 @@ public class HbmXmlTransformer {
|
||||||
idClass.setClazz( hbmCompositeId.getClazz() );
|
idClass.setClazz( hbmCompositeId.getClazz() );
|
||||||
target.setIdClass( idClass );
|
target.setIdClass( idClass );
|
||||||
for ( Object hbmCompositeAttribute : hbmCompositeId.getKeyPropertyOrKeyManyToOne() ) {
|
for ( Object hbmCompositeAttribute : hbmCompositeId.getKeyPropertyOrKeyManyToOne() ) {
|
||||||
if ( hbmCompositeAttribute instanceof JaxbHbmCompositeKeyBasicAttributeType ) {
|
if ( hbmCompositeAttribute instanceof JaxbHbmCompositeKeyBasicAttributeType keyProp ) {
|
||||||
final JaxbHbmCompositeKeyBasicAttributeType keyProp = (JaxbHbmCompositeKeyBasicAttributeType) hbmCompositeAttribute;
|
|
||||||
final JaxbIdImpl id = new JaxbIdImpl();
|
final JaxbIdImpl id = new JaxbIdImpl();
|
||||||
id.setName( keyProp.getName() );
|
id.setName( keyProp.getName() );
|
||||||
id.setAttributeAccessor( keyProp.getAccess() );
|
id.setAttributeAccessor( keyProp.getAccess() );
|
||||||
|
@ -2258,6 +2228,7 @@ public class HbmXmlTransformer {
|
||||||
version.setColumn( new JaxbColumnImpl() );
|
version.setColumn( new JaxbColumnImpl() );
|
||||||
version.getColumn().setName( hbmTimestamp.getColumnAttribute() );
|
version.getColumn().setName( hbmTimestamp.getColumnAttribute() );
|
||||||
}
|
}
|
||||||
|
//noinspection deprecation
|
||||||
version.setTemporal( TemporalType.TIMESTAMP );
|
version.setTemporal( TemporalType.TIMESTAMP );
|
||||||
target.getAttributes().getVersion().add( version );
|
target.getAttributes().getVersion().add( version );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
/*
|
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
|
||||||
*
|
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
|
||||||
*/
|
|
||||||
package org.hibernate.internal.util;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Steve Ebersole
|
|
||||||
*/
|
|
||||||
@FunctionalInterface
|
|
||||||
public interface NamedConsumer<T> {
|
|
||||||
void consume(String name, T thing);
|
|
||||||
}
|
|
Loading…
Reference in New Issue