0
這是我的第一個問題。我會盡量做到儘可能具體。不一致的hibernate方言錯誤,用ipconfig/renew更新
首先,我知道有很多關於這個錯誤的主題,有些有解決方案,,但我的情況是不同的,因爲我有這個錯誤不是每次都會消失一段時間後,我輸入ipconfig /續訂cmd。所以,現在要詳細說明。
我在Windows 7
工作,這是我的數據源配置:
package ...;
import ...;
@Configuration
public class DataSourceConfig {
@Value("${db.url}") private String url;
@Value("${db.user}") private String user;
@Value("${db.pass}") private String pass;
@Value("${db.poolSize.init}") private int initPoolSize;
@Value("${db.poolSize.min}") private int minPoolSize;
@Value("${db.poolSize.max}") private int maxPoolSize;
@Value("${db.statements.max}") private int maxStatements;
@Value("${db.idleTime.max}") private int maxIdleTime;
@Value("${db.checkoutTimeout}") private int checkoutTimeout;
@Bean
public DataSource oracleDataSource() throws SQLException {
ComboPooledDataSource dataSource = new ComboPooledDataSource();
dataSource.setJdbcUrl(url);
dataSource.setUser(user);
dataSource.setPassword(pass);
dataSource.setInitialPoolSize(initPoolSize);
dataSource.setMaxPoolSize(maxPoolSize);
dataSource.setMinPoolSize(minPoolSize);
dataSource.setMaxIdleTime(maxIdleTime);
dataSource.setMaxStatements(maxStatements);
dataSource.setCheckoutTimeout(checkoutTimeout);
return dataSource;
}
}
JPA配置:
package ...;
import ...;
@Configuration
@EnableJpaRepositories
@EnableTransactionManagement
public class JpaConfig {
@Autowired
private DataSource dataSource;
@Value("${is.ddl.enabled}")
private String isDDLenabled ;
@Bean
public EntityManagerFactory entityManagerFactory() {
HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
vendorAdapter.setGenerateDdl(Boolean.valueOf(isDDLenabled));
LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
factory.setJpaVendorAdapter(vendorAdapter);
factory.setPackagesToScan("...");
factory.setDataSource(dataSource);
factory.setJpaDialect(new HibernateJpaDialect());
factory.afterPropertiesSet();
return factory.getObject();
}
@Bean
public PlatformTransactionManager Here() {
JpaTransactionManager transactionManager = new JpaTransactionManager();
transactionManager.setEntityManagerFactory(entityManagerFactory());
return transactionManager;
}
}
我與碼頭運行英寸當我第幾次運行它時,沒關係。但經過8-15運行,我得到以下幾點:
Failed startup of context ...
org.springframework.beans.factory.BeanCreationException:
...
org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.persistence.EntityManagerFactory]: Factory method 'entityManagerFactory' threw exception; nested exception is org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
而在此之後,如果我嘗試,直到我運行ipconfig運行項目,我得到了同樣的錯誤/命令行renew命令。之後,再次運行8-15次,沒有問題。
有沒有人在這裏遇到過這樣的事情? ipconfig如何影響這個項目的運行?請幫忙。
感謝您的回覆@羅希特 - Gaikwad。但是,.setJpaVendorAdapter()不接受HibernateDialect作爲參數。它接受HibernateJpaVendorAdapter。我已經設定好了。此外,我使用.setJpaDialect(新的HibernateDialect())。那麼,在這種情況下我需要改變什麼呢?提前致謝。 –
這是否適合你? –
不,請參閱上文。不管怎麼說,還是要謝謝你。 –