hibernate 4 xml和java config dialect之间的区别

时间:2016-03-25 13:56:15

标签: java hibernate spring-bean

我有一个hibernate项目,我试图用xml和注释配置它,但是

写作时

<bean id="jpaVendorAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
    <property name="database" value="INFORMIX" />
    <property name="databasePlatform" value="mypackage.MyInformixDialect" />
</bean>

它运作正常,但如果我写:

@Bean
public HibernateJpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter h = new HibernateJpaVendorAdapter();
    h.setDatabase(Database.INFORMIX);
    h.setDatabasePlatform("mypackage.MyInformixDialect");
    return h;
}

它说

Unable to resolve name mypackage.MyInformixDialect as strategy [org.hibernate.dialect.Dialect]

为什么?

0 个答案:

没有答案