Question

i am trying to create a persistence client object in the following way:

var create:Create = new Create();
create.sql = "CREATE TABLE IF NOT EXISTS REPOFILE( REPOFILEID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT, CHECKSUM TEXT, BYTES INTEGER, CREATED INTEGER, UPDATED INTEGER, ISDIRECTORY INTEGER )";

var sqlMap:SqlMap = new SqlMap( { createRepoFileTable : create } );

connectionManager = new ConnectionManagerFactory().createConnectionManager();
persistenceClient = new PersistenceClient( sqlMap, connectionManager );

the problem i am encountering is that the "map" property of the sqlmap stays not retrievable even though there is a valid "_maps" array inside the sqlmap object.

maps    [] (@b812d09)   
    [0] Object (@b103d61)   
        createRepoFileTable com.adobe.cairngorm.persistence.api.grammar.Create (@b103a91)       
    length  1   

when trying to execute the create table sql, the statement factory complains:

Error: SQLERROR0014: Statement 'createRepoFileTable' not found in SQL map

somehow the sqlmap class is unable to copy the properties of the object passed to it to the map property using the ObjectUtil class.

i do not want to use an mxml file and i also do not want to use spicelib like in the example.

what am i doing wrong here?

Was it helpful?

Solution

so i figured out that in my case somehow the calls in the SqlMap class to the spicelib components didn't work:

var classInfo:ClassInfo=ClassInfo.forInstance(source);
var properties:Array=classInfo.getProperties();

the properties array was always empty.

however, i took the persistence lib's source code and changed the loop in the ObjectUtil's to go over the object's properties directly:

for (var propertyName:String in source)

now it works, although i am not really happy having modified the ObjectUtil class... maybe someone has a better take on this.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top