[jboss-user] [JBoss Seam] - Re: Framework: Counting query entities

CptnKirk do-not-reply at jboss.com
Tue Apr 17 02:43:38 EDT 2007


Looks like a problem to me.  As a work around try something like:
@Name("myQuery")
  | public class MyQuery extends EntityQuery
  | {
  |     protected String getCountEjbql()
  |     {
  |         return "select count(*) without fetch";
  |     }
  |     
  |     public String getEjbql()
  |     {
  |         return "original query";
  |     }
  | }
  | 
Not as great as the components.xml solution, but should keep you functioning until this is sorted out.

Oh what the heck, you should be able to smack things around a bit.  Maybe even even include some components.xml like this.
<component name="someQuery" auto-create="true" class="x.y.MyQuery">
  |    <property name="countEjbql">select count(*) no fetch</property>
  |    <property name="ejbql">original</property>
  | </component>
  |    
  | <component name="OtherQuery" auto-create="true" class="x.y.MyQuery">
  |    <property name="countEjbql"></property>
  |    <property name="ejbql"></property>
  | </component>

not sure if the countEjbql stuff has a public setter might need to add one.  I guess in the end you have something like:
public class PersonQuery extends EntityQuery
  | {
  |     private String countEjbql;
  | 
  |     protected String getCountEjbql()
  |     {
  |         return countEjbql;
  |     }
  |     
  |     public void setCountEjbql(String query)
  |     {
  |         countEjbql = query;
  |     }
  | }
I haven't tried any of this, but it sounds about right to me.  Let me know.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4037844#4037844

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4037844



More information about the jboss-user mailing list