Oracle Error

Thread is closed for posting
2 posts, 0 answers
  1. Ajay
    Ajay avatar
    1 posts
    Member since:
    Jan 2015

    Posted 20 Oct 2015 Link to this post

    I am getting the error:

    ORA-00942: table or view does not exist Telerik.OpenAccess.RT.sql.SQLException: ORA-00942: table or view does not exist ---> Oracle.DataAccess.Client.OracleException: ORA-00942: table or view does not exist

     I have a Fund table which has a one to many relationship with a FundRecord table:

    My Fund poco object is like:

        public class Fund

            public Fund()
                FundRecords = new List<FundRecord>();

            public int Id { get; set; }
            public int FundManagerId { get; set; }
            public string Name { get; set; }
            public DateTime CreatedOn { get; set; }
            public string CreatedBy { get; set; }
            public IList<FundRecord> FundRecords { get; set; }


    And my Fund Record: 

         public class FundRecord

            public int Id { get; set; }
            public int FundId { get; set; }
            public decimal MaxExposure { get; set; }
            public int Tier { get; set; }
            public int SupplierRisk { get; set; }
            public decimal SupplierFlowExposure { get; set; }
            public decimal MaxSupplierExposure { get; set; }
            public decimal IndividualSupplierExposure { get; set; }
            public DateTime StartDate { get; set; }
            public DateTime EndDate { get; set; }
            public bool IsCurrent { get; set; }
            public string CreatedBy { get; set; }
            public Fund Fund { get; set; }


    I am mapping using:

     protected override IList<MappingConfiguration> PrepareMapping()
                List<MappingConfiguration> configurations = new List<MappingConfiguration>();

                var fundMapping = new MappingConfiguration<Fund>();
                fundMapping.MapType(fund => new
                    Id = fund.Id,
                    FundManagerId = fund.FundManagerId,
                    Name = fund.Name,
                    CreatedOn = fund.CreatedOn,
                    CreatedBy = fund.CreatedBy,
                fundMapping.HasProperty(c => c.Id).IsIdentity();
                var fundRecordMapping = new MappingConfiguration<FundRecord>();
                fundRecordMapping.MapType(fundRecord => new
                    Id = fundRecord.Id,
                    FundId = fundRecord.FundId,
                    MaxExposure = fundRecord.MaxExposure,
                    Tier = fundRecord.Tier,
                    SupplierRisk = fundRecord.SupplierRisk,
                    SupplierFlowExposure = fundRecord.SupplierFlowExposure,
                    MaxSupplierExposure = fundRecord.MaxSupplierExposure,
                    IndividualSupplierExposure = fundRecord.IndividualSupplierExposure,
                    StartDate = fundRecord.StartDate,
                    EndDate = fundRecord.EndDate,
                    IsCurrent = fundRecord.IsCurrent,
                    CreatedBy = fundRecord.CreatedBy,
                fundMapping.HasProperty(c => c.Id).IsIdentity();

              fundMapping.HasAssociation(x => x.FundRecords).WithOpposite(y => y.Fund).HasConstraint((x, y) => x.Id == y.FundId);


                return configurations;


    The FluentModel is:

     public class FluentModel : OpenAccessContext
            private static readonly string connectionStringName = @"Connection";

            private static readonly BackendConfiguration backend = GetBackendConfiguration();

            private static readonly MetadataSource metadataSource = new FluentModelMetadataSource();

            public FluentModel()
                : base(connectionStringName, backend, metadataSource)

            public IQueryable<Fund> Funds
                get { return GetAll<Fund>(); }

            public IQueryable<FundRecord> FundRecords
                get { return GetAll<FundRecord>(); }

            protected override void OnDatabaseOpen(BackendConfiguration backendConfiguration, MetadataContainer metadataContainer)
                metadataContainer.DefaultMapping.InheritanceStrategy = InheritanceStrategy.Horizontal;
                metadataContainer.DefaultMapping.UseDelimitedSQL = false;

                base.OnDatabaseOpen(backendConfiguration, metadataContainer);

            public static BackendConfiguration GetBackendConfiguration()
                var backend = new BackendConfiguration();
                backend.Backend = "Oracle";
                backend.ProviderName = "Oracle.ManagedDataAccess.Client";
                backend.ConnectionPool.InitSQL.Add("ALTER SESSION SET CURRENT_SCHEMA=GENESIS_ALLOCATION");

                return backend;


    I am not sure why I am getting this issue so any help would be very helpful.

     Many thanks


  2. Ralph Waldenmaier
    Ralph Waldenmaier avatar
    202 posts

    Posted 21 Oct 2015 Link to this post

    Hi Ajay,
    Thank you for providing your details.
    Such errors can occur if you either have no rights to access the respective table or the table is located in a different schema. What you can do to diagnose this is setting the log level for you application to All by overriding the OnDatabaseOpen method of your context as shown in the following snippet.

    protected override void OnDatabaseOpen(BackendConfiguration backendConfiguration, MetadataContainer currentMetadataContainer, MetadataContainer aggregatedMetadataContainer)
        backendConfiguration.Logging.LogEvents = LoggingLevel.All;
        backendConfiguration.Logging.LogEventsToTrace = true;
        base.OnDatabaseOpen(backendConfiguration, currentMetadataContainer, aggregatedMetadataContainer);

    This allows you to see what sql statements are generated against your database. Please check that you have the appropriate rights to access the table and check if potential synonyms are missing.

    Another thing to investigate is the exception message. Which table is reported to be missing. Is it the one referenced from your configuration?

    Hope this helps.
    Feel free to ask in case you have any other question.

    Ralph Waldenmaier
    Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.

Back to Top