Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
import org.hibernate.internal.util.collections.CollectionHelper;

import static java.util.Collections.emptyMap;
import static org.hibernate.internal.util.StringHelper.isNotEmpty;
import static org.hibernate.internal.util.StringHelper.unqualify;

/**
* @author Steve Ebersole
Expand Down Expand Up @@ -97,19 +99,20 @@ protected AbstractEntitySourceImpl(MappingDocument sourceMappingDocument, JaxbHb
);
}

public static EntityNamingSourceImpl extractEntityNamingSource(
static EntityNamingSourceImpl extractEntityNamingSource(
MappingDocument sourceMappingDocument,
EntityInfo jaxbEntityMapping) {
final String className = sourceMappingDocument.qualifyClassName( jaxbEntityMapping.getName() );
final String mappingEntityName = jaxbEntityMapping.getEntityName();
final String entityName;
final String jpaEntityName;
if ( StringHelper.isNotEmpty( jaxbEntityMapping.getEntityName() ) ) {
entityName = jaxbEntityMapping.getEntityName();
jpaEntityName = jaxbEntityMapping.getEntityName();
if ( isNotEmpty( mappingEntityName ) ) {
entityName = mappingEntityName;
jpaEntityName = mappingEntityName;
}
else {
entityName = className;
jpaEntityName = StringHelper.unqualify( className );
jpaEntityName = unqualify( className );
}
return new EntityNamingSourceImpl( entityName, className, jpaEntityName );
}
Expand All @@ -122,7 +125,7 @@ private FilterSource[] buildFilterSources() {
return NO_FILTER_SOURCES;
}

FilterSource[] results = new FilterSource[size];
final var results = new FilterSource[size];
for ( int i = 0; i < size; i++ ) {
JaxbHbmFilterType element = jaxbClassElement.getFilter().get( i );
results[i] = new FilterSourceImpl( sourceMappingDocument(), element );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
package org.hibernate.boot.model.source.internal.hbm;

import org.hibernate.boot.model.source.spi.EntityNamingSource;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.mapping.PersistentClass;

import static org.hibernate.internal.util.StringHelper.isNotEmpty;

/**
* Implementation of EntityNamingSource
*
Expand All @@ -24,12 +25,13 @@ public EntityNamingSourceImpl(String entityName, String className, String jpaEnt
this.entityName = entityName;
this.className = className;
this.jpaEntityName = jpaEntityName;

this.typeName = StringHelper.isNotEmpty( className ) ? className : entityName;
this.typeName = isNotEmpty( className ) ? className : entityName;
}

public EntityNamingSourceImpl(PersistentClass entityBinding) {
this( entityBinding.getEntityName(), entityBinding.getClassName(), entityBinding.getJpaEntityName() );
this( entityBinding.getEntityName(),
entityBinding.getClassName(),
entityBinding.getJpaEntityName() );
}

@Override
Expand Down
Loading