You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by "Daniel Keir Haywood (Jira)" <ji...@apache.org> on 2021/05/30 06:24:00 UTC
[jira] [Resolved] (ISIS-2706) JPA does not persist entities with
application-defined primary keys
[ https://issues.apache.org/jira/browse/ISIS-2706?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Daniel Keir Haywood resolved ISIS-2706.
---------------------------------------
Resolution: Fixed
> JPA does not persist entities with application-defined primary keys
> -------------------------------------------------------------------
>
> Key: ISIS-2706
> URL: https://issues.apache.org/jira/browse/ISIS-2706
> Project: Isis
> Issue Type: Bug
> Components: Isis Persistence JPA
> Affects Versions: 2.0.0-M5
> Reporter: Daniel Keir Haywood
> Assignee: Andi Huber
> Priority: Major
> Fix For: 2.0.0-M6
>
> Attachments: image-2021-05-28-06-20-20-489.png, image-2021-05-28-06-31-55-731.png
>
>
> For example, secman's ApplicationTenancy cannot be persisted as currently implemented.
> Reason (perhaps): there is logic in ManagedObjects.EntityUtil.getState() to infer the entity state of the object, and for such entities it returns the state as PERSISTABLE_DESTROYED rather than DETACHED, meaning that flush transaction is never called.
> To reproduce, simply attempt to create a new ApplicationTenancy.
>
> HERE'S THE CODE THAT SHOWS the entity is not reported as detached,so the transaction never flushed:
> !image-2021-05-28-06-20-20-489.png|width=783,height=627!
>
> THE FIX MIGHT BE TO SIMPLY REMOVE THE HIGHLIGHTED, WHICH PERHAPS IS A PERFORMANCE OPTIMISATION? (or, it is only safe to do if the @Id also has @GeneratedValue, which application-defined primary keys do not, of course.
>
> !image-2021-05-28-06-31-55-731.png|width=645,height=374!
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)