cancel
Showing results for 
Search instead for 
Did you mean: 

Inserting a new row in SyncBO, Well or badly?

Former Member
0 Kudos

Hi, i want insert new row from PDA, my steps are:

- I create a new button that go to new window that appear the fields of the data:





- In the new window, there a new button that insert the data:





The problem, i think that is in this method, i insert new test row:
private String Insert() {
String[] newValues = new String[4];
newValues[0] = "6";
newValues[1] = "Prueba";
newValues[2] = "Probando";
newValues[3] = "10.10.2007";
SmartSyncDBAccess p = new SmartSyncDBAccess();
try {
p.addRowInDB(currentSyncBoName, newValues);
} catch (Exception e) {
e.printStackTrace();
}
return JSP_INSERT;
}

This method is called when press the button before...

The method addRowInDB is create automatically:
public void addRowInDB(String syBName, String[] newValues)
throws SmartSyncException, PersistenceException {
String syncBoName = syBName;
SyncBoDescriptor sbd = descriptorFacade.getSyncBoDescriptor(syncBoName);
SmartSyncTransactionManager transactionManager;

// Create new syncbo
SyncBo newsyncBo = dataFacade.createEmptySyncBo(sbd);
// A transaction manager is valid for one action starting with beginTransaction and ending with commit/rollback
// In this example we commit (save) every row we add - no rollback.
transactionManager = dataFacade.getSmartSyncTransactionManager();
transactionManager.beginTransaction();
for (int i = 0; i < arrayHeaderFieldNames.length; i++) {
if (newValues != null) {
setHeaderFieldValue(
newsyncBo,
arrayHeaderFieldNames
,
newValues);

}

}

dataFacade.insertSyncBo(newsyncBo);

//Commit the transaction

transactionManager.commit();

}

When i execute the application, appear all correctly, but i don´t see the new row, are there any wrong?

Thanks,

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

mmmmm, lot of thanks, your post will help me.

Now, i continue with the problem.

First of all, i have the Sync and the tables and all, in the same system... If i do in the different system, don´t work; It is to say, the backend and the middleware are in the same system...

I create new row in the device, not appear errors but the row appears neither in the pda nor in the system.

I think that when i call the method "p.addRowInDB(currentSyncBoName, newValues);", don´t acced to thsi method:

private String Insert() {

String[] newValues = new String[4];

newValues[0] = "6";

newValues[1] = "Prueba";

newValues[2] = "Probando";

newValues[3] = "10.10.2007";

SmartSyncDBAccess p = new SmartSyncDBAccess();

try {

p.addRowInDB(currentSyncBoName, newValues);

} catch (Exception e) {

e.printStackTrace();

}

return JSP_INSERT;

}

Thanks,

Former Member
0 Kudos

Hi Victor,

just to confirm. You read the persistence on the PDA with no restrictions - just show it as it is. And after you have called the insert stuff the data is not there?

Well, debugging on a PDA is strange - what about the PC? Is it working there and while in Eclipse - have you debugged your code and what was the result? Is it goint through your insert code and is this processing as expected?

Regards,

Oliver

Former Member
0 Kudos

Lot of thanks about your help...

I´m working with the PC, because fewer failures appear.

When i replicate the SyncBO, all rows that there are in the table, appear in my pc without problem, but when i insert new row, it doesn´t appear in any of the sites.

I´m working with Eclipse.

Have you got google talk? Can you write me?

Thanks,

Message was edited by:

Victor Capi

Former Member
0 Kudos

Unfortunately I am a Microsoft Guy, using MSN and Skype.... Any chance with that?

Former Member
0 Kudos

mmmmm, ok, perfect, i use msn, If it isn´t important for you to add my direction is: vcapi1984@hotmail.com

Thanks,

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Victor,

sorry, I have been on the plane and in the car traveling back to home. So I was not able to reply.

Well, yes, I am a little confused. If you say, you do not see the data - where?

Oncve you create the dataset, if should be on the device. Sync is not necessary. Have a look into the persistence of the device directly, there you should see this item.

In the moment you sync this item, it goes throgh the middleware to the backend. If an error happens on this way, you can see this in the middleware by using MEREP_MON. Look into the SyncBO in the MEREP_MON. You can drill down into the actual data. Was the data send correctly? IF an error occures there, either the handler on the backend is wrong, or you have entered wrong data.

If you have an error on the middleware in MEREP_MON and no idea why this happens - call the create handler in the backend directly and enter the data - is this working fine there?

Ok, if you do not have an error in the MEREP_MON, the data is created in the backend if you call the handler directly in the backend and enter the data manually and there is no data on the device after sync - yes, this is absolutely ok! Well, sound a alittle strange perhaps, but:

while you create data on the device, it is of N or L - I think it is L. You can see this by directly looking into the persistence on the device.

Ok, while you sync, the data is send to the middleware and it changes the state on the device to S - showing you that this dataset is in SYNC and you should not change it at all at the moment.

After everything went fine on the middleware, it will delete this dataset from the client.

Now, because you have a T2W dataset, the data is on the backend, but not on the middleware. Run the replicator manually again for that particular SyncBO. You can use MEREP_EX_REPLIC to do that. There you get a result if there was any update on the data while running the replicator. In a productive environment you will run these replicators as background jobs.

Be aware, that T2W handlers are not optimized. They grap always the complete data for that syncBO from the backend, check for each and every BO if there was any change and change these items on the middleware. Expecially if you have large datasets, the processing time could be extremely long.

Ok, if you have seen that the data was send to the middleware with the replication, you can sync again - after that you should see this item on the device.

Well, and now I would like to know: where in the above scenario do not see the generated item? Really at the beginning? Then your create Method on the device is wrong. So that is the first thing I would like to clarify: one you create the item on the device - do NOT syncand have a look directly into the persistence of the device - can you see the item there?

Hopefully this is ok, then the rest of the procedure desribed above should help you to find the problem.

Regards,

Oliver

Former Member
0 Kudos

Hi Victor,

Assuming your code is correct, when you sync your created record shud appear in Backend.

the reason for the data not visible might be:

1) Record might be struck due to some connection problems for this look into merep_mon and enter ur mobile ID and monitor.

2) since it is T01 syncBO you need to start the replicator merep_pd -> synchronizer Tab and replicate.

note that

the delta determination between the application database in the backend system and the replicated database on the Mobile Infrastructure Server Component is executed as a periodic, background job (and not with each synchronization event).

so execute the replicator and see.

Hope this helps

Divya

Former Member
0 Kudos

Anybody??

Former Member
0 Kudos

Hi Victor,

basically this looks fine - in general.

Do you get any Errors? You should if the item is really not there.

If you say, you do not see the item, try to restart the device. If you see the item then, your display method caches data - is it custom build or out of the box?

Regards,

Oliver

Former Member
0 Kudos

Not appear errors, but the new item don´t appear... I restar the device, i synchronise, but don´t appear the new row...

The type is timedTwoWay

Message was edited by:

Victor Capi