I have a database set up with hibernate. In my jsp page I display a form to insert values, and I pass those values into my java class, which then saves that entry into a database, which works fine, but when I want to display the data from my table it gives me the error
org.apache.jasper.el.JspPropertyNotFoundException: /list_object.jsp(45,0) '${objectManager.allObjects}' The class 'ObjectManager$$EnhancerByCGLIB$$b2d7311' does not have the property 'allObjects'
For the line
<c:forEach var="object" items="${objectManager.allObjects}">
in
<c:forEach var="object" items="${objectManager.allObjects}">
<tr>
<td><c:out value="${object.objectID}"/></td>
<td><c:out value="${object.objectRule}"/></td>
</tr>
</c:forEach>
I think this is a problem with the Hibernate-Proxy-Object, but I run the same operation with another table/bean with the line
<c:forEach var="object" items="${objectManager.allLayouts}">
and it runs perfectly fine. I checked my xml config files and my hbm.xml config and the bean was set up correctly. I don’t know where the error originates from, and why it would work fine for one Spring-bean and not for the other
EDIT:
@Transactional
public class ObjectManager{
private SessionFactory sessionFactory;
public void saveObject(Objects object){
getCurrentSession().save(object);
}
@SupressWarnings("unchecked")
public Iterable<Objects> getAllObjects(){
return getCurrentSession().createCriteria(Objects.class)
.addOrder(Order.desc("objectID"))
.list():
}
I think the error is pretty self explanatory.
There is no
getAllObjects()method for theobjectManagerobject.Your working example is using a different method –
getAllLayouts().