我想在页面上 根据点击父机构ID查询他的所有子机构 结果出错了,弄了很久没弄出来。希望大侠帮帮忙! 谢谢
type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception javax.servlet.ServletException: org.springframework.orm.hibernate3.HibernateSystemException: could not get a field value by reflection getter of com.oa.model.Organization.id; nested exception is org.hibernate.PropertyAccessException: could not get a field value by reflection getter of com.oa.model.Organization.id
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:422)
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)机构对象是这样的
/**
* @hibernate.id
* generator-class="native"
*/
private int id;
/**
* @hibernate.property
*/
private String name;
/**
* @hibernate.property
*/
private String sn; //唯一的编号
/**
* @hibernate.property
*/
private String description;
/**
* @hibernate.many-to-one
*
*/
private Organization parent;
/**
* @hibernate.set inverse="true"
* @hibernate.key column="pid"
* @hibernate.one-to-many
* class="com.oa.model.Organization"
*/
private Set<Organization> children;
/**
* @return the name
*/
根据Java对象生成的Hibernate配置文件如下
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"><hibernate-mapping>
<class table="t_organization" name="com.oa.model.Organization">
<id access="field" name="id">
<generator class="native"/>
</id>
<property name="name" access="field"/>
<property name="sn" access="field"/>
<property name="description" access="field"/>
<many-to-one access="field" name="parent"/>
<set access="field" name="children" inverse="true">
<key column="pid"/>
<one-to-many class="com.oa.model.Organization"/>
</set>
</class>
</hibernate-mapping>
type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception javax.servlet.ServletException: org.springframework.orm.hibernate3.HibernateSystemException: could not get a field value by reflection getter of com.oa.model.Organization.id; nested exception is org.hibernate.PropertyAccessException: could not get a field value by reflection getter of com.oa.model.Organization.id
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:422)
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)机构对象是这样的
/**
* @hibernate.id
* generator-class="native"
*/
private int id;
/**
* @hibernate.property
*/
private String name;
/**
* @hibernate.property
*/
private String sn; //唯一的编号
/**
* @hibernate.property
*/
private String description;
/**
* @hibernate.many-to-one
*
*/
private Organization parent;
/**
* @hibernate.set inverse="true"
* @hibernate.key column="pid"
* @hibernate.one-to-many
* class="com.oa.model.Organization"
*/
private Set<Organization> children;
/**
* @return the name
*/
根据Java对象生成的Hibernate配置文件如下
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"><hibernate-mapping>
<class table="t_organization" name="com.oa.model.Organization">
<id access="field" name="id">
<generator class="native"/>
</id>
<property name="name" access="field"/>
<property name="sn" access="field"/>
<property name="description" access="field"/>
<many-to-one access="field" name="parent"/>
<set access="field" name="children" inverse="true">
<key column="pid"/>
<one-to-many class="com.oa.model.Organization"/>
</set>
</class>
</hibernate-mapping>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货