HHH-17829 - [MySQL] Schema-validation: wrong column type encountered in column [activated] in table [jhi_user]; found [tinyint (Types#TINYINT)], but expecting [bit (Types#BOOLEAN)]
Test that using `hibernate.type.preferred_boolean_jdbc_type` allows successful validation
This commit is contained in:
parent
45ea24d102
commit
d1c80e1462
|
@ -9,6 +9,7 @@ package org.hibernate.orm.test.schemavalidation;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.hibernate.SessionFactory;
|
||||||
import org.hibernate.boot.spi.MetadataImplementor;
|
import org.hibernate.boot.spi.MetadataImplementor;
|
||||||
import org.hibernate.cfg.MappingSettings;
|
import org.hibernate.cfg.MappingSettings;
|
||||||
import org.hibernate.engine.config.spi.ConfigurationService;
|
import org.hibernate.engine.config.spi.ConfigurationService;
|
||||||
|
@ -69,6 +70,24 @@ public class BooleanAsTinyintValidationTests {
|
||||||
.doValidation( domainModelScope.getDomainModel(), executionOptions, ContributableMatcher.ALL );
|
.doValidation( domainModelScope.getDomainModel(), executionOptions, ContributableMatcher.ALL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testRuntimeUsage(DomainModelScope domainModelScope) {
|
||||||
|
try (SessionFactory sessionFactory = domainModelScope.getDomainModel().buildSessionFactory()) {
|
||||||
|
sessionFactory.inTransaction( (session) -> {
|
||||||
|
session.persist( new Client( 1, "stuff", true ) );
|
||||||
|
} );
|
||||||
|
sessionFactory.inTransaction( (session) -> {
|
||||||
|
session.find( Client.class, 1 );
|
||||||
|
} );
|
||||||
|
sessionFactory.inTransaction( (session) -> {
|
||||||
|
session.createQuery( "from Client", Client.class ).list();
|
||||||
|
} );
|
||||||
|
sessionFactory.inTransaction( (session) -> {
|
||||||
|
session.createNativeQuery( "select * from Client", Client.class ).list();
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp(ServiceRegistryScope registryScope, DomainModelScope domainModelScope) {
|
public void setUp(ServiceRegistryScope registryScope, DomainModelScope domainModelScope) {
|
||||||
final MetadataImplementor domainModel = domainModelScope.getDomainModel();
|
final MetadataImplementor domainModel = domainModelScope.getDomainModel();
|
||||||
|
@ -148,6 +167,15 @@ public class BooleanAsTinyintValidationTests {
|
||||||
private Integer id;
|
private Integer id;
|
||||||
private String name;
|
private String name;
|
||||||
private boolean active;
|
private boolean active;
|
||||||
|
|
||||||
|
public Client() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Client(Integer id, String name, boolean active) {
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
this.active = active;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue