应该不是数据库连接的问题,我感觉是你的配置文件有问题,'public_DocClass_info' 是什么?把这部分的配置和程序贴出来!
解决方案 »
- 关于quartz集群的问题。
- list.size()总是出来1
- Tomcat里boneCP的使用问题
- args cannot be resolved,Syntax error on token(s), misplaced construct(s)
- java点击链接使他跳转到另一个页面显示相应的内容。
- 昨天我的女儿诞生了,高兴!散分
- VisualAge for Java 的使用方法?那里有啊!
- XML Notepad在什么地方下载?
- 求大项目的build.xml文件(or,网上比较权威全面的例子!)
- 数据库里取出的整数 我想除以100 保留两位小数 结果定义为什么类型啊
- 请问new出来的context在什么时候需要close?会不会由于某些原因没法被gc而导致内存泄漏?
- hibernate如何执行SQL语句?
PublicDocClassInfo是类名,映射public_DocClass_info数据表名
应该是这里面的问题
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" ><hibernate-mapping>
<!--
Created by the Middlegen Hibernate plugin 2.1 http://boss.bekk.no/boss/middlegen/
http://www.hibernate.org/
--><class
name="oa.bean.PublicDocClassInfo"
table="public_DocClass_info"
>
<meta attribute="class-description" inherit="false">
@hibernate.class
table="public_DocClass_info"
</meta> <id
name="id"
type="int"
column="id"
>
<meta attribute="field-description">
@hibernate.id
generator-class="assigned"
type="int"
column="id"
</meta>
<generator class="native" />
</id> <property
name="fatherId"
type="java.lang.Integer"
column="fatherId"
length="10"
>
<meta attribute="field-description">
@hibernate.property
column="fatherId"
length="10"
</meta>
</property>
<property
name="myName"
type="java.lang.String"
column="myName"
length="50"
>
<meta attribute="field-description">
@hibernate.property
column="myName"
length="50"
</meta>
</property>
<property
name="styleCode"
type="int"
column="style_code"
not-null="true"
length="10"
>
<meta attribute="field-description">
@hibernate.property
column="style_code"
length="10"
not-null="true"
</meta>
</property> <!-- Associations -->
</class>
</hibernate-mapping>
我估计此问题是否与Hibernate中dataSource一项相关,因为在用工具生成hbm文件时,我记得资料上说dataSource一项一定要如下配置(连接MSSqlServer时)
==================================
……
<property name="database.userid" value="sa"/>
<property name="database.password" value="123"/>
<property name="database.schema" value="dbo"/>
<property name="database.catalog" value="oa"/>
=================================
于是我在Hibernate的实始化文件中dataSource一段加了如下两个属性
=================================
<property name="schema">
<value>dbo</value>
</property>
<property name="catalog">
<value>oa</value>
</property>
=================================
结果,初始化时,出错提示说是这两个属性(dataSource)都是只读的,不让改。