I receive an error when I use this querry in a Statefull Entity (selectApplication):
return em.createQuery("select a from Application a " +
"where lower(a.name) like :name " +
"and lower(a.description) LIKE :description "
+
"and a.category = :category order by a.name")
.setParameter("name", name)
.setParameter("description", description)
.setParameter("category", category);
I have 2 entities: Application and Category.
This example comes from DVDStore and the name, description and Category comes from a JSF
page:
<h:selectOneMenu value="#{selectApplication.category}">
<s:convertEntity />
<ui:remove> <f:selectItem itemLabel="Any"
itemValue="#{anyCategory}" /></ui:remove>
<s:selectItems value="#{allCategories.resultList}"
var="category" label="#{category.name}"
noSelectionLabel="ANY" />
</h:selectOneMenu>
I receive this error:
javax.servlet.ServletException: Error calling action method of component with id
_id39:_id54
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:152)
...
Caused by: javax.faces.el.EvaluationException: /selectApplication.xhtml @48,51
action="#{selectApplication.doSearch}":
javax.ejb.EJBTransactionRolledbackException: java.lang.IllegalStateException:
org.hibernate.TransientObjectException: object references an unsaved transient instance -
save the transient instance before flushing: com.mycompany.seam.refdata.model.Category
at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:73)
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4067364#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...