Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] New values on a @OneToMany attribute gets persisted even no cascading is specified

Hi Andreas,

  I am surprised you see the attendees cascaded without the cascade setting.   What does your test case do exactly?  What other mappings are there in CalendarEntry?  Do any of them potentially reference CalendarAttendee either directly or through other objects?

-Tom

On 19/08/2013 8:56 PM, Andreas Joseph Krogh wrote:
I have this mapping in CalendarEntry:
 
@OneToMany(fetch = FetchType.LAZY, mappedBy = "activityForOwner")
var attendees: JUList[CalendarAttendee] = new JUArrayList[CalendarAttendee]()
With no "cascade". The other end looks like this:
 
@ManyToOne(fetch = FetchType.LAZY, optional = false)
@JoinColumn(name = "activity_id")
@net.sf.oval.constraint.NotNull
var activityForOwner: CalendarEntry = null
 
When I persist (both insert and update) the CalendarEntry, new values in "attendees" are persisted also. I find this surprising because I have no cascade-attribute on the relationship. Comming from Hibernate this makes no sense. I want the attendees-attribute to be treated read-only.
 
Is this correct behaviour?
 
Thanks.
 
--
Andreas Joseph Krogh <andreak@xxxxxxxxxxxx>      mob: +47 909 56 963
Senior Software Developer / CTO - OfficeNet AS - http://www.officenet.no
Public key: http://home.officenet.no/~andreak/public_key.asc


_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top