[jboss-user] [JBoss Seam] - EntityQuery Restrictions/SG problems with Integer Field in q

2007-11-12 Thread griffitm
Hello All, 

I am having a problem with a component generated from SeamGen.  I have a query 
form that allows the user to search the resultList as such:
h:form id=sectionSearch styleClass=edit
  | 
  | rich:simpleTogglePanel label=Section search parameters 
switchType=ajax
  | 
  | s:decorate template=layout/display.xhtml
  | ui:define name=labelNumber/ui:define
  | h:inputText id=number 
value=#{sectionList.section.number}/
  | /s:decorate
  |   ...  
  | 

The SectionList Entity Query has a restriction as such:

  | private static final String[] RESTRICTIONS = {
  | lower(section.description) like 
concat('%',concat(lower(#{sectionList.section.description}),'%')),
  | lower(section.number) like 
concat('%',concat(lower(#{sectionList.section.number}),'%')),};
  | lower(section.subsection) like 
concat('%',concat(lower(#{sectionList.section.subsection}),'%')),};
  | 

The problem is that when I display the form the query field is bound to the 
current section, and which returns 0 for the section # -- and my query results 
only show sections where the section # has a Zero in it.  I tried to 
dynamically inspect the query value in the overridden getRestrictions method as 
such:

  | @Override
  | public ListString getRestrictions() {
  | ListString restrictions= Arrays.asList(RESTRICTIONS);
  | if(section.getNumber()  0){
  | restrictions.add(lower(section.number) like 
concat('%',concat(lower(#{+ section.getNumber() +}),'%')));
  | }
  | return restrictions;
  | }
But that throws an this exception:
  | javax.el.ELException: /SectionList.xhtml: Error reading 'resultList' on 
type gov.hhs.fda.ocio.fdaaa.entity.SectionList_
  | $_javassist_0
  | at 
com.sun.facelets.compiler.TextInstruction.write(TextInstruction.java:48)
  | at 
com.sun.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:39)
  | at 
org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:280)
  | at 
org.richfaces.renderkit.html.PanelRenderer.doEncodeBegin(PanelRenderer.java:168)
  | at 
org.richfaces.renderkit.html.PanelRenderer.doEncodeBegin(PanelRenderer.java:128)
  | at 
org.ajax4jsf.renderkit.RendererBase.encodeBegin(RendererBase.java:101)
  | at 
javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:788)
  | at javax.faces.component.UIComponent.encodeAll(UIComponent.java:884)
  | at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
  | at 
com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:577)
  | at 
org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
  | at 
org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:216)
  | at 
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
  | at 
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
  | at 
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
  | at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
  | at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
  | at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  | at 
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
  | at 
org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
  | at 
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
  | at 
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
  | at 
org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
  | at 
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
  | at 
org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
  | at 
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
  | at 
org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
  | at 
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
  | at 
org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
  | at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
  | at 
org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
  | at 
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
  | at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
  | at 
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
  | at 

[jboss-user] [JBoss Seam] - EntityQuery Restrictions

2007-10-24 Thread griffitm
Hello All, 

I have some components generated by seamgen, specifically the EntityQuery Lists 
that relate to a list of entity objects.  The seam generated search form allows 
the restrictions to be passed to the query:

  | public class StatusList extends EntityQuery {
  | 
  | private static final String[] RESTRICTIONS = 
{lower(status.description) like concat('%', 
concat(lower(#{statusList.status.description}),'%')),};
  | ...
  | private Status status = new Status();
  | 
  | @Override
  | public String getEjbql() {
  | return select status from Status status order by 
status.sortOrder;
  | }
  | ...
The query works well if no parameters are passed to the restrictions, the list 
is returned in the correct order, however if I pass a parameter to the 
restrictions clause the predicates of where/order are mixed up and invalid SQL 
is executed, which of course produces an error.

What is the correct way to approach this?

Thanks in advance!
MG


View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4098380#4098380

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4098380
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - EntityQuery - Restrictions usage query!

2007-10-08 Thread rnallakukkala
Hi,

Im have my pojo extend EntityQuery class and would like to include 
restrictions in my query; I see, I could override the method getRestrictions 
but havent found examples of doing that (seam-2.0.0.BETA1).

Can you throw some light on the usage of restrictions by overriding 
getRestrictions? 

Thanks

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4092649#4092649

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4092649
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user