Mapping Legacy Data
 
CapableObjects Forums
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        



Mapping Legacy Data Expand / Collapse
Author
Message
Posted 2010-07-24 19:05:45
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: Yesterday @ 00:45:16
Posts: 7, Visits: 60
I am trying to map to existing Oracle tables (read only) for an ECO application where I can use the same oracle database to host the ECO managed tables.

I have tried reverse engineering without success
ECO_ID added to the classes
quotes around table names
some classes have attributes and others don't after reverse engineering

I could try to make a custom mapping file, but I want the majority of my classes to be ECO managed

Has anyone been successful with this?
Any Strategy suggestions?


Post #5417
Posted 2010-07-26 13:08:56


Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: Today @ 13:14:34
Posts: 459, Visits: 1 103
What failed?

/mtiede
Environment:
Windows 7 Ultimate 64 bit
Delphi 6
Rad Studio 2010 Enterprise with Prism 2011
Post #5418
Posted 2010-07-27 22:49:19
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: Yesterday @ 00:45:16
Posts: 7, Visits: 60

The program is Just a form with a ECO debugger button

Here is the runtime error:

Error executing query: ORA-00942: table or view does not exist
 
SQL: SELECT EMP_A.ECO_ID FROM "EMP" EMP_A

Note from the mapping file below:

  1. The table and field names are quoted
  2. ECO_ID has been added to each table (not in the legacy tables)
  3. the class WipEntities has no attributes (probably because it did not have a primary key)

I read the "How to" on custom mapping files, but If i created one for the legacy tables I need to access, I would not know how to continue to create ECO managed classes, make any needed associations to the legacy classes (without embedding anything into the legacy classes because I cannot change those tables), and be able to generate/evolve the schema for the new ECO managed classes

Is the schema evolution process the same as in ECOIII?

If I make a custom mapping file can I save it to the database and will it keep and not change back, such as adding ECO_ID back in?

Are there any properties I should be setting in the modlr which mark the legacy classes as legacy or custom mapped?

Here is the mapping file generated

<?xml version="1.0" encoding="utf-8"?>

<ORMapping>

<ClassDef Name="Sysitems" SuperClass="ECOModelRoot">

<AliasDef Name="SYSITEMS_A" Table="&quot;SYSITEMS&quot;" ExtentRequiresDiscriminator="False">

<KeyImpl Name="EcoKey">

<KeyColumn Name="ECO_ID" />

</KeyImpl>

</AliasDef>

<AttributeDef Name="Description" Alias="SYSITEMS_A" Columns="&quot;DESCRIPTION&quot;" AttributeMapper="&lt;Default&gt;" />

<AttributeDef Name="ItemId" Alias="SYSITEMS_A" Columns="&quot;ITEM_ID&quot;" AttributeMapper="&lt;Default&gt;" />

<AttributeDef Name="Segment1" Alias="SYSITEMS_A" Columns="&quot;SEGMENT1&quot;" AttributeMapper="&lt;Default&gt;" />

<AttributeDef Name="OrganizationId" Alias="SYSITEMS_A" Columns="&quot;ORGANIZATION_ID&quot;" AttributeMapper="&lt;Default&gt;" />

</ClassDef>

<ClassDef Name="WipEntities" SuperClass="ECOModelRoot">

<AliasDef Name="WIP_ENTITIES_A" Table="&quot;WIP_ENTITIES&quot;" ExtentRequiresDiscriminator="False">

<KeyImpl Name="EcoKey">

<KeyColumn Name="ECO_ID" />

</KeyImpl>

</AliasDef>

</ClassDef>

<ClassDef Name="Dept" SuperClass="ECOModelRoot">

<AliasDef Name="DEPT_A" Table="&quot;DEPT&quot;" ExtentRequiresDiscriminator="False">

<KeyImpl Name="EcoKey">

<KeyColumn Name="ECO_ID" />

</KeyImpl>

</AliasDef>

<AttributeDef Name="Dname" Alias="DEPT_A" Columns="&quot;DNAME&quot;" AttributeMapper="&lt;Default&gt;" />

<AttributeDef Name="Deptno" Alias="DEPT_A" Columns="&quot;DEPTNO&quot;" AttributeMapper="&lt;Default&gt;" />

