just don't hard-code this eager loading behavior by using jpa's FetchType.EAGER when annotating the entity beans
if you do, you force all clients of said entity beans to *always* eager fetch everything, even if the client doesn't want/need the full depth/breadth of the object graph
to eager load the relations when needed, try fetch joins (see item 5)
When updating existing entities coming from the database
id is defined and is maintained
in the three layers during the different serialization/persistence operations
when a new entity is being created in any of the two upper layers (Flex/JPA)
new entity has no id until it has been persisted to the database
most common solution is to
have a second persisted id, the uid
which is created by the client and persisted along with the entity
recommended approach to avoid any kind of subtle problems is to have a real uid property which will be persisted
in the database but is not a primary key for efficiency concerns
You can now ask Tide to
limit the object graph before sending it
Flex with the following API :
EntityGraphUnintializer
uninitializeEntityGraph
Person object will be uninitialized
uperson contains
only the minimum of data
to correctly merge your changes in the server persistence context
Tide uses the
client data tracking
to determine which parts of the graph
need to be sent
Calling the EntityGraphUninitializer manually is a bit tedious and ugly, so there is a cleaner possibility when you are using
generated typesafe service proxies
annotate your service method arguments with @org.granite.tide.data.Lazy :
@Lazy
take care that you have added the [Lazy] annotation to your Flex
metadata compilation configuration
in the Flex application, register the UninitializeArgumentPreprocessor component in Tide as follows :
[UninitializeArgumentPreprocessor]
all calls to PersonService.save() will
automatically use a properly uninitialized version
of the person
argument.
15.4. Dirty Checking and Conflict Handling
simplify the handling of data between Flex and Java EE
Chapter 15. Data Management
Tide maintains a client-side cache of entity instances and ensures that every instance is unique in the Flex client context
uid().hashCode();
Tide currently only supports Integer or Long version fields, not timestamps and that the field must be nullable
Java NIO high-performance messaging (thousands of clients per CPU)
No
Yes
Real Time Messaging Protocol (RTMP)
No
Yes
Data throttling
No
Yes
Reliable communications
Code Engineering
Database Engineering
Debug & Visualize Applications
MDG Technologies (Create & Use)*
Model Driven Architecture (MDA)
Project Discussion Forum
Replicate .EAP Projects
Reverse Engineer Binaries (Java, .NET)
Shared Models
WSDL Engineering
XML Schema (XSD) Engineering
Audit Model Changes
Baseline Diff/Merge
DBMS Repository**
Floating Edition Available
Lazy Load
Scripting with JScript, VBScript and Javascript
Security (Role-based)
WAN Optimizer
BPEL Generation from BPMN diagrams
Business Rules Composer
Executable Code Generation from Behavioral Models
Math Support built into Script Engines