1 Reply Latest reply on May 20, 2008 12:17 PM by Pete Muir

    Trinidad dataModel

    Ido Tamir Newbie

      Hi,
      thank you very much for the nice dataModel. It makes working already very simple.


      However I have 2 questions:





      • When I try to eager fetch a property it fails. The same query works when i am displaying it as resultList:




      from Game as game
      left join fetch game.firstTeam 
      left join fetch game.secondTeam




      java.lang.IllegalArgumentException: org.hibernate.QueryException: query specified join fetching, but the owner of the fetched association was not present in the select list [FromElement{explicit,not a collection join,fetch join,fetch non-lazy properties,classAlias=null,role=null,tableName=Team,tableAlias=team1_,origin=Game game0_,colums={game0_.firstTeam_id ,className=org.jockeysoft.better.entity.Team}}] [select count(*) from org.jockeysoft.better.entity.Game as game                            left join fetch game.firstTeam               left join fetch game.secondTeam ]
              at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:616)
              at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:95)
              at org.jboss.seam.persistence.EntityManagerProxy.createQuery(EntityManagerProxy.java:79)
              at org.jboss.seam.framework.EntityQuery.createCountQuery(EntityQuery.java:198)
              at org.jboss.seam.framework.EntityQuery.initResultCount(EntityQuery.java:128)
              at org.jboss.seam.framework.EntityQuery.getResultCount(EntityQuery.java:120)
              at org.trinidad.SeamCollectionModel.getRowCount(SeamCollectionModel.java:47)
              at org.apache.myfaces.trinidad.component.UIXCollection.getRowCount(UIXCollection.java:337)
              at org.apache.myfaces.trinidad.model.ModelUtils.findLastIndex(ModelUtils.java:130)
              at org.apache.myfaces.trinidad.component.TableUtils.getLast(TableUtils.java:83)
              at org.apache.myfaces.trinidad.component.TableUtils.getLast(TableUtils.java:57)
              at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.table.TableUtils.getVisibleRowCount(TableUtils.java:142)
              at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.table.RowData.<init>(RowData.java:34)
              at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.table.TableRenderingContext.<init>(TableRenderingContext.java:68)
              at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.TableRenderer.createRenderingContext(TableRenderer.java:498)
              at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.TableRenderer.encodeAll(TableRenderer.java:343)
              at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:220)





      • Is it possible (a valid feature request) to make the max-results resolvable at runtime with EL as in:



      <framework:entity-query name="allGamesByNr" ejbql="from Game as game" order="nr" max-results="#{user.maxResultPreference}">




      thank you very much,
      ido