Two classes:
- MyEntity( id:int, uid:UUID, name:string)
- MyDomainEntity( id:UUID, name:string)
Map MyEntity to MyDomainEntity:
- (id >> null)
- uid >> id
- name >> name
Map MyDomainEntity to MyEntity
- (null >> id)
- id >> uid
- name >> name
How can this be done with dozer.
I get the following error:
org.apache.commons.beanutils.ConversionException: Error converting from 'UUID' to 'Integer' For input string: "7cc80b09-6e15-471f-900d-a5885832fe1d"
... with that configuration:
<?xml version="1.0" encoding="UTF-8"?>
<mappings xmlns="http://dozer.sourceforge.net"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://dozer.sourceforge.net
http://dozer.sourceforge.net/schema/beanmapping.xsd">
<configuration>
<stop-on-errors>true</stop-on-errors>
<date-format>MM/dd/yyyy HH:mm</date-format>
<wildcard>true</wildcard>
</configuration>
<mapping type="one-way">
<class-a>com.pmc.maventest2.dal.MyEntity</class-a>
<class-b>com.pmc.maventest2.dal.MyDomainEntity</class-b>
<field copy-by-reference="true">
<a>Uid</a>
<b>Id</b>
</field>
</mapping>
<mapping type="one-way">
<class-a>com.pmc.maventest2.dal.MyDomainEntity</class-a>
<class-b>com.pmc.maventest2.dal.MyEntity</class-b>
<field copy-by-reference="true">
<a>Id</a>
<b>UId</b>
</field>
</mapping>
</mappings>