seyran / flexorm Goto Github PK
View Code? Open in Web Editor NEWThis project forked from seanhess/flexorm
A fork of FlexORM on google code
This project forked from seanhess/flexorm
A fork of FlexORM on google code
`
private function test():void{
var entityManager:nz.co.codec.flexorm.EntityManagerAsync = nz.co.codec.flexorm.EntityManagerAsync.instance;
var dbFile : File = new File("G:\\programming\\db\\dummy-test.db");
var sqlConnection:SQLConnection = new SQLConnection();
sqlConnection.open(dbFile);
entityManager.sqlConnection = sqlConnection;
var company:Company = new Company();
company.name = "Drole de Video";
var person:Person = new Person();
person.addresses.addItem(new Address(1544, "Street 1"));
person.addresses.addItem(new Address(5487, "Street 214"));
person.name = "Judge corona";
var person2:Person = new Person();
person2.addresses.addItem(new Address(324, "Street 34"));
person2.addresses.addItem(new Address(5487, "Street 33"));
person2.name = "Fonta Mnata Jodo";
company.employees.addItem(person);
company.employees.addItem(person2);
company.addresses.addItem(new Address(345, "Stroker bent"));
entityManager.save(company, new mx.rpc.Responder(
function result(e:EntityEvent):void{
},
function error(e:EntityErrorEvent):void
{
trace(e);
}
));
}
`
SQLError: 'Error #3115: SQL Error.', details:'The schema object with name 'id_entities' of type 'table' in database 'main' was not found.', operation:'schema', detailID:'1007'
at flash.data::SQLConnection/internalLoadSchema()
at flash.data::SQLConnection/loadSchema()
at nz.co.codec.flexorm.command::CreateAsynCommand/execute()[G:\programming\as3\db\FlexORM\flexorm\src\nz\co\codec\flexorm\command\CreateAsynCommand.as:65]
at nz.co.codec.flexorm::BlockingExecutor/execute()[G:\programming\as3\db\FlexORM\flexorm\src\nz\co\codec\flexorm\BlockingExecutor.as:45]
at nz.co.codec.flexorm::BlockingExecutor/result()[G:\programming\as3\db\FlexORM\flexorm\src\nz\co\codec\flexorm\BlockingExecutor.as:58]
at Function/<anonymous>()[G:\programming\as3\db\FlexORM\flexorm\src\nz\co\codec\flexorm\command\BeginCommand.as:37]
at flash.data::SQLConnection/internalBegin()
at flash.data::SQLConnection/begin()
at nz.co.codec.flexorm.command::BeginCommand/execute()[G:\programming\as3\db\FlexORM\flexorm\src\nz\co\codec\flexorm\command\BeginCommand.as:40]
at nz.co.codec.flexorm::BlockingExecutor/execute()[G:\programming\as3\db\FlexORM\flexorm\src\nz\co\codec\flexorm\BlockingExecutor.as:45]
at nz.co.codec.flexorm::EntityManagerAsync/save()[G:\programming\as3\db\FlexORM\flexorm\src\nz\co\codec\flexorm\EntityManagerAsync.as:574]
at Dictionaries/test()[G:\programming\as3\multiverses\MultiversesTester\src\Dictionaries.mxml:95]
at Dictionaries/onCreationComplete()[G:\programming\as3\multiverses\MultiversesTester\src\Dictionaries.mxml:58]
at Dictionaries/___Dictionaries_WindowedApplication1_creationComplete()[G:\programming\as3\multiverses\MultiversesTester\src\Dictionaries.mxml:6]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()[D:\flex_sdk\Sources\flex-sdk\frameworks\projects\framework\src\mx\core\UIComponent.as:13688]
at mx.core::UIComponent/set initialized()[D:\flex_sdk\Sources\flex-sdk\frameworks\projects\framework\src\mx\core\UIComponent.as:1839]
at mx.managers::LayoutManager/doPhasedInstantiation()[D:\flex_sdk\Sources\flex-sdk\frameworks\projects\framework\src\mx\managers\LayoutManager.as:848]
at mx.managers::LayoutManager/doPhasedInstantiationCallback()[D:\flex_sdk\Sources\flex-sdk\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1191]
Hi again! I've encountered a serious bug concerning a really simple test which describes the entities this way:
This is the error I get
SQLError: 'Error #3115: SQL Error.', details:'Mismatch in parameter count. Found 7 in SQL specified and 6 value(s) set in parameters property.
Expecting values for ':updatedAt', ':personId', ':street', ':markedForDeletion', ':companyId', ':houseNumber' and ':createdAt'', operation:'execute', detailID:'1004'
at flash.data::SQLStatement/internalExecute()
at flash.data::SQLStatement/execute()
package de.gaia.entities
{
import mx.collections.ArrayCollection;
import mx.collections.IList;
[Bindable]
[Table(name="companies"/*, inheritsFrom="de.gaia.entities.IdEntity"*/)]
public class Company
{
private var _id:uint;
private var _name:String;
private var _addresses:IList = new ArrayCollection();
private var _employees:IList = new ArrayCollection()
public function Company()
{
super();
}
[Id]
[Column(name="company_id")] // by default
public function get id():uint
{
return _id;
}
public function set id(value:uint):void
{
_id = value;
}
[OneToMany(type="de.gaia.entities.Person", fkColumn="company_id")]
public function get employees():IList
{
return _employees;
}
public function set employees(value:IList):void
{
_employees = value;
}
[OneToMany(type="de.gaia.entities.Address", fkColumn="company_id")]
public function get addresses():IList
{
return _addresses;
}
public function set addresses(value:IList):void
{
_addresses = value;
}
[Column]
public function get name():String
{
return _name;
}
public function set name(value:String):void
{
_name = value;
}
}
}
package de.gaia.entities
{
[Bindable]
[Table(name="addresses"/*, inheritsFrom="de.gaia.entities.IdEntity"*/)]
public class Address/* extends IdEntity*/
{
private var _id:uint;
private var _houseNumber:int;
private var _street:String;
public function Address(houseNumber:int=0, street:String="")
{
_street = street;
_houseNumber = houseNumber;
}
[Id]
[Column(name="address_id")] // by default
public function get id():uint
{
return _id;
}
public function set id(value:uint):void
{
_id = value;
}
[Column]
public function get houseNumber():int
{
return _houseNumber;
}
public function set houseNumber(value:int):void
{
_houseNumber = value;
}
[Column]
public function get street():String
{
return _street;
}
public function set street(value:String):void
{
_street = value;
}
}
}
package de.gaia.entities
{
import mx.collections.ArrayCollection;
import mx.collections.IList;
[Bindable]
[Table(name="people"/*, inheritsFrom="de.gaia.entities.IdEntity"*/)]
public class Person /*extends IdEntity*/
{
private var _id:uint;
private var _name:String;
private var _addresses:IList = new ArrayCollection();
public function Person()
{
}
[Id]
[Column(name="person_id")] // by default
public function get id():uint
{
return _id;
}
public function set id(value:uint):void
{
_id = value;
}
[OneToMany(type="de.gaia.entities.Address", fkColumn="person_id")]
public function get addresses():IList
{
return _addresses;
}
public function set addresses(value:IList):void
{
_addresses = value;
}
[Column]
public function get name():String
{
return _name;
}
public function set name(value:String):void
{
_name = value;
}
}
}
With the following execution code
var dbFile : File = new File("G:\\programming\\db\\dummy-test.db");
var sqlConnection:SQLConnection = new SQLConnection();
sqlConnection.open(dbFile);
entityManager.sqlConnection = sqlConnection;
var company:Company = new Company();
company.name = "Drole de Video";
entityManager.save(company);
var person:Person = new Person();
person.addresses.addItem(new Address(1544, "Street 1"));
person.addresses.addItem(new Address(5487, "Street 214"));
person.name = "Judge corona";
var person2:Person = new Person();
person2.addresses.addItem(new Address(324, "Street 34"));
person2.addresses.addItem(new Address(5487, "Street 33"));
person2.name = "Fonta Mnata Jodo";
company.employees.addItem(person);
company.employees.addItem(person2);
company.addresses.addItem(new Address(345, "Stroker bent"));
entityManager.save(company)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.