
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
相应的调用类如下:
public static void main(String[] args) {
// TODO Auto-generated method stub
try{
Configuration cfg=new Configuration();
SchemaExport export = new SchemaExport(cfg);
export.create(true, true);
}catch(HibernateException e){
e.printStackTrace();
}
}
但是运行后出现错误信息如下:
log4j:WARN No appenders could be found for logger (org.hibernate.type.BasicTypeRegistry).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
org.hibernate.HibernateException: The dialect was not set. Set the property hibernate.dialect.
at org.hibernate.dialect.Dialect.instantiateDialect(Dialect.java:191)
at org.hibernate.dialect.Dialect.getDialect(Dialect.java:169)
at org.hibernate.dialect.Dialect.getDialect(Dialect.java:184)
at org.hibernate.tool.hbm2ddl.SchemaExport.
at org.hibernate.tool.hbm2ddl.SchemaExport.
at testBook.DoFirst.main(DoFirst.java:16)
想让大家帮忙看看是不是哪里配错了,还是少什么包,谢谢了。
配置没有物誉滑问题。关键在代码。
Configuration cfg=new Configuration(); // 默认为"/hibernate.cfg.xml", 在WEB应用下没问题,java应用程序中八成是找不到的,要指定配罩腊置文件路径。
cfg.configure("hibernate.cfg.xml"); //虚漏 指定配置文件路径
SchemaExport export = new SchemaExport(cfg);
你的oracle方言配置的拆姿不对 和oracle的版本不匹配
或告昌者旅友绝可以在eclipse下测试连接是否成功,他有视图测试 直接按步骤测试