|
|
|
|
|
|
|
谁来救救我谢谢关于SSH的
|
2007年07月10日 16:04
|
|
|
标签列表
|
|
我是这样调用的 public static void main(String[] args) { AbstractApplicationContext context = AppContext.getInstace() .getAppContext(); OrderDAO dao = (OrderDAO) context.getBean("orderService"); java.util.List list = dao.getOrderDetails(); System.out.println(list.size());
} 方法是这样实现的 public List getOrderDetails() { // TODO 自动生成方法存根 hql = "from Orderdetail"; // list = // this.getHibernateTemplate().loadAll(Orderdetail.class); list = this.getHibernateTemplate().find(hql); System.out.println(list.size() + ">>>size"); if (list.size() > 0) { return list; } return null; } Hibernate: select orderdetai0_.id as id2_, orderdetai0_.bid as bid2_, orderdetai0_.oid as
oid2_, orderdetai0_.orderprice as orderprice2_, orderdetai0_.number as number2_ from
bookStoreBusiness.dbo.orderdetail orderdetai0_ org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not execute
query; uncategorized SQLException for SQL [select orderdetai0_.id as id2_, orderdetai0_.bid
as bid2_, orderdetai0_.oid as oid2_, orderdetai0_.orderprice as orderprice2_,
orderdetai0_.number as number2_ from bookStoreBusiness.dbo.orderdetail orderdetai0_]; SQL
state [HY000]; error code [0]; [Microsoft][SQLServer 2000 Driver for JDBC]Value can not be
converted to requested type.; nested exception is java.sql.SQLException: [Microsoft]
[SQLServer 2000 Driver for JDBC]Value can not be converted to requested type. java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Value can not be converted
to requested type. 谁看得懂这个异常 主要原因好象是这个Value can not be converted to requested type.
|
|
|
|
|
|
re:谁来救救我谢谢关于SSH的
|
2007年07月10日 16:04
|
|
|
与这个方法有关联的数据库是这样的 --订单表 if exists(select * from sysobjects where name ='orders') drop table orders create table orders ( id int identity(1,1) not null primary key,--订单编号 uid int not null,--订货人 delivermode varchar(30),--送货方式 paymode varchar(30),--付款方式 amount float(18) default(0),--订单总金额 orderdate datetime default(getdate()),--下订单日期 state varchar(10) default('未处理')--处理状态 ) go --订单明细表 if exists(select * from sysobjects where name ='orderdetail') drop table orderdetail create table orderdetail ( id int identity(1,1) not null primary key,--订单明细编号 oid int ,--订单编号 bid int ,--书籍编号 orderprice float(10) not null,--订单价格 number Float default(1) not null--订货数量 ) --书籍信息表 if exists(select * from sysobjects where name ='books') drop table books create table books ( id int identity(1,1) not null primary key,--书籍编号 bookname varchar(60) not null,--书籍名称 author varchar(50) default('未填'),--作者 price float(10) default(0),--定价 number int default(0),--存货数量 pubdate datetime,--出版日期 picture varchar(50) default('无'),--书籍图片 descript varchar(300) default('无'),--书籍说明 tid int,--二级类别编号,外健 pid int --出版商编号 )
|
|
|
|