Hi,
I have a class named Structure with a one-to-many association to another
class named Column. The Structure class has a property named column who is a
collection of Column. I manage this with Hibernate and my own Dao, so I use
my self coded StructureAsssembler and ColumnAssembler to access them with
the data manager of Flex.
In my data-management-config.xml file, I have this :
<destination
id="net.cpaerp.structure.application.business.entity.Structure">
<adapter ref="java-dao" />
<properties>
<use-transactions>true</use-transactions>
<cache-items>false</cache-items>
<auto-sync-enabled>true</auto-sync-enabled>
<source>net.cpaerp.structure.application.business.entity.assembler.Structure
Assembler</source>
<scope>session</scope>
<metadata>
<identity property="id"/>
<one-to-many property="column"
destination="net.cpaerp.structure.application.business.entity.Column"
lazy="true" sequenced="false"/>
</metadata>
<network>
<session-timeout>20</session-timeout>
<paging enabled="true" pageSize="10" />
<throttle-inbound policy="ERROR" max-frequency="500"/>
<throttle-outbound policy="REPLACE" max-frequency="500"/>
</network>
<server>
</server>
</properties>
</destination>
<destination
id="net.cpaerp.structure.application.business.entity.Column">
<adapter ref="java-dao" />
<properties>
<use-transactions>true</use-transactions>
<cache-items>false</cache-items>
<auto-sync-enabled>false</auto-sync-enabled>
<source>net.cpaerp.structure.application.business.entity.assembler.ColumnAss
embler</source>
<scope>session</scope>
<metadata>
<identity property="id"/>
<many-to-one property="structure"
destination="net.cpaerp.structure.application.business.entity.Structure"
lazy="true"/>
</metadata>
<network>
<session-timeout>20</session-timeout>
<paging enabled="true" pageSize="10" />
<throttle-inbound policy="ERROR" max-frequency="500"/>
<throttle-outbound policy="REPLACE" max-frequency="500"/>
</network>
<server>
</server>
</properties>
</destination>
As you see, my relations are < lazy >, and in some way, it works. but not
really. When I fill an AS ArrayCollection of Structure objects with the fill
method of my assembler, it return a collection of Structure, but a
SequenceManager always extract every ids of the column collection associated
with every structure extracted, before returning the collection to the
client. This makes hibernate to extract the columns from the database
without being needed. I don't think that this is really lazy.
What is a sequence manager by the way. ?
Emmanuel