Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@Mapping("user.id") problem #30

Closed
ghost opened this issue Nov 30, 2012 · 14 comments
Closed

@Mapping("user.id") problem #30

ghost opened this issue Nov 30, 2012 · 14 comments

Comments

@ghost
Copy link

ghost commented Nov 30, 2012

I using Dozer in my project with xml mapping but i want to used annotation and remove xml file
this example show bug in annotation mapping
after mapping to destination bean ,type of variable is changed from Integer to String

for example

public class User {
       private Integer id; 
}

public class UserBean {
       @Mapping("user.id")
       private Integer userId; 
}
userBean.getUserId()//is not Integer it is String

I think one of the dozer disadvantage is in annotation
annotation is very simple and changeable

@buzdin
Copy link
Member

buzdin commented Jan 17, 2013

Note for myself: check the status with deep mapping in annotations. Support more use-cases with annotations like @exclude.

@rweng
Copy link

rweng commented Jul 31, 2015

+1

@ghost
Copy link
Author

ghost commented Aug 6, 2017

+100 plz add this to next release

@garethahealy
Copy link
Collaborator

@azizkhani can you please provide more info. I don't understand your original comment.

@ghost
Copy link
Author

ghost commented Aug 6, 2017

@garethahealy when map object using annotation ,type of property that create in proxy object is not integer

@garethahealy
Copy link
Collaborator

@azizkhani ; can you please create a github repo, with a unit test showing the behaviour / failure please. It will make it easier to investigate.

@ghost
Copy link
Author

ghost commented Aug 7, 2017

@garethahealy i create project that show that bug https://github.com/azizkhani/dozer/tree/master/test

@ghost
Copy link
Author

ghost commented Aug 8, 2017

@garethahealy did you check the bug?

@ghost
Copy link
Author

ghost commented Aug 13, 2017

+100

@garethahealy
Copy link
Collaborator

garethahealy commented Sep 6, 2017

After some quick debugging, it seems the below:

Is returning id as type Object, due to generics, which then cascades down to:

Which then causes the primitiveconverter, to convert to a string:

As a quick change (if its possible), changing to: BaseEntity< Integer > stops the error.

The root problem is due to Java generics type erasure, the code cant resolve the type.

We'd need to use something like classmate to get the correct type back, which isn't a small change.

https://github.com/FasterXML/java-classmate

@garethahealy
Copy link
Collaborator

CC @orange-buffalo @buzdin

@azizkhani
Copy link

+100

@azizkhani
Copy link

why dozer team dose not solve this bug?
I had to use xml instead of annotation because this bug dose not resolve yet?
please

@garethahealy
Copy link
Collaborator

@azizkhani ; the "dozer team" is currently me. i am not paid by anyone to work on this project, i do it in my own spare time. why dont you help, and work on the issue? like i said in the comment. this is not a simple change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants