Details
-
Bug
-
Status: Closed
-
High
-
Resolution: Fixed
-
None
-
None
-
None
-
Platform 209 SSO Discovery
Description
1) create a document bean class e.g. NewsDocument and annotate it with @Node anotation
2) create a component and make use of HST query in form createQuery(scope, NewsDocument.class)
3) run project with DynamicBeans disabled (it works)
4) run project with DynamicBeans enabled (it throws exception)
23.05.2019 14:10:52 ERROR http-nio-8080-exec-2 [EventsAndCalendar.doBeforeRender:91] Error while getting the documents Cannot find primaryNodeType for 'java.lang.Class'. org.hippoecm.hst.content.beans.query.exceptions.QueryException: Cannot find primaryNodeType for 'java.lang.Class'. at org.hippoecm.hst.content.beans.query.HstQueryManagerImpl.createQuery(HstQueryManagerImpl.java:158) ~[hst-content-beans-13.2.0.jar:13.2.0] at org.hippoecm.hst.content.beans.query.HstQueryManagerImpl.createQuery(HstQueryManagerImpl.java:130) ~[hst-content-beans-13.2.0.jar:13.2.0] at org.hippoecm.hst.content.beans.query.HstQueryManagerImpl.createQuery(HstQueryManagerImpl.java:121) ~[hst-content-beans-13.2.0.jar:13.2.0] at com.onehippo.gogreen.components.events.EventsAndCalendar.doBeforeRender(EventsAndCalendar.java:84) [classes/:4.2.0-SNAPSHOT] at org.hippoecm.hst.core.container.HstComponentInvokerImpl.invokeBeforeRender(HstComponentInvokerImpl.java:151) [hst-core-13.2.0.jar:13.2.0]
"Cannot find primaryNodeType for 'java.lang.Class'. is also not very useful.
Following method can be enhanced to support this: org.hippoecm.hst.content.beans.manager.ObjectConverterImpl#getPrimaryNodeTypeNameFor
public String getPrimaryNodeTypeNameFor(final Class<? extends HippoBean> hippoBean) { return jcrPrimaryNodeTypeBeanPairs.entrySet().stream().filter(e -> e.getValue() == hippoBean) .findFirst().map(Map.Entry::getKey).orElse(null); }
In case dynamic bean is used, it cannot match the value because class name becomes something like:
org.mypackage.NewsDocument$abc instead of org.mypackage.NewsDocument
We could do an extra lookup and match @Node jcrType string value in those cases.
Attachments
Issue Links
- relates to
-
HSTTWO-4602 Dynamic content beans are not created in case the context-param is not exactly according one specific setup
- Closed