OK, this is pretty obscure, but it's because you've capitalized
"Description".  Change it to:

    @Column(allowsNull = "false")
    @Property
    @Getter @Setter
    private String description;

Also, there's no need for @Property in this case... you haven't specified
any additional semantics.

Why is this the fix?

The @Column is a JDO annotaiton, @Property is an Isis annotation.

JDO and Isis have different rules, unfortunately, for whether a
property/field should be treated as optional or not.  For JDO, primitives
are treated as mandatory, everything else as optional.  For Isis, it treats
everything as mandatory.

The metamodel validation error is attempting to warn that there's an
incompatibility here.  In Isis a property is really identified by the
getter method (in this case autogenerated by Lombok).  In order to support
the use of Lombok, the framework looks for annotations both on the getter
method and also on any backing instance field.  However, it infers the
backing field from the getter ... so getDescription() is expected to be
backed by "description", not "Description".

Hope that makes sense.  Raise a ticket in JIRA if you can think of a better
way for us to handle this....

Dan


On Tue, 14 Feb 2017 at 14:10 L Eder <eder200...@gmail.com> wrote:

> The intact template-generated source code was:
>
> Component.java:
> "
> package domainapp.dom.PPB;
>
> import javax.jdo.annotations.Column;
> import javax.jdo.annotations.DatastoreIdentity;
> import javax.jdo.annotations.IdGeneratorStrategy;
> import javax.jdo.annotations.IdentityType;
> import javax.jdo.annotations.PersistenceCapable;
> import javax.jdo.annotations.Queries;
> import javax.jdo.annotations.Query;
> import javax.jdo.annotations.Unique;
> import javax.jdo.annotations.Version;
> import javax.jdo.annotations.VersionStrategy;
>
> import org.apache.isis.applib.annotation.BookmarkPolicy;
> import org.apache.isis.applib.annotation.DomainObject;
> import org.apache.isis.applib.annotation.DomainObjectLayout;
> import org.apache.isis.applib.annotation.Editing;
> import org.apache.isis.applib.annotation.Property;
>
> import lombok.Getter;
> import lombok.Setter;
>
> @PersistenceCapable(
>         identityType = IdentityType.DATASTORE,
>         schema = "PPB",
>         table = "Component"
> )
> @DatastoreIdentity(
>         strategy = IdGeneratorStrategy.IDENTITY,
>         column = "id")
> @Version(
>         strategy = VersionStrategy.VERSION_NUMBER,
>         column = "version")
> @Queries({
>         @Query(
>                 name = "find", language = "JDOQL",
>                 value = "SELECT "
>                         + "FROM domainapp.dom.PPB.Component "),
>         @Query(
>                 name = "findByDescriptionContains", language = "JDOQL",
>                 value = "SELECT "
>                         + "FROM domainapp.dom.PPB.Component "
>                         + "WHERE Description.indexOf(:Description) >= 0 "),
>         @Query(
>                 name = "findByDescription", language = "JDOQL",
>                 value = "SELECT "
>                         + "FROM domainapp.dom.PPB.Component "
>                         + "WHERE Description == :Description ")
> })
> @Unique(name = "Component_Description_UNQ", members = { "Description" })
> @DomainObject(
>         editing = Editing.DISABLED
> )
> @DomainObjectLayout(
>         bookmarking = BookmarkPolicy.AS_ROOT
> )
> public class Component implements Comparable<Component> {
>
>     @Column(allowsNull = "false")
>     @Property()
>     @Getter @Setter
>     private String Description;
>
>     //region > compareTo, toString
>     @Override
>     public int compareTo(final Component other) {
>         return org.apache.isis.applib.util.ObjectContracts.compare(this,
> other, "Description");
>     }
>
>     @Override
>     public String toString() {
>         return org.apache.isis.applib.util.ObjectContracts.toString(this,
> "Description");
>     }
>     //endregion
>
> }
> "
>
> ComponentMenu.java:
> "
> package domainapp.dom.PPB;
>
> import org.apache.isis.applib.annotation.Action;
> import org.apache.isis.applib.annotation.ActionLayout;
> import org.apache.isis.applib.annotation.BookmarkPolicy;
> import org.apache.isis.applib.annotation.DomainService;
> import org.apache.isis.applib.annotation.DomainServiceLayout;
> import org.apache.isis.applib.annotation.MemberOrder;
> import org.apache.isis.applib.annotation.NatureOfService;
> import org.apache.isis.applib.annotation.RestrictTo;
> import org.apache.isis.applib.annotation.SemanticsOf;
>
> @DomainService(
>         nature = NatureOfService.VIEW_MENU_ONLY
> )
> @DomainServiceLayout(
>         named = "Components",
>         menuOrder = "210"
> )
> public class ComponentMenu {
>
>     @Action(
>             semantics = SemanticsOf.SAFE,
>             restrictTo = RestrictTo.PROTOTYPING
>     )
>     @ActionLayout(
>             bookmarking = BookmarkPolicy.AS_ROOT
>     )
>     @MemberOrder(sequence = "1")
>     public java.util.List<Component> listAll() {
>         return componentrepository.listAll();
>     }
>
>     @Action(
>             semantics = SemanticsOf.SAFE
>     )
>     @ActionLayout(
>             bookmarking = BookmarkPolicy.AS_ROOT
>     )
>     @MemberOrder(sequence = "2")
>     public java.util.List<Component> findByDescription(
>             final String Description
>     ) {
>         return componentrepository.findByDescriptionContains(Description);
>     }
>
>     @Action(
>     )
>     @MemberOrder(sequence = "3")
>     public Component create(
>             final String Description) {
>         return componentrepository.create(Description);
>     }
>
>     @javax.inject.Inject
>     ComponentRepository componentrepository;
> }
> "
>
> ComponentRepository.java:
> "
> package domainapp.dom.PPB;
>
> import org.apache.isis.applib.annotation.DomainService;
> import org.apache.isis.applib.annotation.NatureOfService;
> import org.apache.isis.applib.annotation.Programmatic;
>
> @DomainService(
>         nature = NatureOfService.DOMAIN,
>         repositoryFor = Component.class
> )
> public class ComponentRepository {
>
>     @Programmatic
>     public java.util.List<Component> listAll() {
>         return container.allInstances(Component.class);
>     }
>
>     @Programmatic
>     public Component findByDescription(
>             final String Description
>     ) {
>         return container.uniqueMatch(
>                 new org.apache.isis.applib.query.QueryDefault<>(
>                         Component.class,
>                         "findByDescription",
>                         "Description", Description));
>     }
>
>     @Programmatic
>     public java.util.List<Component> findByDescriptionContains(
>             final String Description
>     ) {
>         return container.allMatches(
>                 new org.apache.isis.applib.query.QueryDefault<>(
>                         Component.class,
>                         "findByDescriptionContains",
>                         "Description", Description));
>     }
>
>     @Programmatic
>     public Component create(final String Description) {
>         final Component component =
> container.newTransientInstance(Component.class);
>         component.setDescription(Description);
>         container.persistIfNotAlready(component);
>         return component;
>     }
>
>     @Programmatic
>     public Component findOrCreate(
>             final String Description
>     ) {
>         Component component = findByDescription(Description);
>         if (component == null) {
>             component = create(Description);
>         }
>         return component;
>     }
>
>     @javax.inject.Inject
>     org.apache.isis.applib.DomainObjectContainer container;
> }
> "
>
>
> ---------- Forwarded message ----------
> From: L Eder <eder200...@gmail.com>
> Date: Tue, 14 Feb 2017 10:00:48 -0400
> Subject: Error "The application failed to start due to a number of
> metamodel validation errors..."
> To: users@isis.apache.org
>
> Hello isis users:
>
> I tried to create my first domain object, called Component, using the
> file templates.
>
> I created a package under the dom module, and created the files
> Component. java, ComponentMenu.java, and ComponentRepository.java.
>
> I then ran the project, without build errors.
>
> However, opening the browser at http://localhost:8080/wicket/ i got this:
>
> Error “The application failed to start due to a number of metamodel
> validation errors. domainapp.dom.PPB.Component#description:
> incompatible default handling of required/optional properties between
> Isis and JDO; add @javax.jdo.annotations.Column(allowsNull="...")”
>
> Source: web browser
>
> Any help is appreciated, thanks
>

Reply via email to