hibernate 调用 存储过程 问题

ajdpgm330x1 2009-09-28 04:19:03
hibernate映射
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
<class name="com.sxyh.entity.TRoom" table="t_Room" schema="dbo" catalog="PrisonSecurity">
<id name="finterId" type="java.lang.Integer">
<column name="FInterID" />
<generator class="native" />
</id>
<property name="fnumber" type="java.lang.String">
<column name="FNumber" length="50" not-null="true" />
</property>
<property name="fname" type="java.lang.String">
<column name="FName" length="50" not-null="true" />
</property>
<property name="fnote" type="java.lang.String">
<column name="FNote" />
</property>
<set name="TDevices" inverse="true" lazy="false">
<key>
<column name="FRoomID" not-null="true" />
</key>
<one-to-many class="com.sxyh.entity.TDevice" />
</set>
</class>
<sql-query name="proc" callable="true">
<return alias="Room" class="com.sxyh.entity.TRoom">
<return-property name="FInterID" column="FInterID" />
<return-property name="FNumber" column="FNumber" />
<return-property name="FName" column="FName" />

</return>
{call proc()}
</sql-query>

</hibernate-mapping>




执行方法
Session session =HibernateSessionFactory.getSession();
// SQLQuery query = session.createSQLQuery("{Call proc()}");
Query query = session.getNamedQuery("proc");

List list =query.list();
System.out.println("s=========="+list.size());
session.close();


结果关键字 'proc' 附近有语法错误。哪一步错了哪位大哥说下
...全文
43 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
lctlx2 2009-09-30
  • 打赏
  • 举报
回复
你还没有openSesstion

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