hibernate中的几个异常

xiaoxiao2024-04-15  19

如果发现这个异常 Exception in thread "main" org.hibernate.HibernateException: Hibernate Dialect must be explicitly set 说明你使用的是xml配置文件,不是property文件, 同时你也没有调用 XXConfiguration()的configure()方法,该方法才可以从xml文件中初始化Hibernate配置. 如果发现 .WARN SessionFactoryObjectFactory:98 - Could not bind factory to JNDI 这个异常, 请去掉 <session-factory name="org.hibernate.SessionFactory"> </session-factory>中的 name="org.hibernate.SessionFactory" 如果上面的属性出现, Hibernate 会想把session绑定到JNDI中的. 这个选项一般是使用Hibernate Tools时候生成的. 如果出现 java2dll 时候创建数据库的语句不正常请注意看看 <property name="hibernate.default_catalog">db</property> <property name="hibernate.default_schema">db</property> 这两个属性都在配置文件中. 对于Mysql来说, 使用2个是不可以的. 去掉一个.
转载请注明原文地址: https://www.6miu.com/read-5015000.html

最新回复(0)