<AttributeDef Name="Loc" Alias="DEPT_A" Columns="&quot;LOC&quot;" AttributeMapper="&lt;Default&gt;" />

</ClassDef>

<ClassDef Name="Emp" SuperClass="ECOModelRoot">

<AliasDef Name="EMP_A" Table="&quot;EMP&quot;" ExtentRequiresDiscriminator="False">

<KeyImpl Name="EcoKey">

<KeyColumn Name="ECO_ID" />

</KeyImpl>

</AliasDef>

<AttributeDef Name="Comm" Alias="EMP_A" Columns="&quot;COMM&quot;" AttributeMapper="&lt;Default&gt;" />

<AttributeDef Name="Empno" Alias="EMP_A" Columns="&quot;EMPNO&quot;" AttributeMapper="&lt;Default&gt;" />

<AttributeDef Name="Mgr" Alias="EMP_A" Columns="&quot;MGR&quot;" AttributeMapper="&lt;Default&gt;" />

<AttributeDef Name="Sal" Alias="EMP_A" Columns="&quot;SAL&quot;" AttributeMapper="&lt;Default&gt;" />

<AttributeDef Name="Hiredate" Alias="EMP_A" Columns="&quot;HIREDATE&quot;" AttributeMapper="&lt;Default&gt;" />

<AttributeDef Name="Job" Alias="EMP_A" Columns="&quot;JOB&quot;" AttributeMapper="&lt;Default&gt;" />

<AttributeDef Name="Deptno" Alias="EMP_A" Columns="&quot;DEPTNO&quot;" AttributeMapper="&lt;Default&gt;" />

<AttributeDef Name="Ename" Alias="EMP_A" Columns="&quot;ENAME&quot;" AttributeMapper="&lt;Default&gt;" />

</ClassDef>

<ClassDef Name="EmpSnapshot" SuperClass="ECOModelRoot">

<AliasDef Name="EMP_SNAPSHOT_A" Table="&quot;EMP_SNAPSHOT&quot;" ExtentRequiresDiscriminator="False">

<KeyImpl Name="EcoKey">

<KeyColumn Name="ECO_ID" />

</KeyImpl>

</AliasDef>

<AttributeDef Name="Empno" Alias="EMP_SNAPSHOT_A" Columns="&quot;EMPNO&quot;" AttributeMapper="&lt;Default&gt;" />

<AttributeDef Name="Sal" Alias="EMP_SNAPSHOT_A" Columns="&quot;SAL&quot;" AttributeMapper="&lt;Default&gt;" />

<AttributeDef Name="Mgr" Alias="EMP_SNAPSHOT_A" Columns="&quot;MGR&quot;" AttributeMapper="&lt;Default&gt;" />

<AttributeDef Name="Comm" Alias="EMP_SNAPSHOT_A" Columns="&quot;COMM&quot;" AttributeMapper="&lt;Default&gt;" />

<AttributeDef Name="Job" Alias="EMP_SNAPSHOT_A" Columns="&quot;JOB&quot;" AttributeMapper="&lt;Default&gt;" />

<AttributeDef Name="Deptno" Alias="EMP_SNAPSHOT_A" Columns="&quot;DEPTNO&quot;" AttributeMapper="&lt;Default&gt;" />

<AttributeDef Name="Ename" Alias="EMP_SNAPSHOT_A" Columns="&quot;ENAME&quot;" AttributeMapper="&lt;Default&gt;" />

<AttributeDef Name="Hiredate" Alias="EMP_SNAPSHOT_A" Columns="&quot;HIREDATE&quot;" AttributeMapper="&lt;Default&gt;" />

</ClassDef>

<ClassDef Name="ECOModelRoot">

<KeyDef Name="EcoKey" Signature="System.Int32" IsId="True" KeyMapper="DefaultEcoIdMapper" />

</ClassDef>

<Database Name="">

<Table Name="&quot;DEPT&quot;">

<Column Name="ECO_ID" AllowNULL="False" Type="NUMBER(10,0)" Length="0" Scale="0" Precision="0" DefaultValue="" />

