I have a DB with some tables that have unusual name casing. In many cases, the names look great for using AS_IS such as "AddedTimestamp" or "HostName", but the schema designers decided that anything in the set of tables related to the object system should be named "objSystem*". So there is a table named "objSystem" as well as "objSystemCategory", and in the "objSystem" table, there is a field called "objSystemCategory_Id".
I started with a field mapping like this:
<field>
<expression>^(.*)$</expression>
<fieldMember>
<transform>LOWER</transform>
</fieldMember>
<fieldSetter>
<transform>AS_IS</transform>
<expression>set$1</expression>
</fieldSetter>
<fieldGetter>
<transform>AS_IS</transform>
<expression>get$1</expression>
</fieldGetter>
</field>
It works well for all the easy cases, but it ended up with getters and setters like "getobjSystemCategory_Id".
I tried to fix that by adding a special case for fields that start with a lower case o:
<field>
<expression>^o(.*)$</expression>
<fieldMember>
<transform>LOWER</transform>
</fieldMember>
<fieldSetter>
<transform>AS_IS</transform>
<expression>setO$1</expression>
</fieldSetter>
<fieldGetter>
<transform>AS_IS</transform>
<expression>getO$1</expression>
</fieldGetter>
</field>
But something odd happened here. Suddenly all my members and accessors had the prefix "objsystem_". For example, "objsystem_HostName", "getObjsystem_HostName", and "setObjsystem_objSystemCategory_Id".
It seems that if the first part of the expression explicitly matches the table name, then the table name is part of the capture, but if the expression doesn't explicitly match, the table name is omitted?
I'm working around this behavior by capturing everything up to the first period and throwing it away, but it feels odd. Is this working as designed?
<field>
<expression>^(?:[^.]+\.)o(.*)$</expression>
<fieldMember>
<transform>LOWER</transform>
<expression>o$1</expression>
</fieldMember>
<fieldSetter>
<transform>AS_IS</transform>
<expression>setO$1</expression>
</fieldSetter>
<fieldGetter>
<transform>AS_IS</transform>
<expression>getO$1</expression>
</fieldGetter>
</field>
-Daniel