What i want to do
I am trying to upgrade from WildFly 8.2.0 to WildFly 10.0.0, which means that I have (and want) a transition from Hibernate 4.3 to Hibernate 5.0.
Customization
Java 8u40 Spring 4.1.9 SQL Server 2012 Wildfly 8.2.0 -> Wildfly 10.0.0 Hibernate 4.3.6 -> Hibernate 5.0.7
I have read the migration guide and am amazed at the changes in Naming Strategy . I have read many questions about this on SO, but mine seems a little different. Hibernate complains that no tables were found:
INFO [ohVersion] HHH000412: Hibernate Core {5.0.7.Final} INFO [ohcfg.Environment] HHH000206: hibernate.properties not found INFO [ohcfg.Environment] HHH000021: Bytecode provider name : javassist INFO [ohannotations.common.Version] HCANN000001: Hibernate Commons Annotations {5.0.1.Final} INFO [ohdialect.Dialect] HHH000400: Using dialect: org.hibernate.dialect.SQLServerDialect INFO [ohenvers.boot.internal.EnversServiceImpl] Envers integration enabled? : true INFO [ohvalidator.internal.util.Version] HV000001: Hibernate Validator 5.2.3.Final INFO [ohtool.hbm2ddl.SchemaValidator] HHH000229: Running schema validator INFO [ohtseiInformationExtractorJdbcDatabaseMetaDataImpl] HHH000262: Table not found: SEC_AUTHORIZATION_RULES INFO [ohtseiInformationExtractorJdbcDatabaseMetaDataImpl] HHH000262: Table not found: SEC_USER More tables not found ... INFO [ohhql.internal.QueryTranslatorFactoryInitiator] (ServerService Thread Pool -- 62) HHH000397: Using ASTQueryTranslatorFactory
When I switched to registering DEBUG, I saw, for example, that it binds the entity to the correct database table:
DEBUG [ohcaEntityBinder] Bind entity com.company.user.User on table SEC_USER DEBUG [ohcEjb3Column] Binding column: Ejb3Column{table=org.hibernate.mapping.Table(SEC_USER), mappingColumn=ID, insertable=true, updatable=true, unique=false}
What is strange to me is that the application works. After this Table not found he does not complain that the scheme is wrong. The application is working. Selects, inserts, updates data.
I have a sleep mode configured through it spring -orm abstraction:
@Bean(name = "myEmf") @DependsOn({"dataSource", "flyway"}) public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean() { LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); em.setDataSource(dataSource()); em.setPackagesToScan(new String[]{"com.company.**.*"}); em.setJpaVendorAdapter(new HibernateJpaVendorAdapter()); em.setJpaProperties(additionalProperties()); return em; } private Properties additionalProperties() { Properties propFile = propertiesFile(); properties.setProperty("hibernate.hbm2ddl.auto", "validate"); properties.setProperty("hibernate.dialect", "org.hibernate.dialect.SQLServer2012Dialect"); properties.setProperty("hibernate.show_sql", "false"); properties.setProperty("hibernate.format_sql", "true"); properties.setProperty("hibernate.id.new_generator_mappings", "false"); properties.setProperty("hibernate.use_sql_comments", "false"); properties.setProperty("hibernate.implicit_naming_strategy", "legacy-jpa"); return properties; }
In this offset object, I name the table names and column names explicitly:
@Entity @Table(name = "SEC_USER") public class User extends BaseEntity { @Column(name = "LOGIN", nullable = false, unique = true) private String login;
Questions
- How to make this table not find log error messages?
- Why do they appear if table names are explicitly specified?
- Why doesn't he agree with column names?
- Why does it seem to be working correctly ?
What i tried
- Upgrading Spring 4.1.9 to 4.2.5 which says it has Hibernate 5 support
- Set hibernate.implicit_naming_strategy to legacy-jpa according to this
Manually set the default schema and assign the db_owner role. Notice that I never had to do this before sleep mode 4. 
I was debugging hibernation a bit and what I found in InformationExtractorJdbcDatabaseMetaDataImpl.java , which hibernation does not see the directory (whatever it is) and the schema. In the end, I think he should see the diagram. See screenshot below: directory and schema are NULL. 