|
|
|
Forum 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?
|
|
|
|
|
Supreme 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
|
|
|
|
|
Forum 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: - The table and field names are quoted
- ECO_ID has been added to each table (not in the legacy tables)
- 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=""SYSITEMS"" ExtentRequiresDiscriminator="False">< KeyImpl Name="EcoKey">< KeyColumn Name="ECO_ID" /></ KeyImpl></ AliasDef>< AttributeDef Name="Description" Alias="SYSITEMS_A" Columns=""DESCRIPTION"" AttributeMapper="<Default>" />< AttributeDef Name="ItemId" Alias="SYSITEMS_A" Columns=""ITEM_ID"" AttributeMapper="<Default>" />< AttributeDef Name="Segment1" Alias="SYSITEMS_A" Columns=""SEGMENT1"" AttributeMapper="<Default>" />< AttributeDef Name="OrganizationId" Alias="SYSITEMS_A" Columns=""ORGANIZATION_ID"" AttributeMapper="<Default>" /></ ClassDef>< ClassDef Name="WipEntities" SuperClass="ECOModelRoot">< AliasDef Name="WIP_ENTITIES_A" Table=""WIP_ENTITIES"" ExtentRequiresDiscriminator="False">< KeyImpl Name="EcoKey">< KeyColumn Name="ECO_ID" /></ KeyImpl></ AliasDef></ ClassDef>< ClassDef Name="Dept" SuperClass="ECOModelRoot">< AliasDef Name="DEPT_A" Table=""DEPT"" ExtentRequiresDiscriminator="False">< KeyImpl Name="EcoKey">< KeyColumn Name="ECO_ID" /></ KeyImpl></ AliasDef>< AttributeDef Name="Dname" Alias="DEPT_A" Columns=""DNAME"" AttributeMapper="<Default>" />< AttributeDef Name="Deptno" Alias="DEPT_A" Columns=""DEPTNO"" AttributeMapper="<Default>" />< AttributeDef Name="Loc" Alias="DEPT_A" Columns=""LOC"" AttributeMapper="<Default>" /></ ClassDef>< ClassDef Name="Emp" SuperClass="ECOModelRoot">< AliasDef Name="EMP_A" Table=""EMP"" ExtentRequiresDiscriminator="False">< KeyImpl Name="EcoKey">< KeyColumn Name="ECO_ID" /></ KeyImpl></ AliasDef>< AttributeDef Name="Comm" Alias="EMP_A" Columns=""COMM"" AttributeMapper="<Default>" />< AttributeDef Name="Empno" Alias="EMP_A" Columns=""EMPNO"" AttributeMapper="<Default>" />< AttributeDef Name="Mgr" Alias="EMP_A" Columns=""MGR"" AttributeMapper="<Default>" />< AttributeDef Name="Sal" Alias="EMP_A" Columns=""SAL"" AttributeMapper="<Default>" />< AttributeDef Name="Hiredate" Alias="EMP_A" Columns=""HIREDATE"" AttributeMapper="<Default>" />< AttributeDef Name="Job" Alias="EMP_A" Columns=""JOB"" AttributeMapper="<Default>" />< AttributeDef Name="Deptno" Alias="EMP_A" Columns=""DEPTNO"" AttributeMapper="<Default>" />< AttributeDef Name="Ename" Alias="EMP_A" Columns=""ENAME"" AttributeMapper="<Default>" /></ ClassDef>< ClassDef Name="EmpSnapshot" SuperClass="ECOModelRoot">< AliasDef Name="EMP_SNAPSHOT_A" Table=""EMP_SNAPSHOT"" ExtentRequiresDiscriminator="False">< KeyImpl Name="EcoKey">< KeyColumn Name="ECO_ID" /></ KeyImpl></ AliasDef>< AttributeDef Name="Empno" Alias="EMP_SNAPSHOT_A" Columns=""EMPNO"" AttributeMapper="<Default>" />< AttributeDef Name="Sal" Alias="EMP_SNAPSHOT_A" Columns=""SAL"" AttributeMapper="<Default>" />< AttributeDef Name="Mgr" Alias="EMP_SNAPSHOT_A" Columns=""MGR"" AttributeMapper="<Default>" />< AttributeDef Name="Comm" Alias="EMP_SNAPSHOT_A" Columns=""COMM"" AttributeMapper="<Default>" />< AttributeDef Name="Job" Alias="EMP_SNAPSHOT_A" Columns=""JOB"" AttributeMapper="<Default>" />< AttributeDef Name="Deptno" Alias="EMP_SNAPSHOT_A" Columns=""DEPTNO"" AttributeMapper="<Default>" />< AttributeDef Name="Ename" Alias="EMP_SNAPSHOT_A" Columns=""ENAME"" AttributeMapper="<Default>" />< AttributeDef Name="Hiredate" Alias="EMP_SNAPSHOT_A" Columns=""HIREDATE"" AttributeMapper="<Default>" /></ ClassDef>< ClassDef Name="ECOModelRoot">< KeyDef Name="EcoKey" Signature="System.Int32" IsId="True" KeyMapper="DefaultEcoIdMapper" /></ ClassDef>< Database Name="">< Table Name=""DEPT"">< Column Name="ECO_ID" AllowNULL="False" Type="NUMBER(10,0)" Length="0" Scale="0" Precision="0" DefaultValue="" />< Column Name=""LOC"" AllowNULL="True" Type="VARCHAR2(13)" Length="13" Scale="-1" Precision="-1" DefaultValue="''" />< Column Name=""DNAME"" AllowNULL="True" Type="VARCHAR2(14)" Length="14" Scale="-1" Precision="-1" DefaultValue="''" />< Column Name=""DEPTNO"" 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=""EMP"">< Column Name="ECO_ID" AllowNULL="False" Type="NUMBER(10,0)" Length="0" Scale="0" Precision="0" DefaultValue="" />< Column Name=""ENAME"" AllowNULL="True" Type="VARCHAR2(10)" Length="10" Scale="-1" Precision="-1" DefaultValue="''" />< Column Name=""DEPTNO"" AllowNULL="True" Type="NUMBER" Length="255" Scale="-1" Precision="-1" DefaultValue="0" />< Column Name=""JOB"" AllowNULL="True" Type="VARCHAR2(9)" Length="9" Scale="-1" Precision="-1" DefaultValue="''" />< Column Name=""HIREDATE"" AllowNULL="True" Type="DATE" Length="255" Scale="-1" Precision="-1" DefaultValue="" />< Column Name=""SAL"" AllowNULL="True" Type="NUMBER" Length="255" Scale="-1" Precision="-1" DefaultValue="0" />< Column Name=""COMM"" AllowNULL="True" Type="NUMBER" Length="255" Scale="-1" Precision="-1" DefaultValue="0" />< Column Name=""MGR"" AllowNULL="True" Type="NUMBER" Length="255" Scale="-1" Precision="-1" DefaultValue="0" />< Column Name=""EMPNO"" 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=""EMP_SNAPSHOT"">< Column Name="ECO_ID" AllowNULL="False" Type="NUMBER(10,0)" Length="0" Scale="0" Precision="0" DefaultValue="" />< Column Name=""DEPTNO"" AllowNULL="True" Type="NUMBER" Length="255" Scale="-1" Precision="-1" DefaultValue="0" />< Column Name=""COMM"" AllowNULL="True" Type="NUMBER" Length="255" Scale="-1" Precision="-1" DefaultValue="0" />< Column Name=""MGR"" AllowNULL="True" Type="NUMBER" Length="255" Scale="-1" Precision="-1" DefaultValue="0" />< Column Name=""JOB"" AllowNULL="True" Type="VARCHAR2(9)" Length="9" Scale="-1" Precision="-1" DefaultValue="''" />< Column Name=""SAL"" AllowNULL="True" Type="NUMBER" Length="255" Scale="-1" Precision="-1" DefaultValue="0" />< Column Name=""ENAME"" AllowNULL="True" Type="VARCHAR2(10)" Length="10" Scale="-1" Precision="-1" DefaultValue="''" />< Column Name=""EMPNO"" AllowNULL="False" Type="NUMBER" Length="255" Scale="-1" Precision="-1" DefaultValue="0" />< Column Name=""HIREDATE"" 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=""SYSITEMS"">< Column Name="ECO_ID" AllowNULL="False" Type="NUMBER(10,0)" Length="0" Scale="0" Precision="0" DefaultValue="" />< Column Name=""SEGMENT1"" AllowNULL="True" Type="VARCHAR2(32)" Length="32" Scale="-1" Precision="-1" DefaultValue="''" />< Column Name=""ORGANIZATION_ID"" AllowNULL="False" Type="NUMBER" Length="255" Scale="-1" Precision="-1" DefaultValue="0" />< Column Name=""DESCRIPTION"" AllowNULL="True" Type="VARCHAR2(64)" Length="64" Scale="-1" Precision="-1" DefaultValue="''" />< Column Name=""ITEM_ID"" 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=""WIP_ENTITIES"">< 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>
|
|
|
|
|
Forum 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
|
|
|
|
|
Forum 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 - Create a model with at least one ECO managed class.
- Create the schema.
- Add a reverse engineered/legacy class
- Save XML mapping and set it as the runtime mapping.
- tweak it until you get good results using the ECO debugger
- Each time you need to change the model:
- Save a new xml mapping
- Cut and paste the sections of the old tweaked XML mapping back into the new mapping file
- 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.
|
|
|
|