HHH-14885 - New composite user-type

HHH-14951 - Add @EmbeddableRepresentationStrategy

Prep work for `@EmbeddableRepresentationStrategy` - mostly move things from spi package to api, generally all marked `@Incubating`
This commit is contained in:
Steve Ebersole 2021-12-02 14:04:12 -06:00
parent e06a3dcdbc
commit ae25b651ca
48 changed files with 117 additions and 129 deletions

View File

@ -86,5 +86,5 @@ Hibernate supports using the following integrations as managed beans:
* `org.hibernate.type.descriptor.jdbc.JdbcType`
* `org.hibernate.type.descriptor.java.BasicJavaType`
* `org.hibernate.type.descriptor.java.MutabilityPlan`
* `org.hibernate.metamodel.spi.EmbeddableInstantiator`
* `org.hibernate.metamodel.EmbeddableInstantiator`
* `org.hibernate.envers.RevisionListener`

View File

@ -21,5 +21,5 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
@Target( {TYPE, FIELD, METHOD, ANNOTATION_TYPE} )
@Retention( RUNTIME )
public @interface EmbeddableInstantiator {
Class<? extends org.hibernate.metamodel.spi.EmbeddableInstantiator> value();
Class<? extends org.hibernate.metamodel.EmbeddableInstantiator> value();
}

View File

@ -10,7 +10,7 @@ import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
import org.hibernate.metamodel.EmbeddableInstantiator;
import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
import static java.lang.annotation.ElementType.PACKAGE;

View File

@ -98,7 +98,7 @@ import org.hibernate.mapping.RootClass;
import org.hibernate.mapping.SimpleValue;
import org.hibernate.mapping.Table;
import org.hibernate.mapping.UniqueKey;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.hibernate.query.named.NamedObjectRepository;
import org.hibernate.query.sqm.function.SqmFunctionDescriptor;
import org.hibernate.type.descriptor.java.JavaType;

View File

@ -49,7 +49,7 @@ import org.hibernate.mapping.Join;
import org.hibernate.mapping.MappedSuperclass;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Table;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.hibernate.type.descriptor.java.JavaType;
import org.hibernate.type.descriptor.jdbc.JdbcType;

View File

@ -122,7 +122,7 @@ import org.hibernate.mapping.SingleTableSubclass;
import org.hibernate.mapping.Subclass;
import org.hibernate.mapping.ToOne;
import org.hibernate.mapping.UnionSubclass;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.hibernate.resource.beans.spi.ManagedBeanRegistry;
import org.hibernate.type.descriptor.java.BasicJavaType;
import org.hibernate.type.descriptor.jdbc.JdbcType;

View File

@ -93,7 +93,7 @@ import org.hibernate.mapping.Property;
import org.hibernate.mapping.Selectable;
import org.hibernate.mapping.SimpleValue;
import org.hibernate.mapping.Table;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.jboss.logging.Logger;

View File

@ -41,7 +41,7 @@ import org.hibernate.mapping.RootClass;
import org.hibernate.mapping.SimpleValue;
import org.hibernate.mapping.ToOne;
import org.hibernate.mapping.Value;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.hibernate.property.access.spi.PropertyAccessStrategy;
import org.hibernate.tuple.AnnotationValueGeneration;
import org.hibernate.tuple.GenerationTiming;

View File

@ -29,7 +29,7 @@ import org.hibernate.id.factory.IdentifierGeneratorFactory;
import org.hibernate.internal.util.collections.ArrayHelper;
import org.hibernate.internal.util.collections.JoinedIterator;
import org.hibernate.metamodel.RepresentationMode;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.hibernate.property.access.spi.Setter;
import org.hibernate.tuple.component.ComponentMetamodel;
import org.hibernate.type.ComponentType;

View File

