Issue with Set collections with Javafx

9 views
Skip to first unread message

Daniele Renda

unread,
Feb 14, 2013, 6:24:55 AM2/14/13
to gran...@googlegroups.com
Hi,
in my small application I've a pojo with a collection (Set).

public class MyBean{
   
@OneToMany(fetch = FetchType.LAZY, orphanRemoval = true, mappedBy = "collectionSet", cascade = CascadeType.ALL)
   
private Set<MyBean2> collectionSet;
}
public class MyBean2{
   
private String property1;
   
private String property2;  
   
@ManyToOne(fetch = FetchType.LAZY, optional = false)
   
private MyBean bean;
}



In the server I've a custom repository with a method that load my collection because it is LAZY:
@Override
   
public Set<MyBean> loadCollection(Long id) throws Exception {
       
MyBean bean= manager.find(MyBean.class, id);
       
if (bean!= null) {
            bean
.getCollectionSet.size();
           
return bean.getCollectionSet();
       
} else {          
           
throw new Exception("Bean not found");
       
}
   
}



but in the JavaFx client when I call the method of repository I've this error:

Exception in runnable
java.lang.ClassCastException: flex.messaging.io.ArrayCollection cannot be cast to java.util.Set
    at it.pianetatecno.aci.client.ui.vendite.RiepilogoVenditaUi$3.result(RiepilogoVenditaUi.java:188)
    at org.granite.client.tide.impl.ResultHandler.run(ResultHandler.java:96)
    at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:173)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
    at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:73)
    at java.lang.Thread.run(Thread.java:722)

Maybe it's a bug?

Thanks
Reply all
Reply to author
Forward
0 new messages