无法使用 Cairngorm 持久性库为 PersistenceClient 创建 SqlMap
我试图通过以下方式创建持久性客户端对象:
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 );
我遇到的问题是,即使 sqlmap 对象内有一个有效的“_maps”数组,sqlmap 的“map”属性仍然不可检索。
maps [] (@b812d09)
[0] Object (@b103d61)
createRepoFileTable com.adobe.cairngorm.persistence.api.grammar.Create (@b103a91)
length 1
当尝试执行创建表sql时,语句工厂抱怨:
Error: SQLERROR0014: Statement 'createRepoFileTable' not found in SQL map
不知何故,sqlmap类无法使用ObjectUtil类将传递给它的对象的属性复制到map属性。
我不想使用 mxml 文件,也不想像示例中那样使用 SPICElib。
我在这里做错了什么?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
所以我发现在我的例子中,SqlMap 类中对 Spicelib 组件的调用不起作用:
属性数组始终为空。
但是,我获取了持久性库的源代码并更改了 ObjectUtil 中的循环以直接遍历对象的属性:
现在它可以工作了,尽管我对修改 ObjectUtil 类并不是很高兴......也许有人对此有更好的看法。
so i figured out that in my case somehow the calls in the SqlMap class to the spicelib components didn't work:
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:
now it works, although i am not really happy having modified the ObjectUtil class... maybe someone has a better take on this.