1 Reply Latest reply on Apr 28, 2010 3:39 PM by tomj

    Fiber questions

    Moussambani2

      Hi all,

       

      I have 2 questions regarding filters for the fiber data model:

       

      Is it possible to retrieve data other than the entities defined in the data model? For example, I would like to be able to retrieve the average of some property in my datamodel. I have tried to create a filter with a jpql query to do that like:

       

              <filter name="getAveragePrice">
                  <query><![CDATA[jpql:select avg(o.price) from Orders o]]></query>
              </filter>

       

       

      But when I try to get that fill I get the error:

       

      The item of type, 'java.lang.Double', passed to the assembler does not match the assembler's configured entity type, 'MyPackage.package2.Orders'.  To convert 'flex.messaging.io.amf.ASObject' to a strong type automatically, set the item-class in the destination.
      null

       

      Does anyone know how to solve this problem?

       

      Further, I have two entities with an association :

       

          <entity name="Customer" persistent="true">
              <annotation name="VisualModeler">
                  <item name="x">957</item>
                  <item name="y">298</item>
                  <item name="width">115</item>
                  <item name="height">78</item>
              </annotation>
              <annotation name="LiveCycleES">
                  <item name="generate_type">true</item>
              </annotation>
              <annotation name="ServerProperties">
                  <item name="ServerType">LCDS</item>
              </annotation>
              <property name="name" type="string"/>
              <id name="ID" type="integer" generated="false"/>
              <property name="orders" type="Orders[]" mappedBy="customer"/>
          </entity>
          <entity name="Orders" persistent="true">
              <annotation name="VisualModeler">
                  <item name="x">758</item>
                  <item name="y">308</item>
                  <item name="width">115</item>
                  <item name="height">78</item>
              </annotation>
              <annotation name="LiveCycleES">
                  <item name="generate_type">true</item>
              </annotation>
              <annotation name="ServerProperties">
                  <item name="ServerType">LCDS</item>
              </annotation>
              <property name="Price" type="string"/>
              <id name="ID" type="integer" generated="false"/>
              <property name="customer" type="Customer"/>
          </entity>

       

      When I deploy this to the server I get 2 table and a foreign key from orders to customer as expected. When a get a customer from the service I can access all its orders. However, because my dataset is rather large (> 1000000 records), I would like to be able to specify a subset of the order that are put in the orders property. Something like (in sql)

       

      select c.*, o.* from customer c join orders o on (o.customer_ID = c.ID) where o.price > 1000;

       

      Is that possible?

       

      Any help is appreciated...

       

      Best regards,

      Bas

        • 1. Re: Fiber questions
          tomj Adobe Employee

          Hi Bas,

           

          No, you cannot return anything other than a collection of entities from a filter.  However, you can certainly create a Remoting destination and use mx:RemoteObject to call a function that returns this kind of data.

           

          As for limiting the number of orders that show up in a Customer entity, you can set this to be "load-on-demand", which is a feature of LCDS that will not load the associated data until it is referenced.  You can combine that with paging to limit the number of orders that are brought over the wire at any one time.

           

          Hope that helps.

          1 person found this helpful