浏览 5353 次
锁定老帖子 主题:关于Hibernate配置文件的问题
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2004-04-04
换用hibernate.cfg.xml文件后,在读取配置文件时出现下面的提示: 16:28:48,866 INFO Environment:462 - Hibernate 2.1.2 16:28:48,876 INFO Environment:491 - hibernate.properties not found 16:28:48,876 INFO Environment:519 - using CGLIB reflection optimizer 16:28:48,876 INFO Configuration:329 - Mapping resource: hello/Message.hbm.xml 16:28:49,457 INFO Binder:229 - Mapping class: hello.Message -> Messages 16:28:49,547 INFO Configuration:595 - processing one-to-many association mappings 16:28:49,547 INFO Configuration:604 - processing one-to-one association property references 16:28:49,547 INFO Configuration:629 - processing foreign key constraints 16:28:49,567 WARN SettingsFactory:50 - No dialect set - using GenericDialect: The dialect was not set. Set the property hibernate.dialect. 16:28:49,567 INFO Dialect:82 - Using dialect: net.sf.hibernate.dialect.GenericDialect 16:28:49,567 INFO SettingsFactory:62 - Use outer join fetching: false 16:28:49,577 WARN UserSuppliedConnectionProvider:25 - No connection properties specified - the user must supply JDBC connections 16:28:49,577 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended) 16:28:49,577 INFO SettingsFactory:102 - Use scrollable result sets: false net.sf.hibernate.MappingException: Dialect does not support identity key generation at net.sf.hibernate.dialect.Dialect.getIdentitySelectString(Dialect.java:289) at net.sf.hibernate.persister.AbstractEntityPersister.<init>(AbstractEntityPersister.java:633) at net.sf.hibernate.persister.EntityPersister.<init>(EntityPersister.java:715) at net.sf.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:41) at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:137) at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:750) at hello.Hello.main(Hello.java:31) 16:28:49,577 INFO SettingsFactory:105 - Use JDBC3 getGeneratedKeys(): false 16:28:49,647 INFO SettingsFactory:108 - Optimize cache for minimal puts: false 16:28:49,647 INFO SettingsFactory:117 - Query language substitutions: {} 16:28:49,707 INFO SettingsFactory:128 - cache provider: net.sf.ehcache.hibernate.Provider 16:28:49,907 INFO Configuration:1080 - instantiating and configuring caches 16:28:50,188 INFO SessionFactoryImpl:119 - building session factory Exception in thread "main" /////my hibernate.cfg.xml file.//////// <?xml version='1.0' encoding='gb2312'?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN" "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd"> <hibernate-configuration> <session-factory> <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property> <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/content</property> <property name="hibernate.connection.username">root</property> <property name="hibernate.connection.password"></property> <property name="hibernate.connection.pool.size">20</property> <property name="hibernate.show_sql">true</property> <property name="jdbc.fetch_size">50</property> <property name="jdbc.batch_size">25</property> <property name="jdbc.use_scrollable_resultset">false</property> <property name="hibernate.dialect">net.sf.hibernate.dialect.MySQLDialect</property> </session-factory> </hibernate-configuration> 在JB中,运行代码时,hibernate.cfg.xml自动放置在classes目录下(hibernate.properties文件也是在这个目录下),为什么不能正确获得正确的dialect,是哪里错了?请高手指教!!! 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2004-04-05
运行时找不到properties文件,应该再自动查找并读取hibernate.xfg.xml文件才对啊,难道是hibernate版本的问题?我使用的版本是2.1.2,哪位高手关注一下。
|
|
返回顶楼 | |
发表时间:2004-04-05
问题倒是解决了,但是否非得这样指定配置文件?
cfg = new Configuration().configure("/hibernate.cfg.xml"); |
|
返回顶楼 | |
发表时间:2004-04-08
我也遇到這樣的問題,是不是只有在web app中才能用hibernate.cfg.xml呢
|
|
返回顶楼 | |