Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Database/JDBC/SQL/JDO/Hibernate  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 那位高手帮我看看个问题(Hibernate)
yangke250





发贴: 1
积分: 0
于 2006-12-09 16:29 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
那位高手帮我看看个问题额,大恩他日必永泉

Test类:

package test;

import org.hibernate.Session;
import org.hibernate.Transaction;

public class Test {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
HibernateSessionFactory hsf=new HibernateSessionFactory();
Session ss=hsf.getSession();
Transaction ts=ss.beginTransaction();
One o=new One();
o.setId("11");
o.setUid("123");

ss.save(o);
ts.commit();
ss.close();
}

}

one.hbm.xml:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse - Hibernate Tools
-->
<hibernate-mapping>
<class name="test.One" table="ONE" schema="WANGLIANG">
<id name="id" type="java.lang.String" unsaved-value="null">
<column name="ID" length="10" />
<generator class="uuid.hex" />
</id>
<property name="uid" type="java.lang.String">
<column name="UID" length="10" not-null="true" />
</property>
</class>
</hibernate-mapping>
其他的全是myeclipse生成的为什么会抱:

Exception in thread "main" org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:202)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:297)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:985)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:333)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at test.Test.main(Test.java:21)
Caused by: java.sql.BatchUpdateException: ORA-00928: 缺少 SELECT 关键字

at oracle.jdbc.dbaccess.DBError.throwBatchUpdateException(DBError.java:459)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:3907)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:58)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:195)
... 8 more

的错误!!!!


why edited on 2006-12-10 10:45

作者 Re:那位高手帮我看看个问题(Hibernate) [Re:yangke250]
ptclin2006





发贴: 2
积分: 0
于 2007-01-09 13:43 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
会不会是配置文件ID设置有问题


作者 Re:那位高手帮我看看个问题(Hibernate) [Re:yangke250]
JiafanZhou



版主


发贴: 736
积分: 61
于 2007-02-21 17:51 user profilesend a private message to usersend email to JiafanZhousearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
show us your One.java and hibernate.cfg.xml


When I was a kid I used to pray every night for a new bike. Then I realized that The Lord doesn't work that way, so I stole one and asked him to forgive me.

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923