atos1990 / orika

Automatically exported from code.google.com/p/orika
0 stars 0 forks source link

The mapper create a child's instance instead of a parent's instance. #34

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Make inheritance child from parent.
2. Get a child bean from the MapperFacade.
3. Get a parent bean from the MapperFacade

What is the expected output? What do you see instead?
Parent's instance is expected. I see child's instance instead.

What version of the product are you using? On what operating system?
Orika 1.1.8

Please provide any additional information below.
see attached test

Original issue reported on code.google.com by dkhomya...@gmail.com on 20 Jul 2012 at 6:43

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by matt.deb...@gmail.com on 4 Aug 2012 at 9:14

GoogleCodeExporter commented 9 years ago
This seems to happen because Orika favors the use of an existing mapper (which 
satisfies the inputs) over generating a new one.

So since the Entity<=>Child mapping happened first (and created a mapping), 
this one is found when Entity<=>Parent is passed in.

Perhaps Orika should not consider auto-generated mappings when making this 
decision...

Anyway, in the 1.2.0-branch, I find that the desired behavior can be achieved 
by adding an explicit mapping for Entity<=>Parent. 

Original comment by matt.deb...@gmail.com on 4 Aug 2012 at 4:36

GoogleCodeExporter commented 9 years ago
Unfortunally, an explicit mapping isn't suitable for me.

Original comment by dkhomya...@gmail.com on 8 Aug 2012 at 8:15

GoogleCodeExporter commented 9 years ago
A fix has been applied in the 1.2.0 branch; please check and confirm if you get 
a chance...

Original comment by matt.deb...@gmail.com on 17 Aug 2012 at 10:53

GoogleCodeExporter commented 9 years ago
I've tested 1.2.0-branch. All right. Thanks.

Original comment by dkhomya...@gmail.com on 20 Aug 2012 at 1:01