[[metamodel]]
= A MetaModel

: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.
:page-partial:


At its core, Apache Causeway is a metamodel that is built at runtime from the domain classes (eg `Customer.java`), along with optional supporting metadata (eg `Customer.layout.xml`).

The contents of this metamodel are the entities and supporting services, as well the members of those classes.
These are all meta-annotated with link:https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/stereotype/Component.html[@Component] and are either registered explicitly (framework services) or dynamically discovered (entities and user-defined services) by Spring Boot on the classpath via link:https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/context/annotation/ComponentScan.html[@ComponentScan].

The detail of the metamodel is generally explicit, usually represented by Java annotations such as `@Title` or `@Action`, though this is configurable.
Notably the metamodel is xref:userguide:btb:programming-model.adoc[extensible]; it is possible to teach Apache Causeway new programming conventions/rules (and conversely to remove those that are built in).

Most of the annotations recognized by the framework are defined by the Apache Causeway framework itself.
For example the `@Title` annotation -- which identifies how the framework should derive a human-readable label for each rendered domain object -- is part of the `org.apache.causeway.applib.annotations` package.
However the framework also recognizes certain other JEE annotations such as `@javax.inject.Inject` (used for dependency injection).

The framework integrates an ORM for persistence, specifically DataNucleus and the JDO API and since version 2.0.0, JPA (Eclipselink) is supported as well.
Both JDO and JPA can map to both relational databases and also to various NoSQL objectstores such as MongoDB or Neo4J.
Apache Causeway recognizes a number of these persistence-specific annotations, for example `@javax.jdo.annotations.Column(allowsNull=...)`.

In addition, the framework builds up the metamodel for each domain object using xref:userguide:fun:ui.adoc#object-layout[layout hints], such as `Customer.layout.xml`.
These provide metadata such as grouping elements of the UI together, using multi-column layouts, and so on.
The layout file can be modified while the application is still running, and are picked up automatically; a useful way to speed up feedback.



