RequestContext retreived实体更新抛出未找到的实体

时间:2018-06-05 15:51:40

标签: java spring hibernate gwt requestfactory

我正在使用GWT,Spring和Hibernate创建一个Web应用程序。

CtTopology.java (实体类)

public class CtTopology extends EntityBase 
{
    private List<CtSite> sites;

    @OneToMany(cascade = {CascadeType.ALL}, orphanRemoval = true, mappedBy = "topology", fetch = FetchType.LAZY)
    public List<CtSite> getSites()
    ......

CtTopologyProxy

@ProxyFor(value=CtTopology.class, locator=CtTopologyLocator.class)
public interface CtTopologyProxy extends EntityProxy {

    public Integer getIidtopology();

CtSite.java

public class CtSite extends EntityBase
{
   private CtTopology topology;

   @ManyToOne(fetch = FetchType.LAZY)
   @JoinColumn(name = "iIDTopology")
   public CtTopology getTopology()
    ......
}

CtTopologyDaoImpl.java

public class CtTopologyDaoImpl
    {
        @PersistenceContext
        EntityManager em ;

        @Transactional
        public void update(CtTopology topology) 
        {
            em.merge(topology);
        }
    }

CtTopologyLocator.java

public class CtTopologyLocator extends AbstractEntityProxyLocator<CtTopology, Integer>
{
    @Override
    public Integer getId(CtTopology domainObject) 
    {       
        return domainObject.getIidtopology() ;
    }

    @Override
    public Class<Integer> getIdType() 
    {
      return Integer.class;
    }
}

当我尝试使用find从数据库中检索实例时,我创建一个新的serviceRequest并编辑检索到的实体,然后添加一个站点并尝试按如下方式更新它,发生错误

topologyServiceRequest3.getCtTopologyByIDs(topologyId).with("sites").fire(new Receiver<CtTopologyProxy>()
    {

        @Override
        public void onSuccess(CtTopologyProxy response)
        {


            TopologyServiceRequest topologyServiceRequest = getServiceProxyFactory().topologyServiceRequest();

            topologyProxy = topologyServiceRequest.edit(response);
            //create site
            ...
            siteProxy.setTopology(topologyProxy);
            topologyProxy.getSites().add(siteProxy);

            topologyServiceRequest.update(topologyProxy).fire(/* receiver */);
    }
  

服务器错误:请求的实体在服务器上不可用

请建议。

0 个答案:

没有答案