All entities marked as [Managed] are considered as corresponding to Hibernate/JPA managed entities on the server
It is highly recommended to use JPA optimistic locking in a multi-tier environment (@Version annotation
In conclusion, the 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
Here all loaded collections of the Person object will be uninitialized so uperson contains only the minimum of data
to correctly merge your changes in the server persistence context
Tide uses the client data tracking (the same used for dirty checking, see below) to determine which parts of the graph
need to be sent.
Dirty Checking and Conflict Handling
Data Validation
Tide integrates with Hibernate Validator 3.x and the Bean Validation API (JSR 303) implementations, and propagate the server validation errors to the client
UI components
In JEE managed mode, such as an EntityManager injected into a SessionBean, the EntityManager reference, represents a new persistence context for each transaction. This means objects read in one transaction become detached after the end of the transaction, and should no longer be used, or need to be merged into the next transaction. In managed mode, you never create or close an EntityManager.
Transactions
operations that are committed or rolled back as a single unit
JPA provides two mechanisms for transactions
JTA (Java Transaction API
EntityTransaction
all changes made to all persistent objects in the persistence context are part of the transaction.
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
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