17
17
import org .hibernate .metamodel .mapping .internal .BasicAttributeMapping ;
18
18
import org .hibernate .metamodel .spi .MappingMetamodelImplementor ;
19
19
import org .hibernate .persister .entity .EntityPersister ;
20
+ import org .hibernate .type .descriptor .jdbc .spi .JdbcTypeRegistry ;
20
21
21
22
import org .hibernate .testing .orm .junit .DomainModel ;
22
23
import org .hibernate .testing .orm .junit .SessionFactory ;
@@ -39,34 +40,35 @@ public void verifyMappings(SessionFactoryScope scope) {
39
40
final MappingMetamodelImplementor mappingMetamodel = scope .getSessionFactory ()
40
41
.getRuntimeMetamodels ()
41
42
.getMappingMetamodel ();
43
+ final JdbcTypeRegistry jdbcTypeRegistry = mappingMetamodel .getTypeConfiguration ().getJdbcTypeRegistry ();
42
44
final EntityPersister entityDescriptor = mappingMetamodel .getEntityDescriptor (EntityOfByteArrays .class );
43
45
44
46
{
45
47
final BasicAttributeMapping primitive = (BasicAttributeMapping ) entityDescriptor .findAttributeMapping ("primitive" );
46
48
final JdbcMapping jdbcMapping = primitive .getJdbcMapping ();
47
49
assertThat (jdbcMapping .getJavaTypeDescriptor ().getJavaTypeClass (), equalTo (byte [].class ));
48
- assertThat ( jdbcMapping .getJdbcType (). getJdbcTypeCode () , equalTo ( Types .VARBINARY ) );
50
+ assertThat ( jdbcMapping .getJdbcType (), equalTo ( jdbcTypeRegistry . getDescriptor ( Types .VARBINARY ) ) );
49
51
}
50
52
51
53
{
52
54
final BasicAttributeMapping primitive = (BasicAttributeMapping ) entityDescriptor .findAttributeMapping ("wrapper" );
53
55
final JdbcMapping jdbcMapping = primitive .getJdbcMapping ();
54
56
assertThat (jdbcMapping .getJavaTypeDescriptor ().getJavaTypeClass (), equalTo (Byte [].class ));
55
- assertThat ( jdbcMapping .getJdbcType (). getJdbcTypeCode () , equalTo ( Types .VARBINARY ) );
57
+ assertThat ( jdbcMapping .getJdbcType (), equalTo ( jdbcTypeRegistry . getDescriptor ( Types .VARBINARY ) ) );
56
58
}
57
59
58
60
{
59
61
final BasicAttributeMapping primitive = (BasicAttributeMapping ) entityDescriptor .findAttributeMapping ("primitiveLob" );
60
62
final JdbcMapping jdbcMapping = primitive .getJdbcMapping ();
61
63
assertThat (jdbcMapping .getJavaTypeDescriptor ().getJavaTypeClass (), equalTo (byte [].class ));
62
- assertThat ( jdbcMapping .getJdbcType (). getJdbcTypeCode () , equalTo ( Types .BLOB ) );
64
+ assertThat ( jdbcMapping .getJdbcType (), equalTo ( jdbcTypeRegistry . getDescriptor ( Types .BLOB ) ) );
63
65
}
64
66
65
67
{
66
68
final BasicAttributeMapping primitive = (BasicAttributeMapping ) entityDescriptor .findAttributeMapping ("wrapperLob" );
67
69
final JdbcMapping jdbcMapping = primitive .getJdbcMapping ();
68
70
assertThat (jdbcMapping .getJavaTypeDescriptor ().getJavaTypeClass (), equalTo (Byte [].class ));
69
- assertThat ( jdbcMapping .getJdbcType (). getJdbcTypeCode () , equalTo ( Types .BLOB ) );
71
+ assertThat ( jdbcMapping .getJdbcType (), equalTo ( jdbcTypeRegistry . getDescriptor ( Types .BLOB ) ) );
70
72
}
71
73
72
74
scope .inTransaction (
0 commit comments