SOS~Exception in thread "main" org.hibernate.HibernateException: Hibernate Dialect must be explicitly set

oraclequestion 2008-02-26 10:18:48
hibernate.cfg.xml文件如下
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration>

<session-factory>
<property name="connection.username">test</property>
<property name="connection.url">jdbc:oracle:thin:@127.0.0.1:1521:test</property>
<property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
<property name="myeclipse.connection.profile">oracle</property>
<property name="connection.password">test</property>
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>

</session-factory>

</hibernate-configuration>



T.java类如下
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class T {
public static void main(String[] args) {
Configuration con = new Configuration();
SessionFactory sf = con.buildSessionFactory();
Session s = sf.openSession();

System.out.println(s.isOpen());
}
}


可是一运行这个类就报错:Exception in thread "main" org.hibernate.HibernateException: Hibernate Dialect must be explicitly set

是怎么回事呢
...全文
564 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
sheng_yang2010 2010-11-25
  • 打赏
  • 举报
回复
碰到类似的问题。。
蚂蚁慢慢爬 2008-02-26
  • 打赏
  • 举报
回复
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class T {
public static void main(String[] args) {
Configuration con = new Configuration().Configure();
SessionFactory sf = con.buildSessionFactory();
Session s = sf.openSession();

System.out.println(s.isOpen());
}
}
蚂蚁慢慢爬 2008-02-26
  • 打赏
  • 举报
回复
haha
蚂蚁慢慢爬 2008-02-26
  • 打赏
  • 举报
回复
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class T {
public static void main(String[] args) {
Configuration con = new Configuration().Configure();
SessionFactory sf = con.buildSessionFactory();
Session s = sf.openSession();

System.out.println(s.isOpen());
}
}

67,512

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