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);
}