[英]How to manage association entities in Hibernate / BlazeDS
I'Ive been working on Java/Hibernate/BlazeDS integrations - but am getting stuck with sending the child entities in a one-to-many relationship across BlazeDS... 我一直在从事Java / Hibernate / BlazeDS集成的工作-但一直困扰于以跨BlazeDS一对多的关系发送子实体...
For starters I have a Client and ClientLinks table in MS Sql Server 首先,我在MS Sql Server中有一个Client和ClientLinks表
Now java-side in Client the property defining the ClientLinks entity is 现在,在客户端的Java端,定义ClientLinks实体的属性是
private Set clientLinks = new HashSet(0);
On the AS3 side the property setter is 在AS3方面,属性设置器是
public function set clientProfiles(value:mx.collections.ICollectionView):void {
const oldValue:mx.collections.ICollectionView = this._clientProfiles;
if (oldValue != value) {
this._clientProfiles = value;
dispatchUpdateEvent("clientProfiles", oldValue, value);
}
}
I'm using a farrata systems plugin to generate the AS3 based on java counterparts (could be my problem) I'd like to know if there's an old school way to do this. 我正在使用farrata系统插件来基于Java对应对象生成AS3(可能是我的问题),我想知道是否有旧的方法可以做到这一点。
What happens now is when I invoke a method Java side from a flex client I recieve a strongly typed Client (great!) but the ClientLinks are represented by a mx.collections::ArrayCollection
. 现在发生的是,当我从Flex客户端调用方法Java端时,我收到了一个强类型的Client(很棒!),但ClientLinks由
mx.collections::ArrayCollection
。 I'd like the ClientLinks to map to my as3 ClientLinks and access them like client.clientLinks[0].linkname
etc.. etc.. 我希望ClientLink映射到我的as3 ClientLink并像
client.clientLinks[0].linkname
等那样访问它们。
Can anyone set me straight about the best way to set this up? 谁能让我直截了当地了解设置此方法的最佳方法?
Java Collections will always be mapped as ArrayCollection
. Java集合将始终映射为
ArrayCollection
。 If you want strongly typed AS3 Collections you should use a wrapper class: 如果要使用强类型的AS3集合,则应使用包装器类:
public class ClientLinkCollection implements IList, ICollectionView
{
private var _source: ArrayCollection = null;
public function ClientLinks(source: ArrayCollection): void
{
if (source is ArrayCollection)
_source = ArrayCollection(source);
else
throw new TypeError("Invalid argument type!");
}
public function getClientLinkItem(index: int): ClientLink
{
return ClientLink(_source.getItemAt(index));
}
...
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.