Details
-
Feature Request
-
Resolution: Unresolved
-
Major
-
None
-
16.0.0.Final
-
None
Description
Since SESSION granularity requires the replication of all session attribute if any attribute was modified in a given request, most distributed web applications should leverage ATTRIBUTE granularity whenever to possible to reduce the replication payload costs per request.
However, if session attribute contains any reference to another session attribute, they are forced to use SESSION granularity to avoid losing referential integrity on failover and duplication of serialized data.
The proposal is to allow users the ability to annotate their session attribute classes such that they can group specific attribute together, while still being able to leverage ATTRIBUTE granularity for the remainder of their session attributes.
From the user's perspective, I envision something like this:
@SessionAttributeGroup("order") public class Order implements Serializable { List<OrderItem> items; } @SessionAttributeGroup("order") public class OrderItem implements Serializable { //... }
Thus the code:
session.setAttribute("order", order); session.setAttribute("customized-item", item);
will result in both attributes being store within a single cache entry.
Internally, we use the @SessionAttributeGroup as the attribute name, and a Map<String, Object> as the attribute value, keyed by the actual attribute name.