<Column Name="&quot;LOC&quot;" AllowNULL="True" Type="VARCHAR2(13)" Length="13" Scale="-1" Precision="-1" DefaultValue="''" />

<Column Name="&quot;DNAME&quot;" AllowNULL="True" Type="VARCHAR2(14)" Length="14" Scale="-1" Precision="-1" DefaultValue="''" />

<Column Name="&quot;DEPTNO&quot;" AllowNULL="False" Type="NUMBER" Length="255" Scale="-1" Precision="-1" DefaultValue="0" />

<Index Name="IX_PK_DEPT" Columns="ECO_ID" IsUnique="False" IsCaseSensitive="False" IsPrimary="True" IsDescending="False" />

</Table>

<Table Name="&quot;EMP&quot;">

<Column Name="ECO_ID" AllowNULL="False" Type="NUMBER(10,0)" Length="0" Scale="0" Precision="0" DefaultValue="" />

<Column Name="&quot;ENAME&quot;" AllowNULL="True" Type="VARCHAR2(10)" Length="10" Scale="-1" Precision="-1" DefaultValue="''" />

<Column Name="&quot;DEPTNO&quot;" AllowNULL="True" Type="NUMBER" Length="255" Scale="-1" Precision="-1" DefaultValue="0" />

<Column Name="&quot;JOB&quot;" AllowNULL="True" Type="VARCHAR2(9)" Length="9" Scale="-1" Precision="-1" DefaultValue="''" />

<Column Name="&quot;HIREDATE&quot;" AllowNULL="True" Type="DATE" Length="255" Scale="-1" Precision="-1" DefaultValue="" />

<Column Name="&quot;SAL&quot;" AllowNULL="True" Type="NUMBER" Length="255" Scale="-1" Precision="-1" DefaultValue="0" />

<Column Name="&quot;COMM&quot;" AllowNULL="True" Type="NUMBER" Length="255" Scale="-1" Precision="-1" DefaultValue="0" />

<Column Name="&quot;MGR&quot;" AllowNULL="True" Type="NUMBER" Length="255" Scale="-1" Precision="-1" DefaultValue="0" />

<Column Name="&quot;EMPNO&quot;" AllowNULL="False" Type="NUMBER" Length="255" Scale="-1" Precision="-1" DefaultValue="0" />

<Index Name="IX_PK_EMP" Columns="ECO_ID" IsUnique="False" IsCaseSensitive="False" IsPrimary="True" IsDescending="False" />

</Table>

<Table Name="&quot;EMP_SNAPSHOT&quot;">

<Column Name="ECO_ID" AllowNULL="False" Type="NUMBER(10,0)" Length="0" Scale="0" Precision="0" DefaultValue="" />

<Column Name="&quot;DEPTNO&quot;" AllowNULL="True" Type="NUMBER" Length="255" Scale="-1" Precision="-1" DefaultValue="0" />

<Column Name="&quot;COMM&quot;" AllowNULL="True" Type="NUMBER" Length="255" Scale="-1" Precision="-1" DefaultValue="0" />

<Column Name="&quot;MGR&quot;" AllowNULL="True" Type="NUMBER" Length="255" Scale="-1" Precision="-1" DefaultValue="0" />

<Column Name="&quot;JOB&quot;" AllowNULL="True" Type="VARCHAR2(9)" Length="9" Scale="-1" Precision="-1" DefaultValue="''" />

<Column Name="&quot;SAL&quot;" AllowNULL="True" Type="NUMBER" Length="255" Scale="-1" Precision="-1" DefaultValue="0" />

<Column Name="&quot;ENAME&quot;" AllowNULL="True" Type="VARCHAR2(10)" Length="10" Scale="-1" Precision="-1" DefaultValue="''" />

<Column Name="&quot;EMPNO&quot;" AllowNULL="False" Type="NUMBER" Length="255" Scale="-1" Precision="-1" DefaultValue="0" />

<Column Name="&quot;HIREDATE&quot;" AllowNULL="True" Type="DATE" Length="255" Scale="-1" Precision="-1" DefaultValue="" />

<Index Name="IX_PK_EMP_SNAPSHOT" Columns="ECO_ID" IsUnique="False" IsCaseSensitive="False" IsPrimary="True" IsDescending="False" />

