HHH-6261 formatting
This commit is contained in:
parent
19f629b461
commit
ec0e823b64
|
@ -26,7 +26,6 @@ package org.hibernate.metamodel.source.annotations.entity;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.persistence.GenerationType;
|
import javax.persistence.GenerationType;
|
||||||
|
|
||||||
import org.jboss.jandex.AnnotationInstance;
|
import org.jboss.jandex.AnnotationInstance;
|
||||||
|
@ -45,8 +44,8 @@ import org.hibernate.id.factory.DefaultIdentifierGeneratorFactory;
|
||||||
import org.hibernate.internal.util.StringHelper;
|
import org.hibernate.internal.util.StringHelper;
|
||||||
import org.hibernate.metamodel.binding.Caching;
|
import org.hibernate.metamodel.binding.Caching;
|
||||||
import org.hibernate.metamodel.binding.EntityBinding;
|
import org.hibernate.metamodel.binding.EntityBinding;
|
||||||
import org.hibernate.metamodel.binding.IdGenerator;
|
|
||||||
import org.hibernate.metamodel.binding.EntityDiscriminator;
|
import org.hibernate.metamodel.binding.EntityDiscriminator;
|
||||||
|
import org.hibernate.metamodel.binding.IdGenerator;
|
||||||
import org.hibernate.metamodel.binding.ManyToOneAttributeBinding;
|
import org.hibernate.metamodel.binding.ManyToOneAttributeBinding;
|
||||||
import org.hibernate.metamodel.binding.SimpleAttributeBinding;
|
import org.hibernate.metamodel.binding.SimpleAttributeBinding;
|
||||||
import org.hibernate.metamodel.binding.state.DiscriminatorBindingState;
|
import org.hibernate.metamodel.binding.state.DiscriminatorBindingState;
|
||||||
|
@ -354,7 +353,6 @@ public class EntityBinder {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void bindSingleIdGeneratedValue(EntityBinding entityBinding, String idPropertyName) {
|
private void bindSingleIdGeneratedValue(EntityBinding entityBinding, String idPropertyName) {
|
||||||
AnnotationInstance generatedValueAnn = JandexHelper.getSingleAnnotation(
|
AnnotationInstance generatedValueAnn = JandexHelper.getSingleAnnotation(
|
||||||
configuredClass.getClassInfo(), JPADotNames.GENERATED_VALUE
|
configuredClass.getClassInfo(), JPADotNames.GENERATED_VALUE
|
||||||
|
@ -389,8 +387,15 @@ public class EntityBinder {
|
||||||
}
|
}
|
||||||
entityBinding.getEntityIdentifier().setIdGenerator( idGenerator );
|
entityBinding.getEntityIdentifier().setIdGenerator( idGenerator );
|
||||||
}
|
}
|
||||||
GenerationType generationType = JandexHelper.getValueAsEnum( generatedValueAnn, "strategy", GenerationType.class );
|
GenerationType generationType = JandexHelper.getValueAsEnum(
|
||||||
String strategy = DefaultIdentifierGeneratorFactory.generatorType( generationType, meta.getOptions().useNewIdentifierGenerators() );
|
generatedValueAnn,
|
||||||
|
"strategy",
|
||||||
|
GenerationType.class
|
||||||
|
);
|
||||||
|
String strategy = DefaultIdentifierGeneratorFactory.generatorType(
|
||||||
|
generationType,
|
||||||
|
meta.getOptions().useNewIdentifierGenerators()
|
||||||
|
);
|
||||||
if ( idGenerator != null && !strategy.equals( idGenerator.getStrategy() ) ) {
|
if ( idGenerator != null && !strategy.equals( idGenerator.getStrategy() ) ) {
|
||||||
//todo how to ?
|
//todo how to ?
|
||||||
throw new MappingException(
|
throw new MappingException(
|
||||||
|
@ -400,7 +405,8 @@ public class EntityBinder {
|
||||||
idName
|
idName
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
} else{
|
}
|
||||||
|
else {
|
||||||
idGenerator = new IdGenerator( "NAME", strategy, new HashMap<String, String>() );
|
idGenerator = new IdGenerator( "NAME", strategy, new HashMap<String, String>() );
|
||||||
entityBinding.getEntityIdentifier().setIdGenerator( idGenerator );
|
entityBinding.getEntityIdentifier().setIdGenerator( idGenerator );
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,8 +23,6 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.metamodel.source.spi;
|
package org.hibernate.metamodel.source.spi;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.hibernate.engine.spi.FilterDefinition;
|
import org.hibernate.engine.spi.FilterDefinition;
|
||||||
import org.hibernate.metamodel.Metadata;
|
import org.hibernate.metamodel.Metadata;
|
||||||
import org.hibernate.metamodel.binding.EntityBinding;
|
import org.hibernate.metamodel.binding.EntityBinding;
|
||||||
|
@ -40,9 +38,11 @@ import org.hibernate.type.TypeResolver;
|
||||||
*/
|
*/
|
||||||
public interface MetadataImplementor extends Metadata {
|
public interface MetadataImplementor extends Metadata {
|
||||||
public BasicServiceRegistry getServiceRegistry();
|
public BasicServiceRegistry getServiceRegistry();
|
||||||
|
|
||||||
public Database getDatabase();
|
public Database getDatabase();
|
||||||
|
|
||||||
public Iterable<EntityBinding> getEntityBindings();
|
public Iterable<EntityBinding> getEntityBindings();
|
||||||
|
|
||||||
public EntityBinding getEntityBinding(String entityName);
|
public EntityBinding getEntityBinding(String entityName);
|
||||||
|
|
||||||
public TypeResolver getTypeResolver();
|
public TypeResolver getTypeResolver();
|
||||||
|
|
Loading…
Reference in New Issue