= Enhancer (DataNucleus)

:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


A responsibility of all ORMs is lazy loading of related objects (so as not to load all the data in one go), and tracking of objects as they are modified (to flush back to the database).

With JDO, this is accomplished by post-processing -- or _enhancing_ -- the compiled bytecode.

This is typically performed using the `datanucleus:enhance` Maven plugin.
This is defined as the `causeway-app-starter-datanucleusenhance` profile in the xref:docs:parent-pom:about.adoc[Parent POM], and is activated by the presence of the `logging-dn-enhance.properties` file.

[source,xml]
.App Starter Parent POM (pom.xml)
----
<profile>
  <id>causeway-app-starter-datanucleusenhance</id>
  <activation>
    <file>
	  <exists>${basedir}/logging-dn-enhance.properties</exists>
    </file>
  </activation>
  <build>
    <plugins>
      <plugin>
        <groupId>org.datanucleus</groupId>
        <artifactId>datanucleus-maven-plugin</artifactId>
        ..
      </plugin>
    </plugins>
  </build>
<profile>
----

Some IDEs (notably Eclipse) provide plugins to run the enhancer as part of their compile process.
See xref:setupguide:ROOT:about.adoc[setup guides] for more details.
