Hi,

I need to define a repository that needs to work both in Oracle as well as MS-
Access.  Some jdbc datatypes like BLOB and CLOB in Oracle maps to LONGVARBINARY 
and LONGVARCHAR in access. Also, on some rare occasions I need to copy data 
between Access and Oracle. In one case the table names are different (the table 
represented by class "LLEAgency").  To overcome I defined the repository for 
Oracle data types and change them to access data types when required.  This 
method is on a class that extends Thread.

    public void makeAccessCompatible()
    {
        MetadataManager mdm = MetadataManager.getInstance();
        mdm.setEnablePerThreadChanges(true);
        DescriptorRepository dr = mdm.copyOfGlobalRepository();
        Iterator ir = dr.iterator();
        while(ir.hasNext())
        {
            ClassDescriptor cd = (ClassDescriptor) ir.next();
            if(cd.getClassNameOfObject().endsWith("LLEAgency"))
            {
                System.out.println(cd.getFullTableName());
                cd.setTableName("CODES_DEPARTMENTS");
            }
            FieldDescriptor[] flds = cd.getFieldDescriptions();
            for (int i = 0; i < flds.length; i++)
            {
                FieldDescriptor fd = flds[i];
                if (fd.getColumnType().toLowerCase().equals("blob"))
                {
                    fd.setColumnType("longvarbinary");
                }
                else if (fd.getColumnType().toLowerCase().equals("clob"))
                {
                    fd.setColumnType("longvarchar");
                }
            }
        }
        mdm.setDescriptor(dr);
    }

After executing this on one of the threads, I checked the repository on both 
the threads and they are exactly same, this is how I checked, compare the 
String returned from the 2 threads using

MetadataManager.getInstance().getRepository().toXML();

I have tried setting the

        MetadataManager.getInstance().setEnablePerThreadChanges(true);

at various points, including the application startup.  But still no luck.  
Looks like I am missing something very obvious here. When I get a 
copyofGlobalRepository, I assume I get a copy entire repository tree, with the 
Class, Field descriptors everything.  Am I still working with the same object 
references or differet objects/references? Can anyone please help me with this?

Thanks & Regards
Sridhar


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to