MyException - 我的异常网
当前位置:我的异常网» Java Web开发 » sun.reflect.NativeMethodAccessorImpl.invoke0(Nat

sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)(2)

www.MyException.Cn  网友分享于:2013-01-02  浏览:4415次

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:864)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1665)
at java.lang.Thread.run(Thread.java:662)



这里是我的hibernate设置 <id name="bbsid" type="java.lang.Long">
  <column name="BBSID" precision="22" scale="0" />
  <generator class="sequence" >
  <param name="sequence">createbbs</param>
  </generator>
  </id>
oracle sequence创建语句:create sequence createbbs
increment by 1
start with 1
nomaxvalue
nocycle;

我的表结构是:-- Create table
create table DEMON.BBS
(
  BBSID INTEGER not null,
  USERNAME VARCHAR2(20),
  TITLE VARCHAR2(20),
  IP CHAR(15),
  REPLYCONT INTEGER,
  REPLYUSERNAME VARCHAR2(20),
  CREATETIME DATE,
  LASTREPLYTIME DATE
)
tablespace LASTDANCE
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
  initial 64
  minextents 1
  maxextents unlimited
  );
-- Create/Recreate primary, unique and foreign key constraints 
alter table DEMON.BBS
  add constraint BID primary key (BBSID)
  using index 
  tablespace LIGHT
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
  initial 64K
  minextents 1
  maxextents unlimited
  );
dao代码:就bbsid 没有被set
Bbs bbs=new Bbs();
bbs.setUsername(username);
bbs.setTitle(title);
bbs.setReplyusername(replyusername);
bbs.setReplycont(replycont);
bbs.setLastreplytime(lastreplytime);
bbs.setIp(ip);
bbs.setCreatetime(createtime);
bbsdao.save(bbs);


------解决方案--------------------
1.确认创建的序列是否正确
2.确认hibernate和创建表的位置在同一用户下
3.确认hibernate能连接上数据库
4.经过以上步骤,肯定木有问题

文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有