cancel
Showing results for 
Search instead for 
Did you mean: 

SmartSync API

dominik_klaffke
Participant
0 Kudos

Hi all,

please have a look at the following code example from MDK documentation:

<b><i>//Query for 010 ChildRows with SYNC_KEY</i> <i>> '10000000001'</i>

Condition singleCondition = queryFactory.createCondition(syncKeyFieldDescriptor,RelationalOperatorType.GREATER_THAN,"10000000001");

Query rowQuery = queryFactory.createQuery(child101RowDescriptor,singleCondition);</b>

Fine. But how can I get an instance of SmartSyncQueryFactory? The reference variable 'queryFactory' is null....

Thanks for any help,

Dominik

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

It is kind of documented by the methods javadoc itself

public static SmartSyncRuntim getInstance()

- Returns the static instance of this SmartSyncRuntime

class.

and the fact, that this method is the only static one.

But this is quite a usual way to document singletons.

Regards

Volker

dominik_klaffke
Participant
0 Kudos

ok,

the first problem got solved: of course we can not instatiate an interface...

We can call getInstance() of QueryRuntime class.

But the next problem is: What is expected with the first parameter of

<b>createQuery(java.lang.String classtype, Condition condition)</b> function of class QueryRuntime??

There is (again) no sample code for this in MDK. I could imagine that we need a SyncBoDescriptor, but calling

<b>getClass().toString()</b> on a SyncBoDescriptor-instance doesn't work at all

Dominik

dominik_klaffke
Participant
0 Kudos

Finally, i've got it. The documentation of SmartSync API is bad. You need to have an instance of SmartSyncQueryFactory by calling <b>SmartSyncRuntime.getInstance().getQueryFactory();</b>

This was nowhere documentated...

Greetings,

Dominik

<i>PS: If someone wants to communicate via e-Mail with me please post a little note or your mail-address here and I will contact you...Maybe this is a faster approach to share experiences about Mobile Engine and (mobile) Java Development.</i>