mapping.xml
<?xml version="1.0" encoding="UTF-8"?>
<mapping>
<entry dn="ou=Sales">
<oc>organizationalUnit</oc>
<oc>top</oc>
<at name="ou" rdn="true">
<constant>Sales</constant>
</at>
</entry>
<entry dn="dc=Categories,ou=Sales">
<oc>dcObject</oc>
<oc>top</oc>
<at name="dc" rdn="true">
<constant>Categories</constant>
</at>
</entry>
<entry dn="cn=...,dc=Categories,ou=Sales">
<oc>category</oc>
<oc>top</oc>
<at name="categoryId">
<variable>categories.id</variable>
</at>
<at name="cn" rdn="true">
<variable>categories.name</variable>
</at>
<at name="description">
<variable>categories.description</variable>
</at>
<source name="categories">
<source-name>categories</source-name>
<field name="description">
<variable>description</variable>
</field>
<field name="id">
<variable>categoryId</variable>
</field>
<field name="name">
<variable>cn</variable>
</field>
</source>
</entry>
<entry dn="cn=...,cn=...,dc=Categories,ou=Sales">
<oc>product</oc>
<oc>top</oc>
<at name="categoryId">
<variable>products.categoryId</variable>
</at>
<at name="cn" rdn="true">
<variable>products.name</variable>
</at>
<at name="price">
<variable>products.price</variable>
</at>
<at name="productId">
<variable>products.id</variable>
</at>
<source name="products">
<source-name>products</source-name>
<field name="categoryId">
<variable>categoryId</variable>
</field>
<field name="id">
<variable>productId</variable>
</field>
<field name="name">
<variable>cn</variable>
</field>
<field name="price">
<variable>price</variable>
</field>
</source>
<relationship>
<expression>categories.id = products.categoryId</expression>
</relationship>
</entry>
<entry dn="dc=Customers,ou=Sales">
<oc>dcObject</oc>
<oc>top</oc>
<at name="dc" rdn="true">
<constant>Customers</constant>
</at>
</entry>
<entry dn="cn=...,dc=Customers,ou=Sales">
<oc>customer</oc>
<oc>top</oc>
<at name="cn" rdn="true">
<variable>customer_emails.email</variable>
</at>
<at name="customerId">
<variable>customer_emails.username</variable>
</at>
<at name="email">
<variable>customer_emails.email</variable>
</at>
<source name="customer_emails">
<source-name>customer_emails</source-name>
<field name="email">
<variable>email</variable>
</field>
<field name="username">
<variable>customerId</variable>
</field>
</source>
</entry>
<entry dn="orderId=...,cn=...,dc=Customers,ou=Sales">
<oc>order</oc>
<oc>top</oc>
<at name="customerId">
<variable>orders.username</variable>
</at>
<at name="date">
<variable>orders.orderDate</variable>
</at>
<at name="orderId" rdn="true">
<variable>orders.id</variable>
</at>
<source name="orders">
<source-name>orders</source-name>
<field name="id">
<variable>orderId</variable>
</field>
<field name="orderDate">
<variable>date</variable>
</field>
<field name="username">
<variable>customerId</variable>
</field>
</source>
<relationship>
<expression>customer_emails.username = orders.username</expression>
</relationship>
</entry>
<entry dn="cn=...,orderId=...,cn=...,dc=Customers,ou=Sales">
<oc>orderDetail</oc>
<oc>product</oc>
<oc>top</oc>
<at name="categoryId">
<variable>products.categoryId</variable>
</at>
<at name="cn" rdn="true">
<variable>products.name</variable>
</at>
<at name="description">
<variable>order_details.quantity</variable>
</at>
<at name="orderId">
<variable>order_details.orderId</variable>
</at>
<at name="price">
<variable>products.price</variable>
</at>
<at name="productId">
<variable>products.id</variable>
</at>
<source name="order_details">
<source-name>order_details</source-name>
<field name="orderId">
<variable>orderId</variable>
</field>
<field name="quantity">
<variable>description</variable>
</field>
</source>
<source name="products">
<source-name>products</source-name>
<field name="categoryId">
<variable>categoryId</variable>
</field>
<field name="id">
<variable>productId</variable>
</field>
<field name="name">
<variable>cn</variable>
</field>
<field name="price">
<variable>price</variable>
</field>
</source>
<relationship>
<expression>order_details.orderId = orders.id</expression>
</relationship>
<relationship>
<expression>order_details.productId = products.id</expression>
</relationship>
</entry>
</mapping>