JiveJdon Community Forums
在线268人   首页   主题总表   培训咨询   精华   查搜   注册    登陆
首页 » 论坛 » J2EE/JavaEE/JEE/EJB/JSF等技术讨论
???en_US.forumThreadPrev.name??? 上一主题
  Go back to the topic 返回本主题   Go back to the topic listing返回主题列表
???en_US.forumThreadNext.name??? 下一主题
Go 总共有 1 回复 / 1
 发表新帖子   回复该主题贴
29163077

悄悄话
发表文章: 3
注册时间: 2007年07月10日 15:58
谁来救救我谢谢关于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.
29163077

悄悄话
发表文章: 3
注册时间: 2007年07月10日 15:58
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 --出版商编号
)
这个主题有 1 回复 / 1Go
???en_US.forumThreadPrev.name??? 上一主题
  Go back to the topic 返回本主题   Go back to the topic listing返回主题列表    返回页首返回页首
???en_US.forumThreadNext.name??? 下一主题
热点TAG: AOP cache 缓存 DDD EJB 集群 设计模式 Hibernate IOC JiveJdon OO RBAC Seam Spring Struts
正在读取,请等待...
google yahoo 新浪ViVi 365Key网摘 天极网摘 CSDN网摘 添加到百度搜藏 POCO网摘 博采网摘
查询本论坛内 回复超过的热门帖子
     回复该主题贴
标题
 
粗体 斜体 下划线 插入图片 插入代码 插入url链接 插入附件
内容
 

手机阅读 add to google add to yahoo
解惑之道在J道 ,打造中国最具影响力的的企业软件社区
OpenSource JIVEJDON v3.0 Powered by JdonFramework Code © 2002-08 jdon.com
anti spam