没有看到您的配置文件,提示错误是你的GiisQueryConfig 没有被映射
解决方案 »
- eclipse的tomcat装好了,可是在eclipse里点击start tmocat,会出现异常
- java.sql.SQLException: 索引中丢失 IN 或 OUT 参数:: 1 怎么解决
- fusioncharts获取xml数据源路劲问题?
- struts部署的时候出现问题
- 动态生成对象
- 提到javaEE就会提到MVC,谈到MVC就会说SSH,但是很多高手又说SSH性能有争议
- 关于struts
- 关于Context,InitialContext()的使用问题
- 启动j2ee的问题--j2ee -verbose
- 看一下我这个关于处理事务的类中的Connection对象的疑问
- hibernate初学者调试代码的疑问
- Servlet 和 JavaBean 区别和联系? 小弟初学,可能问题比较可笑……
<!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 - Hibernate Tools
-->
<hibernate-mapping>
<class name="com.infoair.giis.hibernate.mapping.GiisQueryConfig" table="GIIS_QUERY_CONFIG" schema="dbo" catalog="MIXAODB">
<id name="id" type="java.lang.Integer">
<column name="ID" />
<generator class="assigned"></generator>
</id>
<property name="funcName" type="java.lang.String">
<column name="FUNC_NAME" length="30" not-null="true" />
</property>
<property name="criteria" type="java.lang.String">
<column name="CRITERIA" length="100" />
</property>
<property name="sequence" type="java.lang.Integer">
<column name="SEQUENCE" not-null="true" />
</property>
<property name="tableName" type="java.lang.String">
<column name="TABLE_NAME" length="50" not-null="true" />
</property>
<property name="tableDesc" type="java.lang.String">
<column name="TABLE_DESC" length="50" />
</property>
<property name="fieldName" type="java.lang.String">
<column name="FIELD_NAME" length="50" not-null="true" />
</property>
<property name="fieldDesc" type="java.lang.String">
<column name="FIELD_DESC" length="50" />
</property>
</class>
</hibernate-mapping>
String hql="from GiisQueryConfig as config";
List list = session.createQuery(hql).list();
Iterator it=list.iterator();
while(it.hasNext())
{
String result=null;
Object[] results=(Object[])it.next();
System.out.println(results[0]);
.....}
只是他没有涉及到jsp的内容都在java中写的,向上面那种样子
再问个问题,如果在同一个jsp页面中获取下拉列表的值?
<html:option>default value</html:option>
<html:option property="formpropertyvalue">selected value</html:option>
</html:select>
用Form就行了
又出了一个问题
String hql="from GiisQueryConfig as config";
List list = session.createQuery(hql).list();
不带where的hql可以执行并能显示出数据库中的数据,可是加上where条件之后,就取不出数据了,也不报错误,是怎么回事呢?
public List getDatas(String p0){
....
funcname=p0;
....
String hql="from GiisQueryConfig as config where config.funcName like '%"+funcname+"%'";
List list = session.createQuery(hql).list();
it=qp.getDatas("查询制定城市天气").iterator();
while(it.hasNext())
{AbstractGiisQueryConfig results=(AbstractGiisQueryConfig)it.next(); %>
<td nowrap align="center" bgcolor="#426388">
<font color="#FFFFFF"><font face="仿宋_GB2312"><%=results.getFieldDesc()%></font></td>
}%>java中:
public class DBGiisQueryConfig {
public List getDatas(String p0){
Session session = null;
Transaction tx = null;
String funcname=p0;
try {
session = HibernateSessionFactory.getSession();
tx = session.beginTransaction();
String hql="from GiisQueryConfig as config where config.funcName = '"+funcname+"'";
List list = session.createQuery(hql).list();
tx.commit();
return list;
} catch (HibernateException e) {
e.printStackTrace();
if (tx != null)
try {
tx.rollback();
} catch (HibernateException e1) {
e1.printStackTrace();
}
return null;
} finally {
try {
if (session != null)
HibernateSessionFactory.closeSession();
} catch (HibernateException e1) {
e1.printStackTrace();
}
}
}不带where条件句也是用这种方法实现了,可是这个就是不行呢!