Hi Julian,
Thanks for taking the time, I watched one of your adobe labs prerelease videos on flex 3 not so long ago, I am a begginer, I have a website I did in .net and have a sql server 2005 backend database, I am using weborb, and have successfully connected to my database tables, I am having a prob with the shopping cart app that is part of the web orb tutorials, when I run the app I get that error.
I don't know if you have used weborb but it generates all the AS3 classes for each table and each field within each table in the database. I have attached the two classes generated, when I run the app I can log in and click on the add to cart buttons, but nothing appears in my shopping cart panel, but when I look in my remote sql server 2005 tables there are orders there for my login id. So the orders are added but not displaying.
Thanks for your time.
Order.as
package com.FoodAndDrinks
{
import com.FoodAndDrinks.Codegen.*;
[Bindable]
[RemoteClass(alias="com.FoodAndDrinks.Order")]
public dynamic class Order extends _Order
{
}
}
_Order.as
package com.FoodAndDrinks.Codegen
{
import weborb.data.*;
import com.FoodAndDrinks.*;
import mx.collections.ArrayCollection;
import flash.utils.ByteArray;
[Bindable]
public dynamic class _Order extends ActiveRecord
{
public function get ActiveRecordUID():String
{
return _activeRecordId;
}
public function set ActiveRecordUID(value:String):void
{
_activeRecordId = value;
}
private var _uri:String = null;
protected var _orderId: int;
protected var _orderDate: Date;
protected var _deliveryDate: Date;
protected var _deliveryAddress: String;
protected var _status: String;
// parent tables
internal var _relatedAccount: Account
= new Account()
;
public function get OrderId(): int
{
return _orderId;
}
public function set OrderId(value:int):void
{
_isPrimaryKeyAffected = true;
_uri = null;
if(IsLoaded || IsLoading)
{
trace("Critical error: attempt to modify primary key in initialized object " + getURI());
return;
}
_orderId = value;
}
public function get AccountId(): int
{
if(_relatedAccount != null)
return _relatedAccount.AccountId;
return undefined;
}
protected function set AccountId(value:int):void
{
if(_relatedAccount == null)
_relatedAccount = new Account();
_relatedAccount.AccountId = value;
}
public function get OrderDate(): Date
{
return _orderDate;
}
public function set OrderDate(value:Date):void
{
_orderDate = value;
}
public function get DeliveryDate(): Date
{
return _deliveryDate;
}
public function set DeliveryDate(value:Date):void
{
_deliveryDate = value;
}
public function get DeliveryAddress(): String
{
return _deliveryAddress;
}
public function set DeliveryAddress(value:String):void
{
_deliveryAddress = value;
}
public function get Status(): String
{
return _status;
}
public function set Status(value:String):void
{
_status = value;
}
[Bindable(event="loaded")]
public function get RelatedAccount():Account
{
if(IsLazyLoadingEnabled &&
!(_relatedAccount.IsLoaded || _relatedAccount.IsLoading))
{
var oldValue:ActiveRecord = _relatedAccount;
_relatedAccount = DataMapperRegistry.Instance.Account.load(_relatedAccount);
if(oldValue != _relatedAccount)
onParentChanged(oldValue, _relatedAccount);
}
return _relatedAccount;
}
public function set RelatedAccount(value:Account):void
{
if( value != null )
{
var oldValue:ActiveRecord = _relatedAccount;
_relatedAccount = Account(IdentityMap.global.register( value ));
if(oldValue != _relatedAccount)
onParentChanged(oldValue, _relatedAccount);
}
else
_relatedAccount = null;
}
// one to many relation
protected var _relatedOrderLine:ActiveCollection;
[Bindable(event="loaded")]
public function get RelatedOrderLine():ActiveCollection
{
_relatedOrderLine = onChildRelationRequest("relatedOrderLine",_relatedOrderLine);
return _relatedOrderLine;
}
protected override function onDirtyChanged():void
{
if(_relatedAccount != null)
_relatedAccount.onChildChanged(this);
}
public override function prepareToSend(identityMap:IdentityMap, cascade:Boolean = false):Object
{
if( identityMap.exists( ActiveRecordUID ) )
return identityMap.extract( ActiveRecordUID );
var activeRecord:Order = new Order();
activeRecord.ActiveRecordUID = this.ActiveRecordUID;
identityMap.add( activeRecord , false);
if( this._relatedAccount != null )
{
activeRecord._relatedAccount =
this._relatedAccount.prepareToSend(identityMap,false) as Account;
}
activeRecord.OrderId = this.OrderId;
activeRecord.OrderDate = this.OrderDate;
activeRecord.DeliveryDate = this.DeliveryDate;
activeRecord.DeliveryAddress = this.DeliveryAddress;
activeRecord.Status = this.Status;
if(cascade)
{
for each(var orderLine1 :OrderLine in _relatedOrderLine)
{
if(orderLine1.IsDirty)
{
var orderLine1Extract:Object = orderLine1.prepareToSend(identityMap, true);
orderLine1Extract._relatedOrder = activeRecord;
activeRecord.RelatedOrderLine.addItem(orderLine1Extract);
}
}
}
return activeRecord;
}
public override function extractChilds():Array
{
var childs:Array = new Array();
if(this["relatedOrderLine"])
{
for each(var orderLine1 :ActiveRecord in this["relatedOrderLine"] as Array)
childs.push(orderLine1);
}
return childs;
}
public override function applyFields(object:Object):void
{
try
{
disableLazyLoading();
if(!IsPrimaryKeyInitialized)
OrderId = object.OrderId;
OrderDate = object.OrderDate;
DeliveryDate = object.DeliveryDate;
DeliveryAddress = object.DeliveryAddress;
Status = object.Status;
RelatedAccount =
object.RelatedAccount;
_uri = null;
_isPrimaryKeyAffected = true;
IsDirty = false;
}
finally
{
enableLazyLoading();
}
}
protected override function get dataMapper():DataMapper
{
return DataMapperRegistry.Instance.Order;
}
public override function getURI():String
{
if(_uri == null)
{
_uri = "*********"
+ "." + OrderId.toString()
;
}
return _uri;
}
}
}
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217: 218: 219: 220: 221: 222: 223: 224: 225: 226: 227: 228: 229: 230: 231: 232: 233: 234: 235: 236: 237: 238: 239: 240: 241: 242: 243: 244: 245: 246: 247: 248: 249: 250: 251: 252: 253: 254: 255: 256: 257: 258: 259: 260: 261: 262: 263: 264: 265: 266: 267: 268: 269: 270: 271: 272: 273: 274: 275: 276: 277: 278: 279: 280: 281: 282: 283: 284: 285: 286: 287: 288: 289: 290: 291: 292: 293: 294: 295: 296: 297: 298: 299: 300: 301: 302: 303: 304: 305: 306: 307: 308: 309: 310: 311: 312: 313: 314: 315: 316: 317: 318: 319: 320: 321:





by: julianopolitoPosted on 2008-03-25 at 10:04:05ID: 21203812
in the Order class, what is the of the member RelatedOrderLines? In order for it to detect the assignments it should be either a Bindable ArrayCollection or Bindable XMLListCollection.