code stringlengths 23 201k | docstring stringlengths 17 96.2k | func_name stringlengths 0 235 | language stringclasses 1
value | repo stringlengths 8 72 | path stringlengths 11 317 | url stringlengths 57 377 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
@Override
public E set(int index, E value) {
initialize( true );
return getRawList().set( index, value );
} | todo (6.0) : much of this is copy-paste from PersistentList
this is true for most attempts at a custom PersistentCollection;
we need to clean these up so it is easier to provide custom
implementations | set | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/semantics/UniqueListWrapper.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/semantics/UniqueListWrapper.java | Apache-2.0 |
@Override
public void add(int index, E value) {
final boolean added = addAt( index, value );
if ( !added ) {
throw new IllegalArgumentException( "Cannot add given element to unique List as it already existed" );
}
} | todo (6.0) : much of this is copy-paste from PersistentList
this is true for most attempts at a custom PersistentCollection;
we need to clean these up so it is easier to provide custom
implementations | add | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/semantics/UniqueListWrapper.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/semantics/UniqueListWrapper.java | Apache-2.0 |
@Test
public void testMappingAttributeWithLobAndAttributeConverter(ServiceRegistryScope scope) {
final Metadata metadata = new MetadataSources( scope.getRegistry() )
.addAnnotatedClass( EntityImpl.class )
.buildMetadata();
final Type type = metadata.getEntityBinding( EntityImpl.class.getName() ).getProper... | Test mapping a model with an attribute combining {@code @Lob} with an AttributeConverter.
<p>
Originally developed to diagnose HHH-9615
@author Steve Ebersole | testMappingAttributeWithLobAndAttributeConverter | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AndLobTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AndLobTest.java | Apache-2.0 |
@Override
public Integer convertToDatabaseColumn(String attribute) {
return attribute.length();
} | Test mapping a model with an attribute combining {@code @Lob} with an AttributeConverter.
<p>
Originally developed to diagnose HHH-9615
@author Steve Ebersole | convertToDatabaseColumn | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AndLobTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AndLobTest.java | Apache-2.0 |
@Override
public String convertToEntityAttribute(Integer dbData) {
return "";
} | Test mapping a model with an attribute combining {@code @Lob} with an AttributeConverter.
<p>
Originally developed to diagnose HHH-9615
@author Steve Ebersole | convertToEntityAttribute | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AndLobTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AndLobTest.java | Apache-2.0 |
@Test
@JiraKey( value = "HHH-9599")
public void basicTest() {
StandardServiceRegistry ssr = ServiceRegistryUtil.serviceRegistry();
try {
Metadata metadata = new MetadataSources( ssr ).addAnnotatedClass( TestEntity.class ).buildMetadata();
( (MetadataImplementor) metadata ).orderColumns( false );
( (Metad... | Test the combination of @Nationalized and @Convert
@author Steve Ebersole | basicTest | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AndNationalizedTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AndNationalizedTests.java | Apache-2.0 |
public String getText() {
return text;
} | Test the combination of @Nationalized and @Convert
@author Steve Ebersole | getText | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AndNationalizedTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AndNationalizedTests.java | Apache-2.0 |
@Override
public String convertToDatabaseColumn(Name attribute) {
return attribute.getText();
} | Test the combination of @Nationalized and @Convert
@author Steve Ebersole | convertToDatabaseColumn | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AndNationalizedTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AndNationalizedTests.java | Apache-2.0 |
@Override
public Name convertToEntityAttribute(String dbData) {
return new Name( dbData );
} | Test the combination of @Nationalized and @Convert
@author Steve Ebersole | convertToEntityAttribute | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AndNationalizedTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AndNationalizedTests.java | Apache-2.0 |
@Test
public void testErrorInstantiatingConverterClass() {
Configuration cfg = new Configuration();
ServiceRegistryUtil.applySettings( cfg.getStandardServiceRegistryBuilder() );
try {
cfg.addAttributeConverter( BlowsUpConverter.class );
try ( final SessionFactoryImplementor sessionFactory = (SessionFactory... | Tests the principle of adding "AttributeConverter" to the mix of {@link Type} resolution
@author Steve Ebersole | testErrorInstantiatingConverterClass | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | Apache-2.0 |
@Override
public String convertToDatabaseColumn(String attribute) {
return null;
} | Tests the principle of adding "AttributeConverter" to the mix of {@link Type} resolution
@author Steve Ebersole | convertToDatabaseColumn | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | Apache-2.0 |
@Override
public String convertToEntityAttribute(String dbData) {
return null;
} | Tests the principle of adding "AttributeConverter" to the mix of {@link Type} resolution
@author Steve Ebersole | convertToEntityAttribute | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | Apache-2.0 |
@Test
public void testBasicOperation() {
try ( StandardServiceRegistry serviceRegistry = ServiceRegistryUtil.serviceRegistry()) {
final MetadataBuildingContext buildingContext = new MetadataBuildingContextTestingImpl( serviceRegistry );
final JdbcTypeRegistry jdbcTypeRegistry = buildingContext.getBootstrapCont... | Tests the principle of adding "AttributeConverter" to the mix of {@link Type} resolution
@author Steve Ebersole | testBasicOperation | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | Apache-2.0 |
@Test
public void testNonAutoApplyHandling() {
final StandardServiceRegistry ssr = ServiceRegistryUtil.serviceRegistry();
try {
MetadataImplementor metadata = (MetadataImplementor) new MetadataSources( ssr )
.addAnnotatedClass( Tester.class )
.getMetadataBuilder()
.applyAttributeConverter( NotAu... | Tests the principle of adding "AttributeConverter" to the mix of {@link Type} resolution
@author Steve Ebersole | testNonAutoApplyHandling | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | Apache-2.0 |
@Test
public void testBasicConverterApplication() {
final StandardServiceRegistry ssr = ServiceRegistryUtil.serviceRegistry();
try {
final MetadataImplementor metadata = (MetadataImplementor) new MetadataSources( ssr )
.addAnnotatedClass( Tester.class )
.getMetadataBuilder()
.applyAttributeConve... | Tests the principle of adding "AttributeConverter" to the mix of {@link Type} resolution
@author Steve Ebersole | testBasicConverterApplication | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | Apache-2.0 |
@Test
@JiraKey(value = "HHH-8462")
public void testBasicOrmXmlConverterApplication() {
final StandardServiceRegistry ssr = ServiceRegistryUtil.serviceRegistry();
try {
MetadataImplementor metadata = (MetadataImplementor) new MetadataSources( ssr )
.addAnnotatedClass( Tester.class )
.addURL( ConfigHe... | Tests the principle of adding "AttributeConverter" to the mix of {@link Type} resolution
@author Steve Ebersole | testBasicOrmXmlConverterApplication | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | Apache-2.0 |
@Test
@JiraKey(value = "HHH-14881")
public void testBasicOrmXmlConverterWithOrmXmlPackage() {
final StandardServiceRegistry ssr = ServiceRegistryUtil.serviceRegistry();
try {
MetadataImplementor metadata = (MetadataImplementor) new MetadataSources( ssr )
.addAnnotatedClass( Tester.class )
.addURL( C... | Tests the principle of adding "AttributeConverter" to the mix of {@link Type} resolution
@author Steve Ebersole | testBasicOrmXmlConverterWithOrmXmlPackage | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | Apache-2.0 |
@Test
public void testBasicConverterDisableApplication() {
final StandardServiceRegistry ssr = ServiceRegistryUtil.serviceRegistry();
try {
MetadataImplementor metadata = (MetadataImplementor) new MetadataSources( ssr )
.addAnnotatedClass( Tester2.class )
.getMetadataBuilder()
.applyAttributeCon... | Tests the principle of adding "AttributeConverter" to the mix of {@link Type} resolution
@author Steve Ebersole | testBasicConverterDisableApplication | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | Apache-2.0 |
@Test
public void testBasicUsage() {
Configuration cfg = new Configuration();
ServiceRegistryUtil.applySettings( cfg.getStandardServiceRegistryBuilder() );
cfg.addAttributeConverter( IntegerToVarcharConverter.class, false );
cfg.addAnnotatedClass( Tester4.class );
cfg.setProperty( AvailableSettings.HBM2DDL_A... | Tests the principle of adding "AttributeConverter" to the mix of {@link Type} resolution
@author Steve Ebersole | testBasicUsage | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | Apache-2.0 |
@Test
@JiraKey( value = "HHH-14206" )
public void testPrimitiveTypeConverterAutoApplied() {
final StandardServiceRegistry ssr = ServiceRegistryUtil.serviceRegistry();
try {
final MetadataImplementor metadata = (MetadataImplementor) new MetadataSources( ssr )
.addAnnotatedClass( Tester5.class )
.getM... | Tests the principle of adding "AttributeConverter" to the mix of {@link Type} resolution
@author Steve Ebersole | testPrimitiveTypeConverterAutoApplied | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | Apache-2.0 |
@Test
public void testBasicTimestampUsage() {
Configuration cfg = new Configuration();
ServiceRegistryUtil.applySettings( cfg.getStandardServiceRegistryBuilder() );
cfg.addAttributeConverter( InstantConverter.class, false );
cfg.addAnnotatedClass( IrrelevantInstantEntity.class );
cfg.setProperty( AvailableSe... | Tests the principle of adding "AttributeConverter" to the mix of {@link Type} resolution
@author Steve Ebersole | testBasicTimestampUsage | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | Apache-2.0 |
@Test
@JiraKey(value = "HHH-8866")
public void testEnumConverter() {
final StandardServiceRegistry ssr = ServiceRegistryUtil.serviceRegistryBuilder()
.applySetting( AvailableSettings.HBM2DDL_AUTO, "create-drop" )
.build();
try {
MetadataImplementor metadata = (MetadataImplementor) new MetadataSources(... | Tests the principle of adding "AttributeConverter" to the mix of {@link Type} resolution
@author Steve Ebersole | testEnumConverter | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | Apache-2.0 |
public Long getId() {
return id;
} | Tests the principle of adding "AttributeConverter" to the mix of {@link Type} resolution
@author Steve Ebersole | getId | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | Apache-2.0 |
public void setId(Long id) {
this.id = id;
} | Tests the principle of adding "AttributeConverter" to the mix of {@link Type} resolution
@author Steve Ebersole | setId | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | Apache-2.0 |
public Instant getDateCreated() {
return dateCreated;
} | Tests the principle of adding "AttributeConverter" to the mix of {@link Type} resolution
@author Steve Ebersole | getDateCreated | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | Apache-2.0 |
public void setDateCreated(Instant dateCreated) {
this.dateCreated = dateCreated;
} | Tests the principle of adding "AttributeConverter" to the mix of {@link Type} resolution
@author Steve Ebersole | setDateCreated | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | Apache-2.0 |
public String convertToString() {
switch ( this ) {
case VALUE: {
return "VALUE";
}
default: {
return "DEFAULT";
}
}
} | Tests the principle of adding "AttributeConverter" to the mix of {@link Type} resolution
@author Steve Ebersole | convertToString | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | Apache-2.0 |
@Override
public String convertToDatabaseColumn(ConvertibleEnum attribute) {
return attribute.convertToString();
} | Tests the principle of adding "AttributeConverter" to the mix of {@link Type} resolution
@author Steve Ebersole | convertToDatabaseColumn | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | Apache-2.0 |
@Override
public ConvertibleEnum convertToEntityAttribute(String dbData) {
return ConvertibleEnum.valueOf( dbData );
} | Tests the principle of adding "AttributeConverter" to the mix of {@link Type} resolution
@author Steve Ebersole | convertToEntityAttribute | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | Apache-2.0 |
@Id
@Column(name = "id")
public String getId() {
return id;
} | Tests the principle of adding "AttributeConverter" to the mix of {@link Type} resolution
@author Steve Ebersole | getId | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | Apache-2.0 |
public void setId(String id) {
this.id = id;
} | Tests the principle of adding "AttributeConverter" to the mix of {@link Type} resolution
@author Steve Ebersole | setId | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | Apache-2.0 |
@Column(name = "testEnum")
public ConvertibleEnum getConvertibleEnum() {
return convertibleEnum;
} | Tests the principle of adding "AttributeConverter" to the mix of {@link Type} resolution
@author Steve Ebersole | getConvertibleEnum | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | Apache-2.0 |
public void setConvertibleEnum(ConvertibleEnum convertibleEnum) {
this.convertibleEnum = convertibleEnum;
} | Tests the principle of adding "AttributeConverter" to the mix of {@link Type} resolution
@author Steve Ebersole | setConvertibleEnum | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | Apache-2.0 |
@Override
public String convertToDatabaseColumn(String attribute) {
throw new IllegalStateException( "AttributeConverter should not have been applied/called" );
} | Tests the principle of adding "AttributeConverter" to the mix of {@link Type} resolution
@author Steve Ebersole | convertToDatabaseColumn | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | Apache-2.0 |
@Override
public String convertToEntityAttribute(String dbData) {
throw new IllegalStateException( "AttributeConverter should not have been applied/called" );
} | Tests the principle of adding "AttributeConverter" to the mix of {@link Type} resolution
@author Steve Ebersole | convertToEntityAttribute | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | Apache-2.0 |
@Override
public String convertToDatabaseColumn(Integer attribute) {
return attribute == null ? null : attribute.toString();
} | Tests the principle of adding "AttributeConverter" to the mix of {@link Type} resolution
@author Steve Ebersole | convertToDatabaseColumn | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | Apache-2.0 |
@Override
public Integer convertToEntityAttribute(String dbData) {
return dbData == null ? null : Integer.valueOf( dbData );
} | Tests the principle of adding "AttributeConverter" to the mix of {@link Type} resolution
@author Steve Ebersole | convertToEntityAttribute | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | Apache-2.0 |
@Override
public Timestamp convertToDatabaseColumn(Instant attribute) {
return new Timestamp( attribute.getEpochSecond() );
} | Tests the principle of adding "AttributeConverter" to the mix of {@link Type} resolution
@author Steve Ebersole | convertToDatabaseColumn | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | Apache-2.0 |
@Override
public Instant convertToEntityAttribute(Timestamp dbData) {
return Instant.ofEpochSecond( dbData.getTime() );
} | Tests the principle of adding "AttributeConverter" to the mix of {@link Type} resolution
@author Steve Ebersole | convertToEntityAttribute | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | Apache-2.0 |
@Override
public Byte convertToDatabaseColumn(ConvertibleEnum attribute) {
return attribute == null ? null : (byte) attribute.ordinal();
} | Tests the principle of adding "AttributeConverter" to the mix of {@link Type} resolution
@author Steve Ebersole | convertToDatabaseColumn | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | Apache-2.0 |
@Override
public ConvertibleEnum convertToEntityAttribute(Byte dbData) {
return dbData == null ? null : ConvertibleEnum.values()[dbData];
} | Tests the principle of adding "AttributeConverter" to the mix of {@link Type} resolution
@author Steve Ebersole | convertToEntityAttribute | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/AttributeConverterTest.java | Apache-2.0 |
@Override
public String convertToDatabaseColumn(String attribute) {
throw new IllegalStateException( "AttributeConverter should not have been applied/called" );
} | Tests for asserting correct behavior of applying AttributeConverters explicitly listed in persistence.xml.
@author Steve Ebersole | convertToDatabaseColumn | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/ExplicitlyNamedConverterClassesTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/ExplicitlyNamedConverterClassesTest.java | Apache-2.0 |
@Override
public String convertToEntityAttribute(String dbData) {
throw new IllegalStateException( "AttributeConverter should not have been applied/called" );
} | Tests for asserting correct behavior of applying AttributeConverters explicitly listed in persistence.xml.
@author Steve Ebersole | convertToEntityAttribute | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/ExplicitlyNamedConverterClassesTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/ExplicitlyNamedConverterClassesTest.java | Apache-2.0 |
@Override
protected Class[] getAnnotatedClasses() {
return new Class[] { Entity1.class, NotAutoAppliedConverter.class };
} | Tests for asserting correct behavior of applying AttributeConverters explicitly listed in persistence.xml.
@author Steve Ebersole | getAnnotatedClasses | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/ExplicitlyNamedConverterClassesTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/ExplicitlyNamedConverterClassesTest.java | Apache-2.0 |
@Test
public void testNonAutoAppliedConvertIsNotApplied() {
Session session = openSession();
session.getTransaction().begin();
session.persist( new Entity1( 1, "1" ) );
session.getTransaction().commit();
session.close();
session = openSession();
session.getTransaction().begin();
session.createQuery( "... | Tests for asserting correct behavior of applying AttributeConverters explicitly listed in persistence.xml.
@author Steve Ebersole | testNonAutoAppliedConvertIsNotApplied | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/ExplicitlyNamedConverterClassesTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/ExplicitlyNamedConverterClassesTest.java | Apache-2.0 |
@Test
public void testJpqlFloatLiteral() {
Session session = openSession();
session.getTransaction().begin();
Employee jDoe = (Employee) session.createQuery( "from Employee e where e.salary = " + SALARY + "f" ).uniqueResult();
assertNotNull( jDoe );
session.getTransaction().commit();
session.close();
} | Test AttributeConverter functioning in various Query scenarios.
@author Steve Ebersole | testJpqlFloatLiteral | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/QueryTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/QueryTest.java | Apache-2.0 |
@Test
public void testJpqlBooleanLiteral() {
Session session = openSession();
session.getTransaction().begin();
assertNotNull( session.createQuery( "from Employee e where e.active = true" ).uniqueResult() );
assertNull( session.createQuery( "from Employee e where e.active = false" ).uniqueResult() );
session... | Test AttributeConverter functioning in various Query scenarios.
@author Steve Ebersole | testJpqlBooleanLiteral | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/QueryTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/QueryTest.java | Apache-2.0 |
@Test
@JiraKey( "HHH-13082" )
public void testNativeQueryResult() {
inTransaction( (session) -> {
final NativeQuery<Object[]> query = session.createNativeQuery( "select id, salary from EMP", "emp_id_salary" );
final List<Object[]> results = query.list();
assertThat( results ).hasSize( 1 );
final Objec... | Test AttributeConverter functioning in various Query scenarios.
@author Steve Ebersole | testNativeQueryResult | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/QueryTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/QueryTest.java | Apache-2.0 |
public void testNativeQueryResultWithResultClass() {
inTransaction( (session) -> {
final NativeQuery<Object[]> query = session.createNativeQuery( "select id, salary from EMP", "emp_id_salary", Object[].class );
final List<Object[]> results = query.list();
assertThat( results ).hasSize( 1 );
final Object... | Test AttributeConverter functioning in various Query scenarios.
@author Steve Ebersole | testNativeQueryResultWithResultClass | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/QueryTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/QueryTest.java | Apache-2.0 |
@Test
@FailureExpected( jiraKey = "HHH-14975", message = "Not yet implemented" )
@JiraKey( "HHH-14975" )
public void testAutoAppliedConverterAsNativeQueryResult() {
inTransaction( (session) -> {
final NativeQuery<Object[]> query = session.createNativeQuery( "select id, salary from EMP", "emp_id_salary2" );
... | Test AttributeConverter functioning in various Query scenarios.
@author Steve Ebersole | testAutoAppliedConverterAsNativeQueryResult | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/QueryTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/QueryTest.java | Apache-2.0 |
@Override
protected Class<?>[] getAnnotatedClasses() {
return new Class[] { Employee.class, SalaryConverter.class };
} | Test AttributeConverter functioning in various Query scenarios.
@author Steve Ebersole | getAnnotatedClasses | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/QueryTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/QueryTest.java | Apache-2.0 |
@Before
public void setUpTestData() {
Session session = openSession();
session.getTransaction().begin();
session.persist( new Employee( 1, new Name( "John", "Q.", "Doe" ), SALARY ) );
session.getTransaction().commit();
session.close();
} | Test AttributeConverter functioning in various Query scenarios.
@author Steve Ebersole | setUpTestData | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/QueryTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/QueryTest.java | Apache-2.0 |
@After
public void cleanUpTestData() {
Session session = openSession();
session.getTransaction().begin();
session.createQuery( "delete Employee" ).executeUpdate();
session.getTransaction().commit();
session.close();
} | Test AttributeConverter functioning in various Query scenarios.
@author Steve Ebersole | cleanUpTestData | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/QueryTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/QueryTest.java | Apache-2.0 |
@Override
@SuppressWarnings("UnnecessaryBoxing")
public Long convertToDatabaseColumn(Float attribute) {
if ( attribute == null ) {
return null;
}
return new Long( (long)(attribute*100) );
} | Test AttributeConverter functioning in various Query scenarios.
@author Steve Ebersole | convertToDatabaseColumn | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/QueryTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/QueryTest.java | Apache-2.0 |
@Override
@SuppressWarnings("UnnecessaryBoxing")
public Float convertToEntityAttribute(Long dbData) {
if ( dbData == null ) {
return null;
}
return new Float( ( dbData.floatValue() ) / 100 );
} | Test AttributeConverter functioning in various Query scenarios.
@author Steve Ebersole | convertToEntityAttribute | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/QueryTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/QueryTest.java | Apache-2.0 |
@Override
public Integer convertToDatabaseColumn(Boolean attribute) {
if ( attribute == null ) {
return null;
}
return attribute ? 1 : 0;
} | Test AttributeConverter functioning in various Query scenarios.
@author Steve Ebersole | convertToDatabaseColumn | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/QueryTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/QueryTest.java | Apache-2.0 |
@Override
public Boolean convertToEntityAttribute(Integer dbData) {
if ( dbData == null ) {
return null;
}
else if ( dbData == 0 ) {
return false;
}
else if ( dbData == 1 ) {
return true;
}
throw new HibernateException( "Unexpected boolean numeric; expecting null, 0 or 1, but found " ... | Test AttributeConverter functioning in various Query scenarios.
@author Steve Ebersole | convertToEntityAttribute | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/QueryTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/QueryTest.java | Apache-2.0 |
@Override
protected Class[] getAnnotatedClasses() {
return new Class[] { Entity1.class, UrlConverter.class, AutoUrlConverter.class };
} | test handling of an AttributeConverter explicitly named via a @Convert annotation
@author Steve Ebersole | getAnnotatedClasses | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleConvertAnnotationTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleConvertAnnotationTest.java | Apache-2.0 |
@Test
public void testSimpleConvertUsage() throws MalformedURLException {
final EntityPersister ep = sessionFactory().getMappingMetamodel().getEntityDescriptor(Entity1.class.getName());
final Type websitePropertyType = ep.getPropertyType( "website" );
final ConvertedBasicTypeImpl type = assertTyping(
Convert... | test handling of an AttributeConverter explicitly named via a @Convert annotation
@author Steve Ebersole | testSimpleConvertUsage | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleConvertAnnotationTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleConvertAnnotationTest.java | Apache-2.0 |
private void resetFlags() {
convertToDatabaseColumnCalled = false;
convertToEntityAttributeCalled = false;
} | test handling of an AttributeConverter explicitly named via a @Convert annotation
@author Steve Ebersole | resetFlags | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleConvertAnnotationTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleConvertAnnotationTest.java | Apache-2.0 |
@Override
public String convertToDatabaseColumn(URL attribute) {
convertToDatabaseColumnCalled = true;
return attribute == null ? null : attribute.toExternalForm();
} | test handling of an AttributeConverter explicitly named via a @Convert annotation
@author Steve Ebersole | convertToDatabaseColumn | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleConvertAnnotationTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleConvertAnnotationTest.java | Apache-2.0 |
@Override
public URL convertToEntityAttribute(String dbData) {
convertToEntityAttributeCalled = true;
if ( dbData == null ) {
return null;
}
try {
return new URL( dbData );
}
catch (MalformedURLException e) {
throw new IllegalArgumentException( "Could not convert incoming value to URL :... | test handling of an AttributeConverter explicitly named via a @Convert annotation
@author Steve Ebersole | convertToEntityAttribute | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleConvertAnnotationTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleConvertAnnotationTest.java | Apache-2.0 |
@Override
public String convertToDatabaseColumn(URL attribute) {
throw new IllegalStateException( "Should not be called" );
} | test handling of an AttributeConverter explicitly named via a @Convert annotation
@author Steve Ebersole | convertToDatabaseColumn | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleConvertAnnotationTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleConvertAnnotationTest.java | Apache-2.0 |
@Override
public URL convertToEntityAttribute(String dbData) {
throw new IllegalStateException( "Should not be called" );
} | test handling of an AttributeConverter explicitly named via a @Convert annotation
@author Steve Ebersole | convertToEntityAttribute | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleConvertAnnotationTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleConvertAnnotationTest.java | Apache-2.0 |
@Override
protected Class[] getAnnotatedClasses() {
return new Class[] { Entity1.class, UrlConverter.class, AutoUrlConverter.class };
} | test handling of an AttributeConverter explicitly named via a @Converts annotation
@author Steve Ebersole | getAnnotatedClasses | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleConvertsAnnotationTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleConvertsAnnotationTest.java | Apache-2.0 |
@Test
public void testSimpleConvertsUsage() throws MalformedURLException {
final EntityPersister ep = sessionFactory().getMappingMetamodel().getEntityDescriptor(Entity1.class.getName());
final Type websitePropertyType = ep.getPropertyType( "website" );
final ConvertedBasicTypeImpl type = assertTyping(
Conver... | test handling of an AttributeConverter explicitly named via a @Converts annotation
@author Steve Ebersole | testSimpleConvertsUsage | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleConvertsAnnotationTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleConvertsAnnotationTest.java | Apache-2.0 |
private void resetFlags() {
convertToDatabaseColumnCalled = false;
convertToEntityAttributeCalled = false;
} | test handling of an AttributeConverter explicitly named via a @Converts annotation
@author Steve Ebersole | resetFlags | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleConvertsAnnotationTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleConvertsAnnotationTest.java | Apache-2.0 |
@Override
public String convertToDatabaseColumn(URL attribute) {
convertToDatabaseColumnCalled = true;
return attribute == null ? null : attribute.toExternalForm();
} | test handling of an AttributeConverter explicitly named via a @Converts annotation
@author Steve Ebersole | convertToDatabaseColumn | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleConvertsAnnotationTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleConvertsAnnotationTest.java | Apache-2.0 |
@Override
public URL convertToEntityAttribute(String dbData) {
convertToEntityAttributeCalled = true;
if ( dbData == null ) {
return null;
}
try {
return new URL( dbData );
}
catch (MalformedURLException e) {
throw new IllegalArgumentException( "Could not convert incoming value to URL :... | test handling of an AttributeConverter explicitly named via a @Converts annotation
@author Steve Ebersole | convertToEntityAttribute | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleConvertsAnnotationTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleConvertsAnnotationTest.java | Apache-2.0 |
@Override
public String convertToDatabaseColumn(URL attribute) {
throw new IllegalStateException( "Should not be called" );
} | test handling of an AttributeConverter explicitly named via a @Converts annotation
@author Steve Ebersole | convertToDatabaseColumn | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleConvertsAnnotationTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleConvertsAnnotationTest.java | Apache-2.0 |
@Override
public URL convertToEntityAttribute(String dbData) {
throw new IllegalStateException( "Should not be called" );
} | test handling of an AttributeConverter explicitly named via a @Converts annotation
@author Steve Ebersole | convertToEntityAttribute | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleConvertsAnnotationTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleConvertsAnnotationTest.java | Apache-2.0 |
@Override
protected Class[] getAnnotatedClasses() {
return new Class[] { Person.class };
} | Tests MappedSuperclass/Entity overriding of Convert definitions
@author Steve Ebersole | getAnnotatedClasses | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleEmbeddableOverriddenConverterTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleEmbeddableOverriddenConverterTest.java | Apache-2.0 |
@Override
protected boolean createSchema() {
return false;
} | Tests MappedSuperclass/Entity overriding of Convert definitions
@author Steve Ebersole | createSchema | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleEmbeddableOverriddenConverterTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleEmbeddableOverriddenConverterTest.java | Apache-2.0 |
@Override
protected Class[] getAnnotatedClasses() {
return new Class[] { Super.class, Sub.class };
} | Tests MappedSuperclass/Entity overriding of Convert definitions
@author Steve Ebersole | getAnnotatedClasses | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleOverriddenConverterTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleOverriddenConverterTest.java | Apache-2.0 |
@Override
protected boolean createSchema() {
return false;
} | Tests MappedSuperclass/Entity overriding of Convert definitions
@author Steve Ebersole | createSchema | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleOverriddenConverterTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleOverriddenConverterTest.java | Apache-2.0 |
@Before
public void before() {
ssr = ServiceRegistryUtil.serviceRegistry();
} | Test simple application of Convert annotation via XML.
@author Steve Ebersole | before | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleXmlOverriddenTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleXmlOverriddenTest.java | Apache-2.0 |
@After
public void after() {
if ( ssr != null ) {
StandardServiceRegistryBuilder.destroy( ssr );
}
} | Test simple application of Convert annotation via XML.
@author Steve Ebersole | after | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleXmlOverriddenTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleXmlOverriddenTest.java | Apache-2.0 |
@Test
public void baseline() {
Metadata metadata = new MetadataSources( ssr )
.addAnnotatedClass( TheEntity.class )
.buildMetadata();
PersistentClass pc = metadata.getEntityBinding( TheEntity.class.getName() );
Type type = pc.getProperty( "it" ).getType();
ConvertedBasicTypeImpl adapter = assertTyping... | A baseline test, with an explicit @Convert annotation that should be in effect | baseline | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleXmlOverriddenTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleXmlOverriddenTest.java | Apache-2.0 |
@Test
public void testDefinitionAtAttributeLevel() {
// NOTE : simple-override.xml applied disable-conversion="true" at the attribute-level
Metadata metadata = new MetadataSources( ssr )
.addAnnotatedClass( TheEntity.class )
.addResource( "org/hibernate/test/converter/simple-override.xml" )
.buildMetad... | Test outcome of applying overrides via orm.xml, specifically at the attribute level | testDefinitionAtAttributeLevel | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleXmlOverriddenTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleXmlOverriddenTest.java | Apache-2.0 |
@Test
public void testDefinitionAtEntityLevel() {
// NOTE : simple-override2.xml applied disable-conversion="true" at the entity-level
Metadata metadata = new MetadataSources( ssr )
.addAnnotatedClass( TheEntity2.class )
.addResource( "org/hibernate/test/converter/simple-override2.xml" )
.buildMetadata... | Test outcome of applying overrides via orm.xml, specifically at the entity level | testDefinitionAtEntityLevel | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleXmlOverriddenTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/SimpleXmlOverriddenTest.java | Apache-2.0 |
@Override
protected Class[] getAnnotatedClasses() {
return new Class[] { Entity1.class };
} | Jira HHH-8812 claims that explicit {@link jakarta.persistence.Convert} annotations are not processed when a orm.xml
file is used - specifically that the mixed case is not handled properly.
@author Steve Ebersole | getAnnotatedClasses | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/XmlWithExplicitConvertAnnotationsTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/XmlWithExplicitConvertAnnotationsTest.java | Apache-2.0 |
@Override
protected String[] getXmlFiles() {
return new String[] { "org/hibernate/test/converter/mixed.xml" };
} | Jira HHH-8812 claims that explicit {@link jakarta.persistence.Convert} annotations are not processed when a orm.xml
file is used - specifically that the mixed case is not handled properly.
@author Steve Ebersole | getXmlFiles | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/XmlWithExplicitConvertAnnotationsTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/XmlWithExplicitConvertAnnotationsTest.java | Apache-2.0 |
private void resetFlags() {
convertToDatabaseColumnCalled = false;
convertToEntityAttributeCalled = false;
} | Jira HHH-8812 claims that explicit {@link jakarta.persistence.Convert} annotations are not processed when a orm.xml
file is used - specifically that the mixed case is not handled properly.
@author Steve Ebersole | resetFlags | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/XmlWithExplicitConvertAnnotationsTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/XmlWithExplicitConvertAnnotationsTest.java | Apache-2.0 |
@Override
public Long convertToDatabaseColumn(Date attribute) {
convertToDatabaseColumnCalled = true;
return attribute.getTime();
} | Jira HHH-8812 claims that explicit {@link jakarta.persistence.Convert} annotations are not processed when a orm.xml
file is used - specifically that the mixed case is not handled properly.
@author Steve Ebersole | convertToDatabaseColumn | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/XmlWithExplicitConvertAnnotationsTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/XmlWithExplicitConvertAnnotationsTest.java | Apache-2.0 |
@Override
public Date convertToEntityAttribute(Long dbData) {
convertToEntityAttributeCalled = true;
return new Date( dbData );
} | Jira HHH-8812 claims that explicit {@link jakarta.persistence.Convert} annotations are not processed when a orm.xml
file is used - specifically that the mixed case is not handled properly.
@author Steve Ebersole | convertToEntityAttribute | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/XmlWithExplicitConvertAnnotationsTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/XmlWithExplicitConvertAnnotationsTest.java | Apache-2.0 |
@PrePersist
@PreUpdate
private void listen(Object entity) {
System.out.println( "@PrePersist @PreUpdate listener event fired" );
} | Jira HHH-8812 claims that explicit {@link jakarta.persistence.Convert} annotations are not processed when a orm.xml
file is used - specifically that the mixed case is not handled properly.
@author Steve Ebersole | listen | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/XmlWithExplicitConvertAnnotationsTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/XmlWithExplicitConvertAnnotationsTest.java | Apache-2.0 |
@Test
public void testSimpleConvertUsage() throws MalformedURLException {
final EntityPersister ep = sessionFactory().getMappingMetamodel().getEntityDescriptor(Entity1.class.getName());
final Type theDatePropertyType = ep.getPropertyType( "theDate" );
final ConvertedBasicTypeImpl type = assertTyping(
Convert... | Jira HHH-8812 claims that explicit {@link jakarta.persistence.Convert} annotations are not processed when a orm.xml
file is used - specifically that the mixed case is not handled properly.
@author Steve Ebersole | testSimpleConvertUsage | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/XmlWithExplicitConvertAnnotationsTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/XmlWithExplicitConvertAnnotationsTest.java | Apache-2.0 |
@BeforeAll
public void setUp() throws Exception {
simpleValueAttributeConverterDescriptorField = ReflectHelper.findField( SimpleValue.class, "attributeConverterDescriptor" );
} | Similar to {@link CollectionCompositeElementConversionTest} except here we have an
explicit {@code @Convert} defined on the converted attribute
@author Steve Ebersole | setUp | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/elementCollection/CollectionCompositeElementExplicitConversionTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/elementCollection/CollectionCompositeElementExplicitConversionTest.java | Apache-2.0 |
@Test
public void testCollectionOfEmbeddablesWithConvertedAttributes(ServiceRegistryScope scope) throws Exception {
final MetadataImplementor metadata = (MetadataImplementor) new MetadataSources( scope.getRegistry() )
.addAnnotatedClass( Disguise.class )
.addAnnotatedClass( Traits.class )
.buildMetadata(... | Similar to {@link CollectionCompositeElementConversionTest} except here we have an
explicit {@code @Convert} defined on the converted attribute
@author Steve Ebersole | testCollectionOfEmbeddablesWithConvertedAttributes | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/elementCollection/CollectionCompositeElementExplicitConversionTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/elementCollection/CollectionCompositeElementExplicitConversionTest.java | Apache-2.0 |
private void checkComposite(Component composite) throws Exception {
// check `eyeColor`
final Property eyeColorProperty = composite.getProperty( "eyeColor" );
final SimpleValue eyeColorValueMapping = (SimpleValue) eyeColorProperty.getValue();
assertThat( simpleValueAttributeConverterDescriptorField.get( eyeColo... | Similar to {@link CollectionCompositeElementConversionTest} except here we have an
explicit {@code @Convert} defined on the converted attribute
@author Steve Ebersole | checkComposite | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/elementCollection/CollectionCompositeElementExplicitConversionTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/elementCollection/CollectionCompositeElementExplicitConversionTest.java | Apache-2.0 |
public String toExternalForm() {
return color;
} | Similar to {@link CollectionCompositeElementConversionTest} except here we have an
explicit {@code @Convert} defined on the converted attribute
@author Steve Ebersole | toExternalForm | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/elementCollection/CollectionCompositeElementExplicitConversionTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/elementCollection/CollectionCompositeElementExplicitConversionTest.java | Apache-2.0 |
public static ColorType fromExternalForm(String color) {
if ( BLUE.color.equals( color ) ) {
return BLUE;
}
else if ( RED.color.equals( color ) ) {
return RED;
}
else if ( YELLOW.color.equals( color ) ) {
return YELLOW;
}
else {
throw new RuntimeException( "Unknown color : " + color... | Similar to {@link CollectionCompositeElementConversionTest} except here we have an
explicit {@code @Convert} defined on the converted attribute
@author Steve Ebersole | fromExternalForm | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/elementCollection/CollectionCompositeElementExplicitConversionTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/elementCollection/CollectionCompositeElementExplicitConversionTest.java | Apache-2.0 |
@Override
public String convertToDatabaseColumn(ColorType attribute) {
return attribute == null ? null : attribute.toExternalForm();
} | Similar to {@link CollectionCompositeElementConversionTest} except here we have an
explicit {@code @Convert} defined on the converted attribute
@author Steve Ebersole | convertToDatabaseColumn | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/elementCollection/CollectionCompositeElementExplicitConversionTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/elementCollection/CollectionCompositeElementExplicitConversionTest.java | Apache-2.0 |
@Override
public ColorType convertToEntityAttribute(String dbData) {
return ColorType.fromExternalForm( dbData );
} | Similar to {@link CollectionCompositeElementConversionTest} except here we have an
explicit {@code @Convert} defined on the converted attribute
@author Steve Ebersole | convertToEntityAttribute | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/elementCollection/CollectionCompositeElementExplicitConversionTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/elementCollection/CollectionCompositeElementExplicitConversionTest.java | Apache-2.0 |
@BeforeEach
void setUp(SessionFactoryScope scope) {
final ProductEntity entity = new ProductEntity( 1 );
entity.prices = Collections.singletonList( new ProductPrice( new MyBigDecimal( 100.0 ) ) );
scope.fromTransaction( session -> {
session.persist( entity );
return entity.productId;
} );
} | @author Nathan Xu
@author Jeff Chee Yik Seng | setUp | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/elementCollection/CollectionEmbeddableElementConversionTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/elementCollection/CollectionEmbeddableElementConversionTest.java | Apache-2.0 |
@Test
void testNoClassCastExceptionThrown(SessionFactoryScope scope) {
scope.inTransaction( session -> session.get(
ProductEntity.class,
1
) );
} | @author Nathan Xu
@author Jeff Chee Yik Seng | testNoClassCastExceptionThrown | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/elementCollection/CollectionEmbeddableElementConversionTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/elementCollection/CollectionEmbeddableElementConversionTest.java | Apache-2.0 |
@AfterEach
void tearDown(SessionFactoryScope scope) {
scope.inTransaction(
(session) -> session.createQuery( "delete ProductEntity" ).executeUpdate()
);
} | @author Nathan Xu
@author Jeff Chee Yik Seng | tearDown | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/elementCollection/CollectionEmbeddableElementConversionTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/elementCollection/CollectionEmbeddableElementConversionTest.java | Apache-2.0 |
@Override
public BigDecimal convertToDatabaseColumn(MyBigDecimal attribute) {
return BigDecimal.valueOf( attribute.value );
} | @author Nathan Xu
@author Jeff Chee Yik Seng | convertToDatabaseColumn | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/elementCollection/CollectionEmbeddableElementConversionTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/elementCollection/CollectionEmbeddableElementConversionTest.java | Apache-2.0 |
@Override
public MyBigDecimal convertToEntityAttribute(BigDecimal dbData) {
return new MyBigDecimal( dbData.doubleValue() );
} | @author Nathan Xu
@author Jeff Chee Yik Seng | convertToEntityAttribute | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/elementCollection/CollectionEmbeddableElementConversionTest.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/elementCollection/CollectionEmbeddableElementConversionTest.java | Apache-2.0 |
@Test
public void testSimpleConvertUsage(DomainModelScope modelScope, SessionFactoryScope sfScope) throws MalformedURLException {
// first some assertions of the metamodel
PersistentClass entityBinding = modelScope.getDomainModel().getEntityBinding( TheEntity.class.getName() );
assertNotNull( entityBinding );
... | Test for {@link CollectionPropertyHolder}.
Tests that {@link jakarta.persistence.AttributeConverter}s are considered correctly for {@link jakarta.persistence.ElementCollection}.
@author Markus Heiden
@author Steve Ebersole | testSimpleConvertUsage | java | hibernate/hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/elementCollection/ElementCollectionTests.java | https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/converted/converter/elementCollection/ElementCollectionTests.java | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.