Just wondering if having a static dozer mapper like this can leads to concurrency errors :
public static Mapper mapper = new DozerBeanMapper();
public static MyDTO toDTO(MyEntity e) {
MyDTO dto = mapper.map(e, MyDTO.class);
return dto;
}
Or should I always use this code :
public static MyDTO toDTO(MyEntity e) {
Mapper mapper = new DozerBeanMapper();
MyDTO dto = mapper.map(e, MyDTO.class);
return dto;
}
The method is used in an @Stateless session bean of a JBoss Server, it can be accessed concurrently. The fact is I dont really know if Dozer makes use of static variables or instance variables in the library to decide if I can/should use a static Mapper or create a new instance at every call.