Database Replication Questions

2
I'm trying to import some people data using the Database Replication module from the App Store and have some issues and questions. First the error I'm getting: 2011-03-06 12:39:11.161 INFO - DBReplication: INFO - Start synchronizing 2011-03-06 12:39:11.196 INFO - DBReplication: INFO - Executing query on external database, query: SELECT [mainTable].[Racf] AS [Racf] , [mainTable].[WorkPhone] AS [Phone1] , [mainTable].[PerID] AS [PersonID] , [mainTable].[MailBuilding] AS [BuildingCode] , [mainTable].[MailCampus] AS [23de5afb-c] , [mainTable].[PerID] AS [Password] , [mainTable].[WorkPager] AS [Phone2] , [mainTable].[MailCampus] AS [316ad527-0] , [mainTable].[Email] AS [Email] , [mainTable].[LanID] AS [Name] , [mainTable].[MailCampus] AS [ffa76ade-f] , [mainTable].[Credentials] AS [Credentials] , [mainTable].[NickName] AS [Nickname] , [mainTable].[MailCampus] AS [d1c33d7c-0] , [mainTable].[MailFloor] AS [FloorCode] , [mainTable].[LastName] AS [LastName] , [mainTable].[FirstName] AS [FirstName] , [mainTable].[EmployeeID] AS [EmployeeID] , [mainTable].[MailRoom] AS [RoomCode] FROM [CRDA] AS [mainTable] WHERE SubType = '01' AND PerID = 10000518 2011-03-06 12:39:11.270 ERROR - Connector: An error has occurred while handling the request. [User 'dsanders' with roles 'User, Segment01, Requester, Administrator'] 2011-03-06 12:39:11.270 ERROR Connectorcom.mendix.core.CoreException: Exception occurred in action 'Microflow [DatabaseReplication.IVKImportTableMapping]', all database changes executed by this action were rolled back at com.mendix.core.actionmanagement.CoreAction.d(SourceFile:553) Caused by: com.mendix.core.CoreException: Exception occurred in microflow 'DatabaseReplication.IVK_ImportTableMapping' for activity 'Call 'ImportByMapping'', all database changes executed by this microflow were rolled back at kP.b(SourceFile:251) Caused by: replication.ReplicationSettings$MendixReplicationException: org.apache.commons.lang.NotImplementedException: Code is not implemented at databasereplication.implementation.DataManager.startSynchronizing(DataManager.java:263) Caused by: org.apache.commons.lang.NotImplementedException: Code is not implemented at replication.ValueParser.getValueByType(ValueParser.java:267) at databasereplication.implementation.DBValueParser.getValue(DBValueParser.java:174) at databasereplication.implementation.DataManager.startSynchronizing(DataManager.java:167) at databasereplication.actions.ImportByMapping.importFromDatabase(ImportByMapping.java:229) at databasereplication.actions.ImportByMapping.executeAction(ImportByMapping.java:74) at databasereplication.actions.ImportByMapping.executeAction(ImportByMapping.java:52) at com.mendix.systemwideinterfaces.core.UserAction.execute(SourceFile:49) at com.mendix.core.actionmanagement.CoreAction.call(SourceFile:473) at it.b(SourceFile:155) at com.mendix.core.Core.execute(SourceFile:191) at hi.a(SourceFile:70) at kP.a(SourceFile:66) at eO.executeAction(SourceFile:96) at com.mendix.systemwideinterfaces.core.UserAction.execute(SourceFile:49) at com.mendix.core.actionmanagement.CoreAction.call(SourceFile:473) at it.b(SourceFile:155) at com.mendix.core.Core.execute(SourceFile:191) at dw.execute(SourceFile:183) at ju.a(SourceFile:299) at ju.a(SourceFile:230) at ju.processRequest(SourceFile:174) at fC.a(SourceFile:71) at com.mendix.core.MxRuntime.processRequest(SourceFile:916) ..... First, the error is org.apache.commons.lang.NotImplementedException: Code is not implemented - what does this mean? I also have some questions about usage of microflows to format field mappings. Where the target is an association (rather than an attribute), should the microflow return the object to link to, or a text string from the target object? Where the target attribute is an enumeration, what should the microflow return - string or enumeration object value? In the console dump above, the same field [MailCampus] is used several times to try to set associations through different microflows. Is this allowed? I am trying to do an import from the external database directly into my target object. The alternative I guess is to import into a temporary object with no associations, then to run a separate scheduled job to push tht data from this temporary object to my final entity. I'm trying to avoid this as the data volumes are quite large. Any advice would be appreciated. Edit: Does anyone have answers to these questions? Also Q4. How do you handle the mapping when the target attribute is a boolean? Return a string of True/true or False or false, or return a boolean value from the microflow?
asked
2 answers
1

The problem is probably that you are trying to import an password field.

I assume that your password attribute is of the type hashstring. (there should be a message further down the stacktrace which states that hashstring and binary are not supported)

When the first version of the db replication module was released the xas didn't support that hashstrings could be imported using the create/change batch. I don't now if it this is possible now, i'll have to check with R&D and see if there is a way to implement the possibility to import into an hashstring attribute.

1. When you are using a microflow to parse/format the value, the microflow can only alter the value from that column. It isn't possible to do anything with the object you are processing. So the microflow or java action should have one single primitive input parameter and a primitive output parameter. It doesn't matter if it's an association or an attribute because only the value is change to a different layout.

2. When you want to use an enumeration it depends. Are you using a microflow to process the value you could either return the enum value or a string with the name of your enum value. When you are using a Java action you should always return a string containing the Name of the enumartion.

3. Yes you can use a column from the external database as many times as you would like. The only restriction is on the use of an attribute, you can only map 1 column to a single attribute. But a single column can be mapped to any number of attributes.

answered
0

You have to write code that converts external constants (strings) to your enumeration (enum) unless you have exactly the same constants.

public class GenderParser implements IValueParser {

@Override
public Object parseValue( Object objValue )throws CoreException {
    try {
        String value = String.valueOf(objValue);
        if( value != null ) {
            value = value.trim();

            if (value.equals("M"))
                return Gender.Male.toString();
            else if (value.equals("F"))
                return Gender.Female.toString();
            else if (value.equals("U"))
                return Gender.Unknown.toString();
            else
                return null;
        }
    }
    catch (Exception e) {
        Core.getLogNode(this.getClass().getName()).error(e);
    }

    return null;
}

}

answered