2

We are trying to build a Java service that fetches json data through DXA. We only need the raw data from a REST service. We created a class that extends AbstractEntityModel but it seems like the class is not found by the framework (DXA). When we debug, we see that when the SemanticMapperImpl.createInstance(Class entityClass) gets called our entityClass is null. How do re register our Class to be found and used by the SemanticMapper?

1

welcome to Tridion Stack Exchange.

You have to register your View Model Type in a Module Initializer. See, for example, https://github.com/sdl/dxa-modules/blob/master/webapp-java/dxa-module-core/src/main/java/com/sdl/dxa/modules/core/CoreInitializer.java

Note that DXA resolves View Model Types through a View name (stored in metadata on Component Template in CM). Even if you don’t use server-side Views, you will have to register your View Model Types with an associated View name; the View doesn’t have to actually exist if you are only retrieving the raw View Model data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.