ContextJavax.naming.NameNotFoundException: Name hibernate_connection_factory is not bound in this Context
tomcat+struts+hibernate+sqlserver項目
如果某個hibernate.XML文件中的 id generator 寫<generator class="identity"/>
而其他的寫<generator class="native"/>則報錯:
Javax.naming.NameNotFoundException: Name hibernate_connection_factory is not bound in this Context
無法連接到sqlserver數據庫!
=================================================
hibernate的ClassCastException
tomcat+struts+hibernate+sqlserver2000項目
獲取用戶類型列表時候,報錯:
[WARN] TypeDAO - Java.lang.ClassCastException: com.shjinbang.hibernate.Type
應該將object[]改成object,因為user表和其他表沒有關聯,如果有關聯就要用數組了.
以下是代碼
Iterator itr = null;
itr = query.iterate();
while(itr.hasNext()){
log.debug("while itr start,,Object[])itr.next()");
Object object[] = (Object[])itr.next();
UserForm userForm = new UserForm();
User user=(User)object[0];
userForm.setUserid(user.getUserid());
userForm.setUserName(user.getUserName());
userForm.setPassword(user.getPassWord());
userlist.add(userForm);
}