Bug 316 : Cascade save on an inheritance hierarchy fails.
Priority 
High
Reported Version 
 
Logged By 
Marco Vittorini Orgeas
Status 
Fixed
Fixed Version 
2.7.0
Assigned To 
 
Product 
Ebean - core
Duplicate Of 
 
Created 
03/08/2010
Updated 
03/08/2010
Type 
Bug
 
Attachments 
No attachments

If a @onetomany(cascade = cascadetype.ALL) in class "A" refers to a superclass(abstract or not) of an inheritance hierarchy (class "B") and this superclass have not the relative @manytoone property - in order to map a strong relation from A to B as also described in the ebean manual on page 52) Ebean FAILS to insert the relative "A" foreign keys when it tries to save the B instances( Ebean.save(someAinstance); )

The expected result should be a successful cascade save operation seen that the annotation presents a cascadetype.ALL attribute.

Please note that the expected behaviour is present if instead of a superclass, the @onetomany point to a "normal" class (i.e. either not a superclass or a subclass of some class).

Ebean should provide the expected behaviour and cascade persist all the referenced instances regardless of their nature. (i.e. it should always insert the right foreign keys).

 
Rob 30 Aug 09:45
Yes, I have reproduced

Thanks for the testcase.

The issue here is that this is a unidirectional relationship ... and Ebean is not going up the inheritance hierarchy to get the appropriate 'unidirectional shadow property'.

Rob 30 Aug 09:46
Fixed in HEAD

Fixed in HEAD.

woResponse

Upload a file