HHH-15251 - Unified mapping XSD based on JPA 3.1

- more work on HbmXmlTransformer
This commit is contained in:
Steve Ebersole 2022-05-25 08:40:26 -05:00
parent 309edd9e32
commit 19f513dde2
1 changed files with 8 additions and 6 deletions

View File

@ -229,7 +229,10 @@ public class HbmXmlTransformer {
} }
private <T> void transfer(Supplier<T> source, Consumer<T> target) { private <T> void transfer(Supplier<T> source, Consumer<T> target) {
target.accept( source.get() ); final T value = source.get();
if ( value != null ) {
target.accept( value );
}
} }
private void handleUnsupportedContent(String description) { private void handleUnsupportedContent(String description) {
@ -808,16 +811,15 @@ public class HbmXmlTransformer {
if ( hbmClass.getTable() != null ) { if ( hbmClass.getTable() != null ) {
entity.setTable( new JaxbTable() ); entity.setTable( new JaxbTable() );
transfer( hbmClass::getTable, entity.getTable()::setName ); transfer( hbmClass::getTable, entity.getTable()::setName );
transfer( hbmClass::getCatalog, entity.getTable()::setCatalog );
transfer( hbmClass::getSchema, entity.getTable()::setSchema );
transfer( hbmClass::getComment, entity.getTable()::setComment );
transfer( hbmClass::getCheck, entity.getTable()::setCheck );
} }
else { else {
transfer( hbmClass::getSubselect, entity::setTableExpression ); transfer( hbmClass::getSubselect, entity::setTableExpression );
} }
transfer( hbmClass::getCatalog, entity.getTable()::setCatalog );
transfer( hbmClass::getSchema, entity.getTable()::setSchema );
transfer( hbmClass::getComment, entity.getTable()::setComment );
transfer( hbmClass::getCheck, entity.getTable()::setCheck );
for ( JaxbHbmSynchronizeType hbmSync : hbmClass.getSynchronize() ) { for ( JaxbHbmSynchronizeType hbmSync : hbmClass.getSynchronize() ) {
final JaxbSynchronizedTable sync = new JaxbSynchronizedTable(); final JaxbSynchronizedTable sync = new JaxbSynchronizedTable();
sync.setTable( hbmSync.getTable() ); sync.setTable( hbmSync.getTable() );