当前位置: 代码迷 >> Java Web开发 >> 数据库问题!
  详细解决方案

数据库问题!

热度:274   发布时间:2007-04-09 20:02:37.0
数据库问题!

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: could not insert: [temp.Sick]
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause

org.hibernate.exception.GenericJDBCException: could not insert: [temp.Sick]
org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:1986)
org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2405)
org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:37)
org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:269)
org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:167)
org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:101)
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)
org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)
org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:530)
org.hibernate.impl.SessionImpl.save(SessionImpl.java:518)
org.hibernate.impl.SessionImpl.save(SessionImpl.java:514)
org.apache.jsp.MyJsp_jsp._jspService(MyJsp_jsp.java:85)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.

我用Hibernate框架插入数据时发生错误看样子好像是没有插入Sick类中但是我的show_sql时生成的sql语句正确的啊
Hibernate: insert into item.dbo.sick (name, pwd, tel, add, tag, time) values (?, ?, ?, ?, ?, ?) select scope_identity()

谁能告诉我错在那里 先谢谢了!

搜索更多相关主题的帖子: 数据库  jasper  apache  java  org  

----------------解决方案--------------------------------------------------------
自己已经找到错误了在这里和大家分享一下希望同志们不要和我一样啊

原因:
我有一张case表和sick表是关联关系,由于case是sql2000的关键字所以系统在读取xml时出错了
繁sql2000关键字不要出现在表的字段中和表名!!!(痛苦的经验啊。。。花了2小时才找到)
----------------解决方案--------------------------------------------------------
顺便发个sql关键字表



sql中的保留关键字
action add aggregate all
alter after and as
asc avg avg_row_length auto_increment
between bigint bit binary
blob bool both by
cascade case char character
change check checksum column
columns comment constraint create
cross current_date current_time current_timestamp
data database databases date
datetime day day_hour day_minute
day_second dayofmonth dayofweek dayofyear
dec decimal default delayed
delay_key_write delete desc describe
distinct distinctrow double drop
end else escape escaped
enclosed enum explain exists
fields file first float
float4 float8 flush foreign
from for full function
global grant grants group
having heap high_priority hour
hour_minute hour_second hosts identified
ignore in index infile
inner insert insert_id int
integer interval int1 int2
int3 int4 int8 into
if is isam join
key keys kill last_insert_id
leading left length like
lines limit load local
lock logs long longblob
longtext low_priority max max_rows
match mediumblob mediumtext mediumint
middleint min_rows minute minute_second
modify month monthname myisam
natural numeric no not
null on optimize option
optionally or order outer
outfile pack_keys partial password
precision primary procedure process
processlist privileges read real
references reload regexp rename
replace restrict returns revoke
rlike row rows second
select set show shutdown
smallint soname sql_big_tables sql_big_selects
sql_low_priority_updates sql_log_off sql_log_update sql_select_limit
sql_small_result sql_big_result sql_warnings straight_join
starting status string table
tables temporary terminated text
then time timestamp tinyblob
tinytext tinyint trailing to
type use using unique
unlock unsigned update usage
values varchar variables varying
varbinary with write when
where year year_month zerofill

----------------解决方案--------------------------------------------------------
  相关解决方案