我在单独的JSP中连接ORACLE没有问题,现在使用S2SH就发生错误了
在oracle中数据表信息
T_USER(USERID NUMBER(4),USERNAME VARCHAR2(50))
序列为AUTOTESTID,主要提供给USERID使用
Hibernet的XML影射文件为
<class name="User" table="T_USER">
<id name="id" column="USERID" type="java.lang.Integer">
<generator class="sequence"><param name="sequence">AUTOTESTID</param></generator>
</id>
<property name="username" column="USERNAME" type="java.lang.String" length="50" not-null="true" generated="never" lazy="false" unique="true"/>
</class>
Tomcat主要错误提示信息如下:
Error creating bean with name 'userDao' defined in file
[C:\Server\Tomcat\webapps\test\WEB-INF\classes\applicationContext-dao.xml]:
Cannot resolve reference to bean 'sessionFactory'
while setting bean property 'sessionFactory';
nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'sessionFactory' defined in file
[C:\Server\Tomcat\webapps\test\WEB-INF\classes\applicationContext-dbConn.xml]:
Invocation of init method failed; nested exception is org.hibernate.MappingException:
could not instantiate id generator [entity-name=net.www.model.User]
求解答,不胜感激!
------解决方案--------------------
AUTOTESTID看看序列名是这个存在不
------解决方案--------------------
hibernate方言没指定Oracle方言。
------解决方案--------------------
<generator class="sequence"><param name="sequence">AUTOTESTID</param></generator>
就是无法实例化这个声明的generator,找各种可能的原因吧