3

i have the following dozer mapping:

com.company.xx.xx.model.MyClass com.company.xx.xx.model.MyClassToMap

afield afield

customer customer

I load MyClass with with hibernate. But i have a lazy loading for customer. i dont load everything from customer. But the mapping wants to map all attributes from customer, so that a lazy initilization exception is thrown.

How can i tell dozer only to map customer and not all of the fields from customer?

Benjamin
  • 273
  • 2
  • 6
  • 9
  • What I understand from your post is you are lazily loading Customer from MyClass and you want only some attributes from the Customer class? – Prasanna Mar 11 '11 at 16:57

2 Answers2

2

You will need to write a custom converter to assign null to uninitialized collections. When you implement the custom converter make use of Hibernate.isInitialized check and set collections to null where it is not necessary.

The link http://dozer.sourceforge.net/documentation/customconverter.html gives an idea about custom converters.

Vinod R
  • 1,218
  • 10
  • 13
0

You can set <mapping wildcard="false"> to have Dozer only map specified fields on a particular class

artbristol
  • 32,010
  • 5
  • 70
  • 103