[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-3302) Suquery not working correctly with <framework:restrictions>

Tim Timson (JIRA) jira-events at lists.jboss.org
Fri Aug 22 19:55:38 EDT 2008


    [ https://jira.jboss.org/jira/browse/JBSEAM-3302?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12426306#action_12426306 ] 

Tim Timson commented on JBSEAM-3302:
------------------------------------

Looks like the line of the log entry I copied was too long for jira to handle.  Here is that part of the log entry again, with line breaks so it will fit and so it is more readable.

Caused by: javax.el.ELException: /events/registration-report.xhtml @29,71 value="#{eventItems}": java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: unexpected token: and near line 1, column 879
    [select pricedItem,
                                       (select sum(cartEntries.amountCharged) 
                                       from com.el.sbo.model.user.Cart as cart
                                        join cart.entries as cartEntries
                                       join cartEntries.item as item
                                       where pricedItem.id = item.id)
                                      ,(select count(cartEntries.amountCharged)
                                        from com.el.sbo.model.user.Cart as cart
                                        join cart.entries as cartEntries
                                       join cartEntries.item as item
                                       where pricedItem.id = item.id)
  from com.el.sbo.model.event.PricedItem pricedItem and pricedItem.event = :el1]
        at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:76)
        at javax.faces.component.UIData.getValue(UIData.java:582)
                        ... etc...


Note: The following line
    from com.el.sbo.model.event.PricedItem pricedItem AND pricedItem.event = :el1]
Should have been rendered by Seam as
    from com.el.sbo.model.event.PricedItem pricedItem WHERE pricedItem.event = :el1]



> Suquery not working correctly with <framework:restrictions>
> -----------------------------------------------------------
>
>                 Key: JBSEAM-3302
>                 URL: https://jira.jboss.org/jira/browse/JBSEAM-3302
>             Project: Seam
>          Issue Type: Feature Request
>          Components: Framework
>         Environment: Windows XP
>            Reporter: Tim Timson
>
> I have created a query in components xml and added a restriction using the <framework:restrictions> tag.  The restriction should add a where clause, but instead it is adding an "and", thinking the "where" is already in place.  I assume this is because there is a "where" statement in a subquery contained in the ejbql.
> Here is the entry in components.xml which causes the error.
>     <framework:entity-query name="eventPricedItemsQuery"
>                             ejbql="select pricedItem,  
>                                                  (select sum(cartEntries.amountCharged) 
>                                                    from Cart as cart 
>                                                    join cart.entries as cartEntries
>                                                    join cartEntries.item as item
>                                                    where pricedItem.id = item.id)                                       
>                                         from PricedItem pricedItem">
>         <framework:restrictions>
>             <value>pricedItem.event = #{currentEvent}</value>
>         </framework:restrictions>                                        
>     </framework:entity-query>
> I can work around it by removing the restriction and adding a where clause to the ejbql, but have reasons for wanting to use the <framework:restrictions> tag instead.
> Here is some of the stack trace I used to determine that an "and" was being placed into the query by Seam when a "where" should have been created:
> Caused by: javax.el.ELException: /events/registration-report.xhtml @29,71 value="#{eventItems}": java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: unexpected token: and near line 1, column 879 [select pricedItem,                                         (select sum(cartEntries.amountCharged)                                        from com.el.sbo.model.user.Cart as cart                                        join cart.entries as cartEntries                                       join cartEntries.item as item                                       where pricedItem.id = item.id)                                      ,(select count(cartEntries.amountCharged)                                        from com.el.sbo.model.user.Cart as cart                                        join cart.entries as cartEntries                                       join cartEntries.item as item                                       where pricedItem.id = item.id)                                                                            from com.el.sbo.model.event.PricedItem pricedItem and pricedItem.event = :el1]
>         at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:76)
>         at javax.faces.component.UIData.getValue(UIData.java:582)
>         ... 68 more
> Caused by: java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: unexpected token: and near line 1, column 879 [select pricedItem,                                         (select sum(cartEntries.amountCharged)                                        from com.el.sbo.model.user.Cart as cart                                        join cart.entries as cartEntries                                       join cartEntries.item as item                                       where pricedItem.id = item.id)                                      ,(select count(cartEntries.amountCharged)                                        from com.el.sbo.model.user.Cart as cart                                        join cart.entries as cartEntries                                       join cartEntries.item as item                                       where pricedItem.id = item.id)                                                                            from com.el.sbo.model.event.PricedItem pricedItem and pricedItem.event = :el1]
>         at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:617)
>         at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:96)
>         at org.jboss.seam.persistence.EntityManagerProxy.createQuery(EntityManagerProxy.java:79)
>         at org.hibernate.search.jpa.impl.FullTextEntityManagerImpl.createQuery(FullTextEntityManagerImpl.java:130)
>         at org.jboss.seam.persistence.EntityManagerProxy.createQuery(EntityManagerProxy.java:79)
>         at org.jboss.seam.framework.EntityQuery.createQuery(EntityQuery.java:175)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       




More information about the seam-issues mailing list