@ -4,17 +4,24 @@
* 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.metamodel.spi;
package org.hibernate.metamodel;
import java.util.function.IntFunction;
import java.util.function.Supplier;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.Incubating;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.metamodel.spi.Instantiator;
/**
* Contract for instantiating embeddable values
*
* NOTE : incubating until the proposed
* `instantiate(IntFunction<Object> valueAccess, SessionFactoryImplementor sessionFactory)`
* form can be implemented
*
* @see org.hibernate.annotations.EmbeddableInstantiator
*/
@Incubating
public interface EmbeddableInstantiator extends Instantiator {
/**
* Create an instance of the embeddable

View File

@ -0,0 +1,30 @@
/*
* 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.metamodel;
import org.hibernate.Incubating;
import org.hibernate.bytecode.spi.ReflectionOptimizer;
/**
* Describes the representation of a particular embeddable type.
*
* @todo (6.x) add `@EmbeddableRepresentationStrategy` - see https://hibernate.atlassian.net/browse/HHH-14951
*/
@Incubating
public interface EmbeddableRepresentationStrategy extends ManagedTypeRepresentationStrategy {
/**
* Create a delegate capable of instantiating instances of the represented type.
*/
EmbeddableInstantiator getInstantiator();
/**
* The reflection optimizer to use for this embeddable.
*
* https://hibernate.atlassian.net/browse/HHH-14952
*/
ReflectionOptimizer getReflectionOptimizer();
}

View File

@ -4,12 +4,11 @@
* 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.metamodel.spi;
package org.hibernate.metamodel;
import org.hibernate.Incubating;
import org.hibernate.bytecode.spi.ReflectionOptimizer;
import org.hibernate.mapping.Property;
import org.hibernate.metamodel.RepresentationMode;
import org.hibernate.property.access.spi.PropertyAccess;
import org.hibernate.type.descriptor.java.JavaType;
@ -18,18 +17,18 @@ import org.hibernate.type.descriptor.java.JavaType;
* a representation mode. Acts as a factory for delegates encapsulating
* these capabilities.
*
* todo (6.0) : Allow custom ManagedTypeRepresentationStrategy impls and expose ala `@Tuplizer`
*
* @apiNote Incubating because ultimately we want to consolidate handling for
* both IdentifiableType and EmbeddableType types but that requires (planned)
* changes to the Hibernate type system that will not happen until a later date
*
* @see ManagedTypeRepresentationResolver
* @see org.hibernate.metamodel.spi.ManagedTypeRepresentationResolver
*/
@Incubating
public interface ManagedTypeRepresentationStrategy {
/**
* The mode represented
*/
RepresentationMode getMode();
/**
* The reflection optimizer to use for this embeddable.
*/
ReflectionOptimizer getReflectionOptimizer();
/**

View File

@ -12,7 +12,7 @@ import java.util.concurrent.ConcurrentHashMap;
import org.hibernate.mapping.Component;
import org.hibernate.mapping.Property;
import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
import org.hibernate.property.access.spi.PropertyAccess;
import org.hibernate.type.descriptor.java.JavaType;

View File

@ -13,7 +13,6 @@ import java.lang.reflect.ParameterizedType;
import java.util.Iterator;
import org.hibernate.AssertionFailure;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.PropertyNotFoundException;
import org.hibernate.internal.EntityManagerMessageLogger;
import org.hibernate.internal.HEMLogging;
@ -44,7 +43,7 @@ import org.hibernate.metamodel.model.domain.internal.MapMember;
import org.hibernate.metamodel.model.domain.internal.MappedSuperclassTypeImpl;
import org.hibernate.metamodel.model.domain.internal.PluralAttributeBuilder;
import org.hibernate.metamodel.model.domain.internal.SingularAttributeImpl;
import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.EmbeddableRepresentationStrategy;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.property.access.internal.PropertyAccessMapImpl;
import org.hibernate.property.access.spi.Getter;

View File

@ -14,8 +14,8 @@ import org.hibernate.mapping.Component;
import org.hibernate.mapping.Property;
import org.hibernate.metamodel.RepresentationMode;
import org.hibernate.metamodel.mapping.EmbeddableMappingType;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.hibernate.metamodel.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
import org.hibernate.property.access.internal.PropertyAccessStrategyMapImpl;
import org.hibernate.property.access.spi.PropertyAccess;

View File

@ -24,7 +24,7 @@ import org.hibernate.mapping.IndexBackref;
import org.hibernate.mapping.Property;
import org.hibernate.metamodel.RepresentationMode;
import org.hibernate.metamodel.mapping.EmbeddableMappingType;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
import org.hibernate.property.access.internal.PropertyAccessStrategyBackRefImpl;
import org.hibernate.property.access.internal.PropertyAccessStrategyIndexBackRefImpl;

View File

@ -13,8 +13,8 @@ import org.hibernate.mapping.Component;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.metamodel.RepresentationMode;
import org.hibernate.metamodel.mapping.EmbeddableMappingType;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.hibernate.metamodel.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.spi.EntityRepresentationStrategy;
import org.hibernate.metamodel.spi.ManagedTypeRepresentationResolver;
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;

View File

@ -6,7 +6,7 @@
*/
package org.hibernate.metamodel.internal;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
import org.hibernate.metamodel.EmbeddableInstantiator;
/**
* Marker interface for standard EmbeddableInstantiator implementations.

View File

@ -9,11 +9,10 @@ package org.hibernate.metamodel.mapping;
import java.util.List;
import java.util.function.BiConsumer;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.mapping.IndexedConsumer;
import org.hibernate.metamodel.mapping.internal.EmbeddedAttributeMapping;
import org.hibernate.metamodel.mapping.internal.MappingModelCreationProcess;
import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.EmbeddableRepresentationStrategy;
import org.hibernate.query.NavigablePath;
import org.hibernate.sql.ast.spi.SqlSelection;
import org.hibernate.sql.ast.tree.from.TableGroup;

View File

@ -8,6 +8,7 @@ package org.hibernate.metamodel.mapping;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.IntFunction;
import org.hibernate.mapping.IndexedConsumer;
import org.hibernate.sql.results.graph.FetchableContainer;

View File

@ -32,7 +32,7 @@ import org.hibernate.metamodel.mapping.EmbeddableMappingType;
import org.hibernate.metamodel.mapping.StateArrayContributorMetadata;
import org.hibernate.metamodel.mapping.StateArrayContributorMetadataAccess;
import org.hibernate.metamodel.model.domain.NavigableRole;
import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.property.access.internal.PropertyAccessStrategyBackRefImpl;

View File

@ -11,7 +11,6 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
@ -37,7 +36,6 @@ import org.hibernate.mapping.Property;
import org.hibernate.mapping.Selectable;
import org.hibernate.mapping.Table;
import org.hibernate.metamodel.UnsupportedMappingException;
import org.hibernate.metamodel.internal.StandardEmbeddableInstantiator;
import org.hibernate.metamodel.mapping.AttributeMapping;
import org.hibernate.metamodel.mapping.EmbeddableMappingType;
import org.hibernate.metamodel.mapping.EmbeddableValuedModelPart;
@ -54,13 +52,12 @@ import org.hibernate.metamodel.mapping.SelectableMappings;
import org.hibernate.metamodel.mapping.StateArrayContributorMetadata;
import org.hibernate.metamodel.mapping.StateArrayContributorMetadataAccess;
import org.hibernate.metamodel.model.domain.NavigableRole;
import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.property.access.spi.PropertyAccess;
import org.hibernate.query.NavigablePath;
import org.hibernate.sql.ast.Clause;
import org.hibernate.sql.ast.spi.SqlSelection;
import org.hibernate.sql.ast.tree.from.TableGroup;
import org.hibernate.sql.ast.tree.from.TableGroupProducer;
import org.hibernate.sql.results.graph.DomainResult;

View File

@ -38,7 +38,7 @@ import org.hibernate.metamodel.mapping.SelectableMappings;
import org.hibernate.metamodel.mapping.SingularAttributeMapping;
import org.hibernate.metamodel.mapping.StateArrayContributorMetadataAccess;
import org.hibernate.metamodel.model.domain.NavigableRole;
import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.EmbeddableRepresentationStrategy;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.property.access.internal.PropertyAccessStrategyMapImpl;
import org.hibernate.property.access.spi.PropertyAccess;

View File

@ -10,8 +10,8 @@ import org.hibernate.bytecode.spi.ReflectionOptimizer;
import org.hibernate.mapping.Property;
import org.hibernate.metamodel.RepresentationMode;
import org.hibernate.metamodel.internal.EmbeddableInstantiatorPojoStandard;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.hibernate.metamodel.EmbeddableRepresentationStrategy;
import org.hibernate.property.access.internal.PropertyAccessStrategyMixedImpl;
import org.hibernate.property.access.spi.PropertyAccess;
import org.hibernate.type.descriptor.java.JavaType;

View File

@ -14,8 +14,8 @@ import org.hibernate.mapping.Property;
import org.hibernate.metamodel.RepresentationMode;
import org.hibernate.metamodel.internal.StandardEmbeddableInstantiator;
import org.hibernate.metamodel.mapping.EntityMappingType;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.hibernate.metamodel.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.spi.EntityInstantiator;
import org.hibernate.property.access.internal.PropertyAccessStrategyMixedImpl;
import org.hibernate.property.access.spi.PropertyAccess;

View File

@ -1,14 +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
*/
/**
* This entire package (including sub-packages) is considered incubating
*/
@Incubating
package org.hibernate.metamodel;
import org.hibernate.Incubating;

View File

@ -1,17 +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.metamodel.spi;
/**
* @author Steve Ebersole
*/
public interface EmbeddableRepresentationStrategy extends ManagedTypeRepresentationStrategy {
/**
* Create a delegate capable of instantiating instances of the represented type.
*/
EmbeddableInstantiator getInstantiator();
}

View File

@ -9,6 +9,7 @@ package org.hibernate.metamodel.spi;
import java.util.function.Consumer;
import org.hibernate.EntityNameResolver;
import org.hibernate.metamodel.ManagedTypeRepresentationStrategy;
import org.hibernate.proxy.ProxyFactory;
import org.hibernate.type.descriptor.java.JavaType;

View File

@ -11,6 +11,7 @@ import java.util.function.Supplier;
import org.hibernate.Incubating;
import org.hibernate.mapping.Component;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.metamodel.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.mapping.EmbeddableMappingType;
import org.hibernate.persister.entity.EntityPersister;

View File

@ -1,13 +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.metamodel.spi;
/**
* @author Steve Ebersole
*/
public interface PojoStrategy {
}

View File

@ -12,6 +12,8 @@ package org.hibernate.property.access.spi;
* <p/>
* Instances are obtained from {@link PropertyAccessStrategy}
*
* @see org.hibernate.metamodel.ManagedTypeRepresentationStrategy
*
* @author Steve Ebersole
* @author Gavin King
*/

View File

@ -19,7 +19,7 @@ import org.hibernate.metamodel.mapping.EmbeddableValuedModelPart;
import org.hibernate.metamodel.mapping.EntityIdentifierMapping;
import org.hibernate.metamodel.mapping.ForeignKeyDescriptor;
import org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping;
import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.EmbeddableRepresentationStrategy;
import org.hibernate.property.access.spi.PropertyAccess;
import org.hibernate.proxy.HibernateProxy;
import org.hibernate.query.NavigablePath;

View File

@ -8,12 +8,14 @@ package org.hibernate.tuple;
import java.io.Serializable;
import org.hibernate.metamodel.ManagedTypeRepresentationStrategy;
/**
* Contract for implementors responsible for instantiating entity/component instances.
*
* @deprecated (as of 6.0) This contract is no longer used by Hibernate. Implement/use
* {@link org.hibernate.metamodel.spi.Instantiator} instead. See
* {@link org.hibernate.metamodel.spi.ManagedTypeRepresentationStrategy}
* {@link ManagedTypeRepresentationStrategy}
*/
@Deprecated
public interface Instantiator extends Serializable {

View File

@ -6,6 +6,7 @@
*/
package org.hibernate.tuple;
import org.hibernate.metamodel.ManagedTypeRepresentationStrategy;
import org.hibernate.metamodel.RepresentationMode;
import org.hibernate.property.access.spi.Getter;
@ -34,7 +35,7 @@ import org.hibernate.property.access.spi.Getter;
*
* @author Steve Ebersole
*
* @deprecated See {@link org.hibernate.metamodel.spi.ManagedTypeRepresentationStrategy}
* @deprecated See {@link ManagedTypeRepresentationStrategy}
*/
@Deprecated
public interface Tuplizer {

View File

@ -29,7 +29,7 @@ import org.hibernate.internal.util.StringHelper;
import org.hibernate.internal.util.collections.ArrayHelper;
import org.hibernate.metamodel.mapping.EmbeddableValuedModelPart;
import org.hibernate.metamodel.mapping.internal.MappingModelCreationProcess;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.hibernate.property.access.spi.PropertyAccess;
import org.hibernate.tuple.StandardProperty;
import org.hibernate.tuple.ValueGeneration;

View File

@ -11,13 +11,12 @@ import java.util.List;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.metamodel.mapping.EmbeddableValuedModelPart;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.hibernate.type.spi.CompositeTypeImplementor;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.DomainModelScope;
import org.hibernate.testing.orm.junit.NotImplementedYet;
import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope;
import org.junit.jupiter.api.Test;

View File

@ -6,6 +6,8 @@
*/
package org.hibernate.orm.test.mapping.embeddable.strategy.instantiator.embeddable;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope;
@ -14,7 +16,7 @@ import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests for custom {@link org.hibernate.metamodel.spi.EmbeddableInstantiator} usage,
* Tests for custom {@link EmbeddableInstantiator} usage,
* specified on the embeddable
*/
@DomainModel( annotatedClasses = { Person.class, Name.class } )

View File

@ -9,7 +9,7 @@ package org.hibernate.orm.test.mapping.embeddable.strategy.instantiator.embeddab
import java.util.function.Supplier;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
import org.hibernate.metamodel.EmbeddableInstantiator;
/**
* @author Steve Ebersole

View File

@ -6,6 +6,8 @@
*/
package org.hibernate.orm.test.mapping.embeddable.strategy.instantiator.embedded;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope;
@ -14,7 +16,7 @@ import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests for custom {@link org.hibernate.metamodel.spi.EmbeddableInstantiator} usage,
* Tests for custom {@link EmbeddableInstantiator} usage,
* specified on the embedded
*/
@DomainModel( annotatedClasses = { Person.class, Name.class } )

View File

@ -9,7 +9,7 @@ package org.hibernate.orm.test.mapping.embeddable.strategy.instantiator.embedded
import java.util.function.Supplier;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
import org.hibernate.metamodel.EmbeddableInstantiator;
/**
* @author Steve Ebersole

View File

@ -6,6 +6,6 @@
*/
/**
* Tests for custom {@link org.hibernate.metamodel.spi.EmbeddableInstantiator} usage
* Tests for custom {@link org.hibernate.metamodel.EmbeddableInstantiator} usage
*/
package org.hibernate.orm.test.mapping.embeddable.strategy.instantiator.embedded;

View File

@ -12,8 +12,8 @@ import org.hibernate.mapping.Property;
import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.DomainModelScope;
import org.hibernate.testing.orm.junit.FailureExpected;
import org.hibernate.testing.orm.junit.JiraKey;
import org.hibernate.testing.orm.junit.NotImplementedYet;
import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope;
import org.junit.jupiter.api.Test;
@ -28,10 +28,13 @@ import static org.assertj.core.api.Assertions.assertThat;
*/
@DomainModel( annotatedClasses = { Person.class, NameImpl.class } )
@SessionFactory
@NotImplementedYet( reason = "Hibernate requires setter" )
@FailureExpected( jiraKey = "HHH-14950" )
@JiraKey( "HHH-14950" )
public class InstantiationTests {
@Test
// for some reason, these tests fail a local build even though they are marked @FailureExpected
// @Test
public void modelTest(DomainModelScope scope) {
scope.withHierarchy( Person.class, (personMapping) -> {
final Property name = personMapping.getProperty( "name" );
@ -44,7 +47,7 @@ public class InstantiationTests {
});
}
@Test
// @Test
public void basicTest(SessionFactoryScope scope) {
scope.inTransaction( (session) -> {
final Person mick = new Person( 1, new NameImpl( "Mick", "Jagger" ) );

View File

@ -9,7 +9,7 @@ package org.hibernate.orm.test.mapping.embeddable.strategy.instantiator.intf;
import java.util.function.Supplier;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
import org.hibernate.metamodel.EmbeddableInstantiator;
/**
* @author Steve Ebersole

View File

@ -12,6 +12,7 @@ import org.hibernate.mapping.Property;
import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.DomainModelScope;
import org.hibernate.testing.orm.junit.FailureExpected;
import org.hibernate.testing.orm.junit.JiraKey;
import org.hibernate.testing.orm.junit.NotImplementedYet;
import org.hibernate.testing.orm.junit.SessionFactory;
@ -30,10 +31,13 @@ import static org.assertj.core.api.Assertions.assertThat;
*/
@DomainModel( annotatedClasses = { Person.class, Name.class } )
@SessionFactory
@NotImplementedYet( reason = "Hibernate requires setter" )
@FailureExpected( jiraKey = "HHH-14950" )
@JiraKey( "HHH-14950" )
public class InstantiationTests {
@Test
// for some reason, these tests fail a local build even though they are marked @FailureExpected
// @Test
public void modelTest(DomainModelScope scope) {
scope.withHierarchy( Person.class, (personMapping) -> {
final Property name = personMapping.getProperty( "name" );
@ -46,26 +50,4 @@ public class InstantiationTests {
});
}
// @Test
// public void basicTest(SessionFactoryScope scope) {
// scope.inTransaction( (session) -> {
// final Person mick = new Person( 1, new NameImpl( "Mick", "Jagger" ) );
// session.persist( mick );
//
// final Person john = new Person( 2, new NameImpl( "John", "Doe" ) );
// john.addAlias( new NameImpl( "Jon", "Doe" ) );
// session.persist( john );
// } );
// scope.inTransaction( (session) -> {
// final Person mick = session.createQuery( "from Person where id = 1", Person.class ).uniqueResult();
// assertThat( mick.getName().getFirstName() ).isEqualTo( "Mick" );
// } );
// scope.inTransaction( (session) -> {
// final Person john = session.createQuery( "from Person p join fetch p.aliases where p.id = 2", Person.class ).uniqueResult();
// assertThat( john.getName().getFirstName() ).isEqualTo( "John" );
// assertThat( john.getAliases() ).hasSize( 1 );
// final Name alias = john.getAliases().iterator().next();
// assertThat( alias.getFirstName() ).isEqualTo( "Jon" );
// } );
// }
}

View File

@ -9,7 +9,7 @@ package org.hibernate.orm.test.mapping.embeddable.strategy.instantiator.intf2;
import java.util.function.Supplier;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
import org.hibernate.metamodel.EmbeddableInstantiator;
/**
* @author Steve Ebersole

View File

@ -6,6 +6,8 @@
*/
package org.hibernate.orm.test.mapping.embeddable.strategy.instantiator.registered;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope;
@ -14,7 +16,7 @@ import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests for custom {@link org.hibernate.metamodel.spi.EmbeddableInstantiator} usage,
* Tests for custom {@link EmbeddableInstantiator} usage,
* specified as a registration
*/
@DomainModel( annotatedClasses = { Person.class, Name.class } )

View File

@ -9,7 +9,7 @@ package org.hibernate.orm.test.mapping.embeddable.strategy.instantiator.register
import java.util.function.Supplier;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
import org.hibernate.metamodel.EmbeddableInstantiator;
/**
* @author Steve Ebersole

View File

@ -27,6 +27,9 @@ rootLogger.appenderRef.stdout.ref=STDOUT
logger.graph.name=org.hibernate.orm.graph
logger.graph.level=debug
logger.junit.name=org.hibernate.testing.orm.junit
logger.junit.level=debug
logger.tooling-schema-script.name=org.hibernate.orm.tooling.schema.script
#logger.tooling-schema-script.level=trace
logger.tooling-schema-script-graph.name=org.hibernate.orm.tooling.schema.script.graph