</Table>

<Table Name="&quot;SYSITEMS&quot;">

<Column Name="ECO_ID" AllowNULL="False" Type="NUMBER(10,0)" Length="0" Scale="0" Precision="0" DefaultValue="" />

<Column Name="&quot;SEGMENT1&quot;" AllowNULL="True" Type="VARCHAR2(32)" Length="32" Scale="-1" Precision="-1" DefaultValue="''" />

<Column Name="&quot;ORGANIZATION_ID&quot;" AllowNULL="False" Type="NUMBER" Length="255" Scale="-1" Precision="-1" DefaultValue="0" />

<Column Name="&quot;DESCRIPTION&quot;" AllowNULL="True" Type="VARCHAR2(64)" Length="64" Scale="-1" Precision="-1" DefaultValue="''" />

<Column Name="&quot;ITEM_ID&quot;" AllowNULL="False" Type="NUMBER" Length="255" Scale="-1" Precision="-1" DefaultValue="0" />

<Index Name="IX_PK_SYSITEMS" Columns="ECO_ID" IsUnique="False" IsCaseSensitive="False" IsPrimary="True" IsDescending="False" />

</Table>

<Table Name="&quot;WIP_ENTITIES&quot;">

<Column Name="ECO_ID" AllowNULL="False" Type="NUMBER(10,0)" Length="0" Scale="0" Precision="0" DefaultValue="" />

<Index Name="IX_PK_WIP_ENTITIES" Columns="ECO_ID" IsUnique="False" IsCaseSensitive="False" IsPrimary="True" IsDescending="False" />

</Table>

</Database>

</ORMapping>

Post #5426
Posted 2010-07-29 13:36:47
Forum Guru

Forum GuruForum GuruForum GuruForum GuruForum GuruForum GuruForum GuruForum Guru

Group: Forum Members
Last Login: Yesterday @ 09:33:34
Posts: 55, Visits: 235
Generally you either reverse engineer the exist DB to create the model, use the model to create the BD. You seem to be trying to do both in one DB.

http://www.arena.net.au/CapableObjects/Eco5ByExampleAccessingLegacyData.pdf 

describes the process of Reverse Engineering an existing database in ECO5 with Visual Studio 2008 

You can use ECO to modify the existing DB after you have reverse engineered - but you have to be very careful - I have made some mistakes doing this that can were difficult to undo. 

You can have ECO access the old RevEng DB and a new ECO managed DB as well.

Regards 
Steve A



Steve A

Post #5432
Posted 2010-07-29 17:16:18
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: Yesterday @ 00:45:16
Posts: 7, Visits: 60
The link that you gave was my starting point.  However, there were a few things in the reverse engineering for oracle that required that I manually tweak the mapping to get it to work.  I now have a small mixed model working. 

My current procedure is as follows

  1. Create a model with at least one ECO managed class.
  2. Create the schema.
  3. Add a reverse engineered/legacy class
  4. Save XML mapping and set it as the runtime mapping.
  5. tweak it until you get good results using the ECO debugger
  6. Each time you need to change the model:
  7.     Save a new xml mapping
  8.     Cut and paste the sections of the old tweaked XML mapping back into the new mapping file
  9.     When you evolve the database, mappings that match between old and new will not cause any changes

Since I cannot change the structure, of the legacy tables in my system,  I will need to be careful about any associations that may want to imbed into the legacy tables.  Since multi-Multi associations make a separate association table ,  I think they may be safe.  Single associations that are only navigable in the direction towards the legacy data should also be OK.  Derived Associations are likely also safe.  I will be proceeding with care.

There may be properties I can change in the model, that would make the reverse engineered classes more compatible and take out some of the tweaking,  But I don't know what all of the possibilities are.

It would be nice of Classes could be marked as "Legacy", and A file mapping provider for only those classes merges the mapping with the rest of ECO managed classes.

Post #5434
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: HansKarlsen, Jonas Hogstrom

Permissions Expand / Collapse

All times are GMT +1:00, Time now is 8:11

Powered By InstantForum.NET v4.1.4 © 2010
Execution: 0,563. 10 queries. Compression Disabled.