If you are trying to persist an Entity that has a relationship to an
(readonly) Entity that already exists in your DB, you should ensure that
the existing Entity is a part of your persistence context (ie managed).
OpenJPA is most likely complaining because we encountered an unmanaged
field when persisting your non readonly Entity to the DB.

So :

ReadOnlyEntity e = em.find(...); // I assume this is different than what
you are currently doing.
NewEntity ne = new NewEntity();
ne.setRelationship(e);

em.persist(e);

Thanks,
Rick


On Tue, Mar 11, 2014 at 11:26 AM, Alice <ashanai...@yahoo.com> wrote:

> Hello,
>
> We are running into issues with saving entities with fields that reference
> read only data. If the entity has a field mapped with 'insertable = false'
> and/or 'updatable = false' for @Column or @JoinColumn,
> OpenJPA still tries to do an insert into the read only entity. It also
> complains that
> CascadeType.PERSIST has not been specified on the relationship.
>
> Is there a way to fix this issue?
>
>
>
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/Issue-saving-entities-with-fields-that-reference-read-only-data-tp7586076.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>



-- 
*Rick Curtis*

Reply via email to