vadbch / orika

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

Orika converting entity class to HashMap when fetch entity fetched from DB. #183

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. I just simply fetched entity from the database(Spring Data and Neo4J).

What is the expected output? What do you see instead?
I am expecting a Entity but getting hashmap instead.

What version of the product are you using? On what operating system?
Orika 1.4.5 on Windows 8.1, Java 8, Spring 4, Spring Data(ORM) and Neo4j(DB)

Please provide any additional information below.
I am using custom converter. I am able to convert UserDTO to User but when I am 
fetching the entity by ID its throwing class cast exception. Full Stack trace: 

[code]
SEVERE: Servlet.service() for servlet [dispatcher] in context with path 
[/spring4neo] threw exception [Request processing failed; nested exception is 
java.lang.ClassCastException: java.util.HashMap cannot be cast to 
net.paxcel.entities.User] with root cause
java.lang.ClassCastException: java.util.HashMap cannot be cast to 
net.paxcel.entities.User
    at net.paxcel.converters.UserDtoToUserConvertor.convert(UserDtoToUserConvertor.java:33)
    at net.paxcel.converters.UserDtoToUserConvertor.convert(UserDtoToUserConvertor.java:1)
    at ma.glasnost.orika.generated.Orika_Post_PostDto_Mapper494794926963038$0.mapAtoB(Orika_Post_PostDto_Mapper494794926963038$0.java)
    at ma.glasnost.orika.impl.mapping.strategy.UseCustomMapperStrategy.map(UseCustomMapperStrategy.java:67)
    at ma.glasnost.orika.impl.MapperFacadeImpl.map(MapperFacadeImpl.java:735)
    at ma.glasnost.orika.impl.MapperFacadeImpl.map(MapperFacadeImpl.java:714)
    at net.paxcel.converters.orika.MyConfigurableMapper.map(MyConfigurableMapper.java:85)
    at net.paxcel.converters.PostConvertor.toEntity(PostConvertor.java:55)
    at net.paxcel.service.impl.PostServiceImpl.save(PostServiceImpl.java:36)
[/code]

Original issue reported on code.google.com by nikhil.m...@gmail.com on 21 Nov 2014 at 3:34

GoogleCodeExporter commented 8 years ago
Can you please add Unit test ?

Original comment by elaat...@gmail.com on 20 Dec 2014 at 5:37