hibernate调用存储过程,数据库是sql2000 出错 java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]未能找到存储过程 'honor_visualize_pro'。
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)表和存储过程
USE db_companyIF OBJECT_ID('dbo.tb_honor_visualize') IS NOT NULL
DROP TABLE dbo.tb_honor_visualize
GOCREATE TABLE dbo.tb_honor_visualize (
vis_id int IDENTITY (1,1) NOT NULL primary key,
vis_name nvarchar (20) not null, --形象名称
vis_image nvarchar (100) not null --图片地址
)on [primary];insert into tb_honor_visualize values('中华汽车','logo.gif');--查询tb_honor_visualize表存储过程
use db_company
if exists (select name from sysobjects where name='honor_visualize_pro' and type='P')
drop procedure honor_visualize_pro
go
create procedure honor_visualize_pro
as
begin
select * from tb_honor_visualize
end
go
exec honor_visualize_pro映射文件
<hibernate-mapping>
<class name="com.company.model.TbHonorVisualize"
table="tb_honor_visualize" schema="dbo" catalog="db_company">
<id name="visId" type="java.lang.Integer">
<column name="vis_id" />
<generator class="increment" />
</id>
<property name="visName" type="java.lang.String">
<column name="vis_name" length="20" not-null="true" />
</property>
<property name="visImage" type="java.lang.String">
<column name="vis_image" length="100" not-null="true" />
</property>
</class>
<sql-query name="getTbHonorVisualizeList" callable="true">
<return alias="TbHonorVisualize" class="com.company.model.TbHonorVisualize">
<return-property name="visId" column="vis_id" />
<return-property name="visName" column="vis_name" />
<return-property name="visImage" column="vis_image" />
</return>
{call honor_visualize_pro()}
</sql-query>
</hibernate-mapping>
dao类
public List<TbHonorVisualize> findAllbypro() {
Session session =(Session) HibSessionFactory.currentSession();
Transaction tx = session.beginTransaction();
Query query=session.getNamedQuery("getTbHonorVisualizeList");
List list=query.list();
tx.commit();
return list;
}其实我不用存储过程就没什么错误,用了存储过程就出现这样的错误了,况且驱动包和系统升级包都打了。什么地方该改的,该做的,我都做了,还是有错,也请了很多高人都解决不了。还请那位好心人帮帮忙。一起来解决这个难题,谢谢!!!
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)表和存储过程
USE db_companyIF OBJECT_ID('dbo.tb_honor_visualize') IS NOT NULL
DROP TABLE dbo.tb_honor_visualize
GOCREATE TABLE dbo.tb_honor_visualize (
vis_id int IDENTITY (1,1) NOT NULL primary key,
vis_name nvarchar (20) not null, --形象名称
vis_image nvarchar (100) not null --图片地址
)on [primary];insert into tb_honor_visualize values('中华汽车','logo.gif');--查询tb_honor_visualize表存储过程
use db_company
if exists (select name from sysobjects where name='honor_visualize_pro' and type='P')
drop procedure honor_visualize_pro
go
create procedure honor_visualize_pro
as
begin
select * from tb_honor_visualize
end
go
exec honor_visualize_pro映射文件
<hibernate-mapping>
<class name="com.company.model.TbHonorVisualize"
table="tb_honor_visualize" schema="dbo" catalog="db_company">
<id name="visId" type="java.lang.Integer">
<column name="vis_id" />
<generator class="increment" />
</id>
<property name="visName" type="java.lang.String">
<column name="vis_name" length="20" not-null="true" />
</property>
<property name="visImage" type="java.lang.String">
<column name="vis_image" length="100" not-null="true" />
</property>
</class>
<sql-query name="getTbHonorVisualizeList" callable="true">
<return alias="TbHonorVisualize" class="com.company.model.TbHonorVisualize">
<return-property name="visId" column="vis_id" />
<return-property name="visName" column="vis_name" />
<return-property name="visImage" column="vis_image" />
</return>
{call honor_visualize_pro()}
</sql-query>
</hibernate-mapping>
dao类
public List<TbHonorVisualize> findAllbypro() {
Session session =(Session) HibSessionFactory.currentSession();
Transaction tx = session.beginTransaction();
Query query=session.getNamedQuery("getTbHonorVisualizeList");
List list=query.list();
tx.commit();
return list;
}其实我不用存储过程就没什么错误,用了存储过程就出现这样的错误了,况且驱动包和系统升级包都打了。什么地方该改的,该做的,我都做了,还是有错,也请了很多高人都解决不了。还请那位好心人帮帮忙。一起来解决这个难题,谢谢!!!
解决方案 »
- showmodaldialog 如何动态加载父窗口的所有函数或者直接include父窗口,但要动态的
- Could not execute JDBC batch update(hibernate+spring)
- Spring管理Action 中的 scope="prototype"
- 从oracle一个表中导出10万条记录,写入excel中慢,如何优化hibernate
- 关于的Spring2.5的java.util.Hashtable的IOC问题,ecplise成功,tomcat失败!急求解!
- F5负载jsessionid时常变化
- tomcat启动问题
- 谁能详细解释一下flex和ajax是干什么的?有什么区别!
- 问:我用formulaOne设计器,生成的test.jod,怎么应用到jsp中呀?
- javaEE问题求助
- 如何将excel表中的数据导入我要存放的数据库中
- 特急!Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated
http://www.xuancheng.org/thread-153480-1-1.html