hi,
I would like to make a tree.
I have Entity “Drzewo” and in it have two attributes:
parent (long),
itemSymbol (string)
attribut parent has set:
Attribute type -> ASSOCIATION,
Type -> prefix$Drzewko
Cardinality: MANY_TO_ONE
(everything shown in the screen)
and during make hierarchicalDatasources in screen I dont select attribut “parent” in hierarchy property field (show in screen)
Please tell me what i’m doing wrong
iskandarov
(Rostislav Iskandarov)
January 10, 2017, 11:26am
#2
Hi,
Which version of Studio do you use?
Could you please share the source of the “Drzewo” entity?
1 Like
hi Rostislav,
my version of Studio is 6.3.3
Now i can select attribute “parent” during create HierarchicalDatasources in field “hierarchy property” but when I add this hierarchical datasources to tree component, when open screen i get error “Internal error”
this is my entities:
package com.company.ecs.entity;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Column;
import com.haulmont.chile.core.annotations.NamePattern;
import com.haulmont.cuba.core.entity.BaseIntegerIdEntity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
@NamePattern("%s %s %s|itemSymbol,id,parent")
@Table(name = "ECS_DRZEWKO")
@Entity(name = "ecs$Drzewko")
public class Drzewko extends BaseIntegerIdEntity {
private static final long serialVersionUID = 541117219281103907L;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "PARENT_ID")
protected Drzewko parent;
@Column(name = "ITEM_SYMBOL")
protected String itemSymbol;
public void setParent(Drzewko parent) {
this.parent = parent;
}
public Drzewko getParent() {
return parent;
}
public void setItemSymbol(String itemSymbol) {
this.itemSymbol = itemSymbol;
}
public String getItemSymbol() {
return itemSymbol;
}
}
ERROR:
HTTP Status 500 - Push failed
type Exception report
message Push failed
description The server encountered an internal error that prevented it from fulfilling this request.
exception
java.lang.RuntimeException: Push failed
com.vaadin.server.communication.AtmospherePushConnection.push(AtmospherePushConnection.java:171)
com.vaadin.server.communication.AtmospherePushConnection.push(AtmospherePushConnection.java:146)
com.vaadin.ui.UI.push(UI.java:1551)
com.vaadin.server.VaadinSession.unlock(VaadinSession.java:997)
com.vaadin.server.VaadinService.ensureAccessQueuePurged(VaadinService.java:1814)
com.vaadin.server.VaadinService.accessSession(VaadinService.java:1780)
com.vaadin.server.VaadinSession.access(VaadinSession.java:1380)
com.vaadin.server.VaadinService.fireSessionDestroy(VaadinService.java:458)
com.vaadin.server.VaadinSession.valueUnbound(VaadinSession.java:324)
org.apache.catalina.session.StandardSession.removeAttributeInternal(StandardSession.java:1839)
org.apache.catalina.session.StandardSession.expire(StandardSession.java:892)
org.apache.catalina.session.StandardSession.expire(StandardSession.java:779)
org.apache.catalina.session.StandardSession.invalidate(StandardSession.java:1279)
org.apache.catalina.session.StandardSessionFacade.invalidate(StandardSessionFacade.java:171)
com.haulmont.cuba.web.sys.CubaApplicationServlet.service(CubaApplicationServlet.java:162)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
com.haulmont.cuba.web.sys.CubaHttpFilter.handleNotFiltered(CubaHttpFilter.java:108)
com.haulmont.cuba.web.sys.CubaHttpFilter.doFilter(CubaHttpFilter.java:95)
root cause
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
com.haulmont.chile.core.model.utils.MethodsCache.invokeGetter(MethodsCache.java:74)
com.haulmont.chile.core.model.impl.AbstractInstance.getValue(AbstractInstance.java:98)
com.haulmont.cuba.core.entity.BaseGenericIdEntity.getValue(BaseGenericIdEntity.java:150)
com.haulmont.cuba.gui.data.impl.HierarchicalDatasourceImpl.getRootItemIds(HierarchicalDatasourceImpl.java:86)
com.haulmont.cuba.web.gui.data.HierarchicalDsWrapper.rootItemIds(HierarchicalDsWrapper.java:57)
com.vaadin.ui.Tree.rootItemIds(Tree.java:921)
com.vaadin.ui.Tree.paintContent(Tree.java:681)
com.haulmont.cuba.web.toolkit.ui.CubaTree.paintContent(CubaTree.java:133)
com.vaadin.server.LegacyPaint.paint(LegacyPaint.java:65)
com.vaadin.server.communication.LegacyUidlWriter.write(LegacyUidlWriter.java:82)
com.vaadin.server.communication.UidlWriter.write(UidlWriter.java:145)
com.vaadin.server.communication.AtmospherePushConnection.push(AtmospherePushConnection.java:168)
com.vaadin.server.communication.AtmospherePushConnection.push(AtmospherePushConnection.java:146)
com.vaadin.ui.UI.push(UI.java:1551)
com.vaadin.server.VaadinSession.unlock(VaadinSession.java:997)
com.vaadin.server.VaadinService.ensureAccessQueuePurged(VaadinService.java:1814)
com.vaadin.server.VaadinService.accessSession(VaadinService.java:1780)
com.vaadin.server.VaadinSession.access(VaadinSession.java:1380)
com.vaadin.server.VaadinService.fireSessionDestroy(VaadinService.java:458)
com.vaadin.server.VaadinSession.valueUnbound(VaadinSession.java:324)
org.apache.catalina.session.StandardSession.removeAttributeInternal(StandardSession.java:1839)
org.apache.catalina.session.StandardSession.expire(StandardSession.java:892)
org.apache.catalina.session.StandardSession.expire(StandardSession.java:779)
org.apache.catalina.session.StandardSession.invalidate(StandardSession.java:1279)
org.apache.catalina.session.StandardSessionFacade.invalidate(StandardSessionFacade.java:171)
com.haulmont.cuba.web.sys.CubaApplicationServlet.service(CubaApplicationServlet.java:162)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
com.haulmont.cuba.web.sys.CubaHttpFilter.handleNotFiltered(CubaHttpFilter.java:108)
com.haulmont.cuba.web.sys.CubaHttpFilter.doFilter(CubaHttpFilter.java:95)
root cause
java.lang.reflect.InvocationTargetException
sun.reflect.GeneratedMethodAccessor149.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
com.haulmont.chile.core.model.utils.MethodsCache.invokeGetter(MethodsCache.java:72)
com.haulmont.chile.core.model.impl.AbstractInstance.getValue(AbstractInstance.java:98)
com.haulmont.cuba.core.entity.BaseGenericIdEntity.getValue(BaseGenericIdEntity.java:150)
com.haulmont.cuba.gui.data.impl.HierarchicalDatasourceImpl.getRootItemIds(HierarchicalDatasourceImpl.java:86)
com.haulmont.cuba.web.gui.data.HierarchicalDsWrapper.rootItemIds(HierarchicalDsWrapper.java:57)
com.vaadin.ui.Tree.rootItemIds(Tree.java:921)
com.vaadin.ui.Tree.paintContent(Tree.java:681)
com.haulmont.cuba.web.toolkit.ui.CubaTree.paintContent(CubaTree.java:133)
com.vaadin.server.LegacyPaint.paint(LegacyPaint.java:65)
com.vaadin.server.communication.LegacyUidlWriter.write(LegacyUidlWriter.java:82)
com.vaadin.server.communication.UidlWriter.write(UidlWriter.java:145)
com.vaadin.server.communication.AtmospherePushConnection.push(AtmospherePushConnection.java:168)
com.vaadin.server.communication.AtmospherePushConnection.push(AtmospherePushConnection.java:146)
com.vaadin.ui.UI.push(UI.java:1551)
com.vaadin.server.VaadinSession.unlock(VaadinSession.java:997)
com.vaadin.server.VaadinService.ensureAccessQueuePurged(VaadinService.java:1814)
com.vaadin.server.VaadinService.accessSession(VaadinService.java:1780)
com.vaadin.server.VaadinSession.access(VaadinSession.java:1380)
com.vaadin.server.VaadinService.fireSessionDestroy(VaadinService.java:458)
com.vaadin.server.VaadinSession.valueUnbound(VaadinSession.java:324)
org.apache.catalina.session.StandardSession.removeAttributeInternal(StandardSession.java:1839)
org.apache.catalina.session.StandardSession.expire(StandardSession.java:892)
org.apache.catalina.session.StandardSession.expire(StandardSession.java:779)
org.apache.catalina.session.StandardSession.invalidate(StandardSession.java:1279)
org.apache.catalina.session.StandardSessionFacade.invalidate(StandardSessionFacade.java:171)
com.haulmont.cuba.web.sys.CubaApplicationServlet.service(CubaApplicationServlet.java:162)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
com.haulmont.cuba.web.sys.CubaHttpFilter.handleNotFiltered(CubaHttpFilter.java:108)
com.haulmont.cuba.web.sys.CubaHttpFilter.doFilter(CubaHttpFilter.java:95)
root cause
java.lang.IllegalStateException: Cannot get unfetched attribute [parent] from detached object com.company.ecs.entity.Drzewko-96016 [detached].
org.eclipse.persistence.internal.queries.EntityFetchGroup.onUnfetchedAttribute(EntityFetchGroup.java:98)
com.haulmont.cuba.core.sys.persistence.CubaEntityFetchGroup.onUnfetchedAttribute(CubaEntityFetchGroup.java:61)
org.eclipse.persistence.internal.jpa.EntityManagerImpl.processUnfetchedAttribute(EntityManagerImpl.java:2846)
com.haulmont.chile.core.model.impl.AbstractInstance._persistence_checkFetched(AbstractInstance.java)
com.company.ecs.entity.Drzewko._persistence_get_parent(Drzewko.java)
com.company.ecs.entity.Drzewko.getParent(Drzewko.java:29)
sun.reflect.GeneratedMethodAccessor149.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
com.haulmont.chile.core.model.utils.MethodsCache.invokeGetter(MethodsCache.java:72)
com.haulmont.chile.core.model.impl.AbstractInstance.getValue(AbstractInstance.java:98)
com.haulmont.cuba.core.entity.BaseGenericIdEntity.getValue(BaseGenericIdEntity.java:150)
com.haulmont.cuba.gui.data.impl.HierarchicalDatasourceImpl.getRootItemIds(HierarchicalDatasourceImpl.java:86)
com.haulmont.cuba.web.gui.data.HierarchicalDsWrapper.rootItemIds(HierarchicalDsWrapper.java:57)
com.vaadin.ui.Tree.rootItemIds(Tree.java:921)
com.vaadin.ui.Tree.paintContent(Tree.java:681)
com.haulmont.cuba.web.toolkit.ui.CubaTree.paintContent(CubaTree.java:133)
com.vaadin.server.LegacyPaint.paint(LegacyPaint.java:65)
com.vaadin.server.communication.LegacyUidlWriter.write(LegacyUidlWriter.java:82)
com.vaadin.server.communication.UidlWriter.write(UidlWriter.java:145)
com.vaadin.server.communication.AtmospherePushConnection.push(AtmospherePushConnection.java:168)
com.vaadin.server.communication.AtmospherePushConnection.push(AtmospherePushConnection.java:146)
com.vaadin.ui.UI.push(UI.java:1551)
com.vaadin.server.VaadinSession.unlock(VaadinSession.java:997)
com.vaadin.server.VaadinService.ensureAccessQueuePurged(VaadinService.java:1814)
com.vaadin.server.VaadinService.accessSession(VaadinService.java:1780)
com.vaadin.server.VaadinSession.access(VaadinSession.java:1380)
com.vaadin.server.VaadinService.fireSessionDestroy(VaadinService.java:458)
com.vaadin.server.VaadinSession.valueUnbound(VaadinSession.java:324)
org.apache.catalina.session.StandardSession.removeAttributeInternal(StandardSession.java:1839)
org.apache.catalina.session.StandardSession.expire(StandardSession.java:892)
org.apache.catalina.session.StandardSession.expire(StandardSession.java:779)
org.apache.catalina.session.StandardSession.invalidate(StandardSession.java:1279)
org.apache.catalina.session.StandardSessionFacade.invalidate(StandardSessionFacade.java:171)
com.haulmont.cuba.web.sys.CubaApplicationServlet.service(CubaApplicationServlet.java:162)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
com.haulmont.cuba.web.sys.CubaHttpFilter.handleNotFiltered(CubaHttpFilter.java:108)
com.haulmont.cuba.web.sys.CubaHttpFilter.doFilter(CubaHttpFilter.java:95)
note The full stack trace of the root cause is available in the Apache Tomcat/8.0.35 logs.
Apache Tomcat/8.0.35
hi,
now i can select Hierarchy property in my hierarchicalDatasource (so it is probably all right), but after open screen, i get Internal Error. Of course, before I add to tree component my hierarchical datasource.
Could you write me step by step, how to display my data in tree inside screen?
my sql table
id (bigint),
parent_id (bigint),
name (varchar(250))
iskandarov
(Rostislav Iskandarov)
January 10, 2017, 12:07pm
#5
I assume the following case:
You created a new hierarchical datasource.
You selected another entity: not “Drzewo”, and tried to expand the “Hierarchy property” list. As the selected entity had no links it was empty.
Then you changed entity to “Drzewo”. But the “Hierarchy property” list was still empty - it shows properties of the entity selected at the previous step.
It is an issue. And it is already fixed. The fix will be delivered with the next Studio release.
As a workaround, to refresh the form, select another value in the “Type” field, and then bring back “hierarchicaDatasource”.
1 Like
iskandarov
(Rostislav Iskandarov)
January 10, 2017, 12:51pm
#6
Which view do you use in the hierarchicalDatasource?
For the entity create a view with the association property and select it in the “View” field of the datasource.
1 Like
OK super. Everything works!