该帖已经被评为精华帖
|
|
---|---|
作者 | 正文 |
发表时间:2004-03-22
用mysql的兄弟可以利用论坛的搜索功能,相信会有收获的
下面是mysql中文问题的一个帖子,可以看看 http://forum.iteye.com/viewtopic.php?t=1721&highlight=mysql+%D6%D0%CE%C4 |
|
返回顶楼 | |
发表时间:2004-03-23
我用的开发环境是eclipse,hibernate.properties按楼主的修改。
异常信息: 线程 [main](已暂挂(异常 ClassNotFoundException)) URLClassLoader$1.run() 行: 不可用 [没有局部变量可用] AccessController.doPrivileged(PrivilegedExceptionAction, AccessControlContext) 行: 不可用 [本机方法] Launcher$AppClassLoader(URLClassLoader).findClass(String) 行: 不可用 Launcher$AppClassLoader(ClassLoader).loadClass(String, boolean) 行: 不可用 Launcher$AppClassLoader.loadClass(String, boolean) 行: 不可用 Launcher$AppClassLoader(ClassLoader).loadClass(String) 行: 不可用 Launcher$AppClassLoader(ClassLoader).loadClassInternal(String) 行: 不可用 SessionFactoryImpl.openSession(Connection, boolean, long, Interceptor) 行: 312 SessionFactoryImpl.openSession(Interceptor) 行: 325 SessionFactoryImpl.openSession() 行: 333 TestPersonModel2.main(String[]) 行: 28 控制台信息如下: 2004-3-23 12:14:53 net.sf.hibernate.cfg.Environment <clinit> 信息: Hibernate 2.1.2 2004-3-23 12:14:53 net.sf.hibernate.cfg.Environment <clinit> 信息: loaded properties from resource hibernate.properties: {hibernate.connection.driver_class=org.gjt.mm.mysql.Driver, hibernate.cglib.use_reflection_optimizer=true, hibernate.cache.provider_class=net.sf.hibernate.cache.HashtableCacheProvider, hibernate.cache.use_query_cache=true, hibernate.max_fetch_depth=1, hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect, hibernate.jdbc.use_streams_for_binary=true, hibernate.jdbc.batch_size=0, hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N', hibernate.proxool.pool_alias=pool1, hibernate.connection.username=test, hibernate.connection.url=jdbc:mysql://localhost:3306/test, hibernate.connection.password=test, hibernate.connection.pool_size=1} 2004-3-23 12:14:53 net.sf.hibernate.cfg.Environment <clinit> 信息: using java.io streams to persist binary types 2004-3-23 12:14:53 net.sf.hibernate.cfg.Environment <clinit> 信息: using CGLIB reflection optimizer 2004-3-23 12:14:53 net.sf.hibernate.cfg.Configuration addClass 信息: Mapping resource: person/PersonModel.hbm.xml 2004-3-23 12:14:55 net.sf.hibernate.cfg.Binder bindRootClass 信息: Mapping class: person.PersonModel -> zy_person 2004-3-23 12:14:55 net.sf.hibernate.cfg.Configuration secondPassCompile 信息: processing one-to-many association mappings 2004-3-23 12:14:55 net.sf.hibernate.cfg.Configuration secondPassCompile 信息: processing one-to-one association property references 2004-3-23 12:14:55 net.sf.hibernate.cfg.Configuration secondPassCompile 信息: processing foreign key constraints 2004-3-23 12:14:55 net.sf.hibernate.dialect.Dialect <init> 信息: Using dialect: net.sf.hibernate.dialect.MySQLDialect 2004-3-23 12:14:55 net.sf.hibernate.cfg.SettingsFactory buildSettings 信息: Maximim outer join fetch depth: 1 2004-3-23 12:14:55 net.sf.hibernate.cfg.SettingsFactory buildSettings 信息: Use outer join fetching: true 2004-3-23 12:14:55 net.sf.hibernate.connection.DriverManagerConnectionProvider configure 信息: Using Hibernate built-in connection pool (not for production use!) 2004-3-23 12:14:55 net.sf.hibernate.connection.DriverManagerConnectionProvider configure 信息: Hibernate connection pool size: 1 2004-3-23 12:14:55 net.sf.hibernate.connection.DriverManagerConnectionProvider configure 信息: using driver: org.gjt.mm.mysql.Driver at URL: jdbc:mysql://99.1.18.245:3306/test 2004-3-23 12:14:55 net.sf.hibernate.connection.DriverManagerConnectionProvider configure 信息: connection properties: {user=root, password=tele97} 2004-3-23 12:14:55 net.sf.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup 信息: No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended) 2004-3-23 12:14:56 net.sf.hibernate.cfg.SettingsFactory buildSettings 信息: Use scrollable result sets: true 2004-3-23 12:14:56 net.sf.hibernate.cfg.SettingsFactory buildSettings 信息: Use JDBC3 getGeneratedKeys(): true 2004-3-23 12:14:56 net.sf.hibernate.cfg.SettingsFactory buildSettings 信息: Optimize cache for minimal puts: false 2004-3-23 12:14:56 net.sf.hibernate.cfg.SettingsFactory buildSettings 信息: Query language substitutions: {no='N', true=1, yes='Y', false=0} 2004-3-23 12:14:56 net.sf.hibernate.cfg.SettingsFactory buildSettings 信息: cache provider: net.sf.hibernate.cache.HashtableCacheProvider 2004-3-23 12:14:56 net.sf.hibernate.cfg.Configuration configureCaches 信息: instantiating and configuring caches 2004-3-23 12:14:56 net.sf.hibernate.impl.SessionFactoryImpl <init> 信息: building session factory 2004-3-23 12:14:58 net.sf.hibernate.impl.SessionFactoryObjectFactory addInstance 信息: no JNDI name configured 2004-3-23 12:14:58 net.sf.hibernate.cache.UpdateTimestampsCache <init> 信息: starting update timestamps cache at region: net.sf.hibernate.cache.UpdateTimestampsCache 2004-3-23 12:14:58 net.sf.hibernate.cache.QueryCache <init> 信息: starting query cache at region: net.sf.hibernate.cache.QueryCache |
|
返回顶楼 | |
发表时间:2004-03-24
希望今后多出好文章!!!!!
|
|
返回顶楼 | |
发表时间:2004-03-24
cqboy 写道 Mysql数据库,create都可以,可是在inert时报错
这个问题我好像在论坛里看到过,你搜索一下“MySQL”,应该可以找得到。 |
|
返回顶楼 | |
发表时间:2004-03-24
gototop99 写道 希望今后多出好文章!!!!!
最近在看hibernate的自带的英文参考,本来想翻译些东东贴出来的,谁知论坛里已经有了, 郁闷。 |
|
返回顶楼 | |
发表时间:2004-03-25
10:43:07,265 INFO Environment:462 - Hibernate 2.1.2 10:43:07,296 INFO Environment:496 - loaded properties from resource hibernate.properties: {hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver, hibernate.cglib.use_reflection_optimizer=true, hibernate.dialect=net.sf.hibernate.dialect.OracleDialect, hibernate.jdbc.use_streams_for_binary=true, hibernate.jdbc.batch_size=0, hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N', hibernate.query.imports=net.sf.hibernate.test, net.sf.hibernate.eg, hibernate.connection.username=system, hibernate.connection.url=jdbc:oracle:thin:@10.20.160.160:1521:oradb, hibernate.show_sql=true, hibernate.connection.password=manager, hibernate.statement_cache.size=25, hibernate.connection.pool_size=1} 10:43:07,296 INFO Environment:518 - using java.io streams to persist binary types 10:43:07,296 INFO Environment:519 - using CGLIB reflection optimizer 10:43:07,312 INFO Configuration:329 - Mapping resource: cn/com/pansky/com/PersonModel.hbm.xml 10:43:08,140 ERROR Configuration:252 - Could not compile the mapping document net.sf.hibernate.MappingException: persistent class [person.PersonModel] not found at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:84); at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:221); at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1229); at net.sf.hibernate.cfg.Configuration.add(Configuration.java:249); at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:285); at net.sf.hibernate.cfg.Configuration.addClass(Configuration.java:333); at cn.com.pansky.com.TestPersonModel.main(TestPersonModel.java:24); Caused by: java.lang.ClassNotFoundException: person.PersonModel at java.net.URLClassLoader$1.run(URLClassLoader.java:198); at java.security.AccessController.doPrivileged(Native Method); at java.net.URLClassLoader.findClass(URLClassLoader.java:186); at java.lang.ClassLoader.loadClass(ClassLoader.java:299); at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265); at java.lang.ClassLoader.loadClass(ClassLoader.java:255); at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315); at java.lang.Class.forName0(Native Method); at java.lang.Class.forName(Class.java:140); at net.sf.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:86); at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:81); ... 6 more net.sf.hibernate.MappingException: Error reading resource: cn/com/pansky/com/PersonModel.hbm.xml at net.sf.hibernate.cfg.Configuration.addClass(Configuration.java:336); at cn.com.pansky.com.TestPersonModel.main(TestPersonModel.java:24); Caused by: net.sf.hibernate.MappingException: persistent class [person.PersonModel] not found at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:84); at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:221); at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1229); at net.sf.hibernate.cfg.Configuration.add(Configuration.java:249); at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:285); at net.sf.hibernate.cfg.Configuration.addClass(Configuration.java:333); ... 1 more Caused by: java.lang.ClassNotFoundException: person.PersonModel at java.net.URLClassLoader$1.run(URLClassLoader.java:198); at java.security.AccessController.doPrivileged(Native Method); at java.net.URLClassLoader.findClass(URLClassLoader.java:186); at java.lang.ClassLoader.loadClass(ClassLoader.java:299); at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265); at java.lang.ClassLoader.loadClass(ClassLoader.java:255); at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315); at java.lang.Class.forName0(Native Method); at java.lang.Class.forName(Class.java:140); at net.sf.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:86); at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:81); ... 6 more Exception in thread "main" 我是照着楼主的例子写的呀,help,help |
|
返回顶楼 | |
发表时间:2004-03-25
郁闷,刚发完帖就搞定了
不好意思,浪费硬盘空间 |
|
返回顶楼 | |
发表时间:2004-03-26
forverpain兄也可以看看。
dong_xuelin 写道 我用楼主的例子在ms sqlserver2000做试验,能insert,可是死活Query不出来。出错信息是:
Exception unexpected token: as [from PersonModel as p where p.id=1]。 苦死我也!请问前辈们这是怎么回事?(在oracle9i上也是如此)。 thank you! 如果你用oracle9i也不行,请看看你数据库客户端和服务器端的驱动版本问题。会不会客户端的驱动不可用? 如果你用的MS SQL 2000,下面是我在某处看到的,看看是否有作用。 引用 Hibernate doesn't work with my MS SQL 2000 JDBC driver?
(Glen Stampoultzis) If you're using Hibernate with the Microsoft SQL Server 2000 JDBC driver chances are you'll run into this problem: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC] Can't start a cloned connection while in manual transaction mode. Simply add SelectMethod=Cursor; to your connection string. |
|
返回顶楼 | |
发表时间:2004-03-26
请问如果是mysql数据库,那么
hbm.xml文件怎么写,就你的这个例子来说? 谢谢 |
|
返回顶楼 | |
发表时间:2004-03-26
出现下面情况:
2004-3-26 17:16:57 net.sf.hibernate.cfg.Environment <clinit> 信息: Hibernate 2.1.2 2004-3-26 17:16:58 net.sf.hibernate.cfg.Environment <clinit> 信息: hibernate.properties not found 2004-3-26 17:16:58 net.sf.hibernate.cfg.Environment <clinit> 信息: using CGLIB reflection optimizer 2004-3-26 17:16:58 net.sf.hibernate.cfg.Configuration addClass 信息: Mapping resource: hiberante/PersonModel.hbm.xml 2004-3-26 17:16:59 net.sf.hibernate.cfg.Binder bindRootClass 信息: Mapping class: hiberante.PersonModel -> ZY_PERSON net.sf.hibernate.HibernateException: The dialect was not set. Set the property hibernate.dialect. at net.sf.hibernate.dialect.Dialect.getDialect(Dialect.java:354) at net.sf.hibernate.dialect.Dialect.getDialect(Dialect.java:375) at net.sf.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:57) at net.sf.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:48) at hiberante.TestPersonModel.main(TestPersonModel.java:30) Exception in thread "main" 数据库是:mysql xml: <?xml version="1.0" encoding="GB2312"?> <!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" > <hibernate-mapping> <class name="hiberante.PersonModel" table="ZY_PERSON"> <!--hibernate为我们生成主键id--> <id name="id" type="long"> <generator class="sequence"> <param name="sequence">ZY_PERSON_ID_SEQ</param> </generator> </id> <property name="name"/> <property name="address"/> </class> </hibernate-mapping> |
|
返回顶楼 | |