[
https://issues.apache.org/jira/browse/UNOMI-925?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Serge Huber reassigned UNOMI-925:
---------------------------------
Assignee: Serge Huber
> getPersonaSessions and related REST API doesn't work properly.
> --------------------------------------------------------------
>
> Key: UNOMI-925
> URL: https://issues.apache.org/jira/browse/UNOMI-925
> Project: Apache Unomi
> Issue Type: Bug
> Components: unomi(-core)
> Affects Versions: unomi-3.0.0, unomi-2.7.0
> Reporter: Serge Huber
> Assignee: Serge Huber
> Priority: Major
> Fix For: unomi-3.1.0
>
>
> h2. Problem
> The {{getPersonaSessions}} method attempts to retrieve {{Session}} objects
> instead of {{PersonaSession}} objects when querying the persistence layer.
> This causes the method to fail to find persona sessions, even though they
> exist and are properly linked to the persona.
> h2. Root Cause
> The {{getPersonaSessions}} method implementation queries the persistence
> service using the wrong class type. It should query for
> {{PersonaSession.class}} but was incorrectly using {{Session.class}} (or a
> similar type mismatch). This type mismatch prevents the persistence query
> from locating the persona sessions, even though:
> * Sessions are properly linked to personas (the linkage mechanism works
> correctly)
> * Sessions are successfully saved via {{savePersonaWithSessions}}
> * The {{loadPersonaWithSessions}} method works correctly because it properly
> uses {{PersonaSession.class}}
> h2. Symptoms
> * The {{getPersonaSessions}} method returns empty results or fails to find
> persona sessions
> * The {{GET /cxs/profiles/personas/\{personaId\}/sessions}} REST endpoint
> returns empty results
> * Sessions exist in the persistence layer and are properly linked to
> personas, but cannot be retrieved via this method
> * The {{loadPersonaWithSessions}} method works correctly and can retrieve the
> same sessions
> h2. Impact
> * The {{getPersonaSessions}} method and its associated REST endpoint are
> non-functional
> * Users cannot retrieve persona sessions using the standard retrieval method
> * Workarounds require using {{loadPersonaWithSessions}} instead, which
> returns the full {{PersonaWithSessions}} object rather than just the sessions
> list
> h2. Steps to Reproduce
> # Create a persona with sessions using {{POST
> /cxs/profiles/personasWithSessions}}
> # Verify sessions are saved and linked (can be confirmed via
> {{loadPersonaWithSessions}})
> # Attempt to retrieve sessions using {{GET
> /cxs/profiles/personas/\{personaId\}/sessions}}
> # Observe that the endpoint returns empty results despite sessions existing
> # Compare with {{GET /cxs/profiles/personasWithSessions/\{personaId\}}} which
> correctly returns sessions
> h2. Expected Behavior
> The {{getPersonaSessions}} method should query the persistence layer using
> {{PersonaSession.class}} to correctly retrieve persona sessions, matching the
> behavior of {{loadPersonaWithSessions}}.
> h2. Affected Components
> * {{ProfileService.getPersonaSessions()}} - Incorrect class type used in
> persistence query
> * REST endpoint: {{GET /cxs/profiles/personas/\{personaId\}/sessions}} -
> Returns empty results due to underlying method issue
> h2. Working Methods (for comparison)
> * {{ProfileService.loadPersonaWithSessions()}} - Correctly uses
> {{PersonaSession.class}} and works as expected
> * REST endpoint: {{GET /cxs/profiles/personasWithSessions/\{personaId\}}} -
> Works correctly
> h2. Technical Details
> The persistence query should use:
> {code:java}
> persistenceService.query("profileId", personaId, sortBy,
> PersonaSession.class, offset, size)
> {code}
> But was incorrectly using {{Session.class}} (or similar incorrect type),
> causing the query to look in the wrong collection/type and fail to find the
> persona sessions.
> h2. Compatibility
> No compatibility concerns. This method/endpoint was not in use, as evidenced
> by the fact that no issues were reported prior to this fix. If it had been
> used, users would have encountered the problem and reported it.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)