Search found 34 matches

by bmarotta
Tue 31 Jan 2017 18:21
Forum: dotConnect for Oracle
Topic: Random "Object reference not set to an instance of an object"
Replies: 1
Views: 1432

Random "Object reference not set to an instance of an object"

Hi,

Our application process thousands of "workflow steps" daily. We get the random and not reproducible error "System.NullReferenceException: Object reference not set to an instance of an object." on the SubmitChages. This happens just after deleting an object from the database. The "funny" thing is that in 100% percent of the cases retrying the exact same code afterwards works. Below follows the last command executed and the callstack of the error. We are using Devart version 8.5.464.

I've looked in your forum and it seems that there are some entries regarding Null Exception on SubmitChanges but none of them with such a call stack.

Code: Select all

DELETE FROM PUMA_WORKFLOW_INSTANCE WHERE ID = :key1
-- key1: Input Number (Size = 0; DbType = Decimal) [17351571]
-- Context: Devart.Data.Oracle.Linq.Provider.OracleDataProvider Mapping: AttributeMappingSource Build: 4.5.802.0

2017-01-31 17:25:52,678 ERROR Exception caught on WorkflowEnd: Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
   at xget__Id_955(Workflow )
   at Devart.Data.Linq.Mapping.Accessors.d.Accessor`2.GetValue(T instance)
   at Devart.Data.Linq.Mapping.Accessors.MetaAccessor`2.GetBoxedValue(Object instance)
   at Devart.Data.Linq.Engine.b2.c.c()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Devart.Data.Linq.Engine.c4.i(IObjectEntry A_0)
   at Devart.Data.Linq.Engine.c4.l()
   at Devart.Data.Linq.Engine.c4.j()
   at Devart.Data.Linq.Engine.b3.a(ConflictMode A_0)
   at Devart.Data.Linq.DataContext.SubmitChanges(ConflictMode failureMode)
(...)
Best regards,
by bmarotta
Wed 23 Sep 2015 10:54
Forum: dotConnect for Oracle
Topic: Using sequences and sorting of the entities creation in one transaction
Replies: 1
Views: 905

Using sequences and sorting of the entities creation in one transaction

Dear supporters,

We have an ID column which is automatically populated by a sequence as below:

Code: Select all

[Column(Name = @"ID", Storage = "_Id", AutoSync = AutoSync.OnInsert, CanBeNull = false, DbType = "NUMBER(9) NOT NULL", IsDbGenerated = true, IsPrimaryKey = true)]
        [Devart.Data.Linq.Mapping.SequenceGenerator(Sequence = "SEQ_PUMA_WORKFLOW_EXECUTION")]
        public int Id
We are creating many entries of this entity in a row. For us is very important that if Entity A was created before entity B, the ID of entity A is smaller than the ID of entity B. Apparently when creating many entities this is not the case and it can be that the last created entity doesn't have the last sequence value.

Could you please confirm if this is the case?

If yes, is there any alternative to ensure that the sequence numbers obey the order that the entities where created in the code?

Thanks in advance.
by bmarotta
Fri 02 Mar 2012 10:44
Forum: dotConnect for Oracle
Topic: Implement RAC ourselves
Replies: 1
Views: 859

Implement RAC ourselves

Hi,

we are running Oracle on a RAC and using Direct Mode. Currently we have the problem that if the node we are connecting is not available, we have to manually config the ConnectionStrings in the configs and restart all our services.

We were thinking about having one connection string for each RAC server (currently 2) so that we can switch without having to change the configs. To implement this we have to first be able to identify if a node is alive and second do it always before opening a connection.

The problem is that the Devart Connection Pool is a black box. When using a Context, one never knows when the connection is open and if an error happens in the opening of the connection, it is already too late for switching the Connection String.

Would you have any suggestion how we can intelligently "ping" the servers to know which is the master one, before opening the connections and also without adding too much overhead to the DB communication?

Best regards,

Bruno Marotta
by bmarotta
Mon 28 Feb 2011 16:45
Forum: dotConnect for Oracle
Topic: ORA-01483: invalid length for DATE or NUMBER
Replies: 14
Views: 20875

Was this error fixed on the last build?
by bmarotta
Mon 21 Feb 2011 13:26
Forum: dotConnect for Oracle
Topic: Specified method is not supported - Extension Method
Replies: 4
Views: 3042

Hi,

would it be possible to extend this error message to output the method which caused the problem?

In the example:

Specified method "Current" is not supported.

It will make easier for the developers to Identify where the error is.

Thanks,
by bmarotta
Fri 18 Feb 2011 18:52
Forum: dotConnect for Oracle
Topic: New LoadWith bug on version 6.10
Replies: 8
Views: 1372

Hi Stanislav,

of course the results come unordered.

But you have to fix it on the Devart engine. If you are doing optimizations to get the whole results in only one query, you have to handle it correctly. Either you add the order by, or you make the parsing of the results smart enough to handle the unordered set.
by bmarotta
Fri 18 Feb 2011 07:53
Forum: dotConnect for Oracle
Topic: ORA-01483: invalid length for DATE or NUMBER
Replies: 14
Views: 20875

Finally you believed in me!

You owe me a beer :D
by bmarotta
Tue 15 Feb 2011 12:25
Forum: dotConnect for Oracle
Topic: ORA-01483: invalid length for DATE or NUMBER
Replies: 14
Views: 20875

Here it follows. Just create the table and import it to the LinqConnect model. Run the application. The last query will throw the exception

Code: Select all

using System;
using System.Linq;
using Devart.Data.Oracle;

/* DB Scripts
 
create table PUMA_TEST_UNICODE
(
 id number(9) Primary Key,
 name varchar2(50) not null,
 uname nvarchar2(50) not null,
 dt date not null,
 i number(9) default 0 not null 
);

insert into PUMA_TEST_UNICODE VALUES (1, 'Name1', 'Name1', sysdate, 1);
insert into PUMA_TEST_UNICODE VALUES (2, 'Name2', 'Name2', sysdate, 1);
insert into PUMA_TEST_UNICODE VALUES (3, 'Name3', 'Name3', sysdate, 1);
insert into PUMA_TEST_UNICODE VALUES (4, 'Name4', 'Name4', sysdate, 1);
insert into PUMA_TEST_UNICODE VALUES (5, 'Name5', 'Name5', sysdate, 1);
commit;

*/

namespace TestUnicode
{
    class Program
    {
        static void Main(string[] args)
        {
            string connString = ""; // Your connection string here

            var sb = new OracleConnectionStringBuilder(connString)
                         {
                             Password = "" // Set your password here
                         };
            connString = sb.ToString();

            // The error occurs with and without the Unicode=True
            using (var ctx = new DataContext1(connString /*+ ";Unicode=True"*/))
            {
                ctx.Log = Console.Out;
                var cnt =
                    ctx.PumaTestUnicodes.Where(n => n.Name == "Name1" && n.I == 1).Count();
                if (cnt != 1)
                    throw new Exception("Error 1");

                cnt =
                    ctx.PumaTestUnicodes.Where(n => n.I == 1 && n.Uname == "Name1").Count();
                if (cnt != 1)
                    throw new Exception("Error 2");

                cnt =
                    ctx.PumaTestUnicodes.Where(n => n.Uname == "Name1" && n.I == 1).Count();
                if (cnt != 1)
                    throw new Exception("Error 3");
            }
        }
    }
}
by bmarotta
Thu 10 Feb 2011 22:04
Forum: dotConnect for Oracle
Topic: New LoadWith bug on version 6.10
Replies: 8
Views: 1372

Did you ve fixed this on the new version?
by bmarotta
Thu 10 Feb 2011 22:00
Forum: dotConnect for Oracle
Topic: ORA-01483: invalid length for DATE or NUMBER
Replies: 14
Views: 20875

Hi,

I think you are missing the point. The problem is when there is Unicode a parameter followed by another parameter. Anyway, here follows the answers:

1) Yes, there are triggers on it:

Code: Select all

create or replace trigger "TR_AIU_PUMA_WORKFLOW_EXECUTION"
  after insert or update on puma_workflow_execution
  for each row
begin
  if (:new.status_id  :old.status_id or :new.processing_server  :old.processing_server) then
    insert into puma_workflow_execution_log
      (workflow_execution_id, log_datetime, old_status, new_status, processing_server, comments)
    values
      (:New.Id, systimestamp, :OLD.Status_Id, :NEW.Status_Id, :NEW.Processing_Server, :NEW.Comments);
  end if;
end TR_AIU_PUMA_WORKFLOW_EXECUTION;

create or replace trigger "TR_BIU_PUMA_WORKFLOW_EXECUTION" 
  before insert or update on puma_workflow_execution
  for each row
begin
  if inserting and :New.ID is null then
      select seq_puma_workflow_execution.nextval into :New.ID from dual;
  end if;

  if :NEW.Modification_date is null then
    :NEW.Modification_date := SYSTIMESTAMP AT TIME ZONE 'UTC';
  end if;

  if :NEW.Workflow_Id is null or :NEW.Workflow_Id = 0 then
    select wi.definition_id, product_id, stateful_object_id
      into :NEW.Workflow_Id, :NEW.Product_Id, :NEW.Stateful_Object_Id
      from puma_workflow_instance wi
     where wi.id = :NEW.workflow_instance_id;
  end if;
end TR_BIU_PUMA_WORKFLOW_EXECUTION;

-- Log Table
create table PUMA_WORKFLOW_EXECUTION_LOG
(
  WORKFLOW_EXECUTION_ID NUMBER(9) not null,
  LOG_DATETIME          TIMESTAMP(6) not null,
  OLD_STATUS            NUMBER(9),
  NEW_STATUS            NUMBER(9) not null,
  PROCESSING_SERVER     NVARCHAR2(50),
  COMMENTS              NVARCHAR2(1024)
);
alter table PUMA_WORKFLOW_EXECUTION_LOG
  add constraint FK_PUMA_WORKFLOW_EXECUTION_LOG foreign key (WORKFLOW_EXECUTION_ID)
  references PUMA_WORKFLOW_EXECUTION (ID) on delete cascade;

2) NO. There is no relationship at all. They are completely independent entities. Both tables uses NVARCHAR and here lies the problem!

3) The definitions follows below. The Linq is hard to reproduce because it is dinamically built in many different calls.

Code: Select all

create table PUMA_PRODUCT_STATUS
(
  PRODUCT_ID   NUMBER not null,
  STATUS_GROUP NVARCHAR2(120) not null,
  STATUS_VALUE NVARCHAR2(120) not null,
  ID           NUMBER not null
);
alter table PUMA_PRODUCT_STATUS
  add constraint PUMA_PROD_ST_ID primary key (ID);
alter table PUMA_PRODUCT_STATUS
  add constraint PUMA_PROD_ST_UK unique (PRODUCT_ID, STATUS_GROUP);
alter table PUMA_PRODUCT_STATUS
  add constraint PUMA_PS_P_FK foreign key (PRODUCT_ID)
  references PUMA_PRODUCT (ID) on delete cascade;
create index IX_PUMA_PRODUCT_STATUS_GRP on PUMA_PRODUCT_STATUS (STATUS_GROUP)
create index IX_PUMA_PRODUCT_STATUS_PROD on PUMA_PRODUCT_STATUS (PRODUCT_ID);

-- Create table
create table PUMA_PRODUCT_DATA
(
  ID            NUMBER not null,
  PRODUCT_ID    NUMBER not null,
  VALUE_ID      NUMBER not null,
  VALUE_NUMBER1 NUMBER,
  VALUE_NUMBER2 NUMBER,
  VALUE_DATE1   DATE,
  VALUE_DATE2   DATE,
  VALUE_TEXT    NVARCHAR2(500),
  MASTER_ID     NUMBER
);

alter table PUMA_PRODUCT_DATA
  add constraint PUMA_PRODUCT_DATA_PK primary key (ID);
alter table PUMA_PRODUCT_DATA
  add constraint FK_PUMA_PRODUCT_DATA_MASTER foreign key (MASTER_ID)
  references PUMA_PRODUCT_DATA (ID) on delete cascade;
alter table PUMA_PRODUCT_DATA
  add constraint PUMA_PRODUCT_META_P_DATA_FK foreign key (VALUE_ID)
  references PUMA_PRODUCT_META_DATA (ID) on delete cascade;
alter table PUMA_PRODUCT_DATA
  add constraint PUMA_PRODUCT_PRODUCT_DATA_FK foreign key (PRODUCT_ID)
  references PUMA_PRODUCT (ID) on delete cascade;
create index IX_PUMA_PRODUCT_DATA_MASTER on PUMA_PRODUCT_DATA (MASTER_ID);
create index IX_PUMA_PRODUCT_DATA_PROD on PUMA_PRODUCT_DATA (PRODUCT_ID);
create index IX_PUMA_PRODUCT_DATA_TXT on PUMA_PRODUCT_DATA (VALUE_TEXT);
create index IX_PUMA_PRODUCT_DATA_VALUE on PUMA_PRODUCT_DATA (VALUE_ID);
4) Yes, the error is ORA-01483
by bmarotta
Thu 10 Feb 2011 09:14
Forum: dotConnect for Oracle
Topic: Bug on Query method using select count(*)
Replies: 2
Views: 976

Bug on Query method using select count(*)

Happened on vrs 5.70

Code: Select all

int i = context.Query(string.Format("select count(*) from USER_SYS_PRIVS where privilege = '{0}'", privilegeName)).FirstOrDefault();
Error

Devart.Data.Linq.LinqCommandExecutionException: Error on executing DbCommand. ---> Devart.Data.Oracle.OracleException: ORA-00904: "T2"."c1": invalid identifier


Generated query:

Code: Select all

SELECT t1."c1"
FROM (
    SELECT t2."c1", ROWNUM AS "rnum"
    FROM (
        select count(*) from USER_SYS_PRIVS where privilege = 'CHANGE NOTIFICATION'
        ) t2
    ) t1
WHERE t1."rnum" <= 1
c1 identifier is missing...
by bmarotta
Wed 09 Feb 2011 10:55
Forum: dotConnect for Oracle
Topic: ORA-01483: invalid length for DATE or NUMBER
Replies: 14
Views: 20875

Hi,

here follows the information asked:

Application info:
ClientCharacterSet | US7ASCII
Currency | $
DateFormat | fmMMfm/fmDDfm/YYYY
DateLanguage | AMERICAN
DualCurrency | $
ISOCurrency | AMERICA
Language | AMERICAN
NCharConversionException | True
NumericCharacters | .,
Territory | AMERICA
TimeStampFormat | fmMMfm/fmDDfm/YYYY fmHH12fm:MI:SS AM
TimeStampTZFormat | fmMMfm/fmDDfm/YYYY fmHH12fm:MI:SS AM TZH:TZM
TimeZone | +01:00

Session info:
ClientCharacterSet |
Currency | ?
DateFormat | DD-MON-YYYY
DateLanguage | AMERICAN
DualCurrency | ?
ISOCurrency | GERMANY
Language | AMERICAN
NCharConversionException | False
NumericCharacters | ,.
Territory | GERMANY
TimeStampFormat | DD.MM.RR HH24:MI:SSXFF
TimeStampTZFormat | DD.MM.RR HH24:MI:SSXFF TZR
TimeZone | +00:00

To workaround the problem, I changed in the model the StatusGroup and StatusValue properties from NVARCHAR(360) NOT NULL to VARCHAR(360) NOT NULL.


More over, the below query DOES NOT raise the exception:

Code: Select all

SELECT t1.PRODUCT_ID, t1.WKN, t1.ISIN, t1.PRODUCTNAME, t1.PRODUCT_TYPE, t1.ISSUANCE_TYPE, t1.CURRENCY, t1.UNDERLYING_ID, t1.COUNTRY_CODE, t1.TradingCode AS "TradingCode"
FROM VW_PUMA_PRODUCT_BASICS t1
INNER JOIN (PUMA_PRODUCT t2
    INNER JOIN (
        SELECT DISTINCT t4.PRODUCT_ID AS "ProductId"
        FROM PUMA_PRODUCT_DATA t4
        INNER JOIN PUMA_PRODUCT_STATUS t5 ON t4.PRODUCT_ID = t5.PRODUCT_ID
        WHERE (t4.VALUE_DATE1 > :p0) AND (t4.VALUE_ID = :p1) AND (t5.STATUS_GROUP = :p2) AND (t5.STATUS_VALUE = :p3)
        ) t3 ON t2.ID = t3."ProductId") ON t1.PRODUCT_ID = t2.ID
ORDER BY t1.PRODUCTNAME
-- p0: Input Date (Size = 0; DbType = DateTime) [2/9/2011 12:00:00 AM]
-- p1: Input Number (Size = 0; DbType = Decimal) [2]
-- p2: Input NVarChar (Size = 22; DbType = String) [LaP1.A01.1 Draft Check]
-- p3: Input NVarChar (Size = 18; DbType = String) [Initialize Product]
-- Context: Devart.Data.Oracle.Linq.Provider.OracleDataProvider Model: am Build: 1.0.43.0


The below one DOES:

Code: Select all

SELECT t1.PRODUCT_ID, t1.WKN, t1.ISIN, t1.PRODUCTNAME, t1.PRODUCT_TYPE, t1.ISSUANCE_TYPE, t1.CURRENCY, t1.UNDERLYING_ID, t1.COUNTRY_CODE, t1.TradingCode AS "TradingCode"
FROM VW_PUMA_PRODUCT_BASICS t1
INNER JOIN (PUMA_PRODUCT t2
    INNER JOIN (
        SELECT DISTINCT t4.PRODUCT_ID AS "ProductId"
        FROM PUMA_PRODUCT_STATUS t4
        INNER JOIN PUMA_PRODUCT_DATA t5 ON t4.PRODUCT_ID = t5.PRODUCT_ID
        WHERE (t4.STATUS_GROUP = :p0) AND (t4.STATUS_VALUE = :p1) AND (t5.VALUE_DATE1 > :p2) AND (t5.VALUE_ID = :p3)
        ) t3 ON t2.ID = t3."ProductId") ON t1.PRODUCT_ID = t2.ID
ORDER BY t1.PRODUCTNAME
-- p0: Input NVarChar (Size = 22; DbType = String) [LaP1.A01.1 Draft Check]
-- p1: Input NVarChar (Size = 18; DbType = String) [Initialize Product]
-- p2: Input Date (Size = 0; DbType = DateTime) [2/9/2011 12:00:00 AM]
-- p3: Input Number (Size = 0; DbType = Decimal) [2]
-- Context: Devart.Data.Oracle.Linq.Provider.OracleDataProvider Model: am Build: 1.0.43.0
The error only happens on Direct Mode. Not on OCI mode.

It doesn't really looks like to be bound with the date format itself but with Unicode mode. We are currently using version 5.70.190, but the error occurs also on vrs 6.10.96
by bmarotta
Wed 02 Feb 2011 20:49
Forum: dotConnect for Oracle
Topic: ORA-01483: invalid length for DATE or NUMBER
Replies: 14
Views: 20875

Server Components
Component
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for Solaris: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production



NLS Database Parameters

Parameter Value
NLS_CALENDAR GREGORIAN
NLS_CHARACTERSET WE8ISO8859P1
NLS_COMP BINARY
NLS_CURRENCY ?
NLS_DATE_FORMAT DD-MON-YYYY
NLS_DATE_LANGUAGE AMERICAN
NLS_DUAL_CURRENCY ?
NLS_ISO_CURRENCY GERMANY
NLS_LANGUAGE AMERICAN
NLS_LENGTH_SEMANTICS BYTE
NLS_NCHAR_CHARACTERSET UTF8
NLS_NCHAR_CONV_EXCP FALSE
NLS_NUMERIC_CHARACTERS ,.
NLS_RDBMS_VERSION 10.2.0.4.0
NLS_SORT BINARY
NLS_TERRITORY GERMANY
NLS_TIMESTAMP_FORMAT DD.MM.RR HH24:MI:SSXFF
NLS_TIMESTAMP_TZ_FORMAT DD.MM.RR HH24:MI:SSXFF TZR
NLS_TIME_FORMAT HH24:MI:SSXFF
NLS_TIME_TZ_FORMAT HH24:MI:SSXFF TZR


Original content
Id = 123456 (no matter what PK)
Status_Id = 1
Processing_Server = null


Regional Settings
English (United States)

Location
Germany

PK = Id
by bmarotta
Wed 02 Feb 2011 20:42
Forum: dotConnect for Oracle
Topic: ORA-01400: cannot insert NULL
Replies: 3
Views: 3880

The problem is reproducible on 6.10

The entity is filled in more than one function, but basically we are doing something like this:

Code: Select all

entity = new PumaWorkflowExecution();
entity.Id = NextSequenceNumber();
context.PumaWorkflowExecutions.InsertOnSubmit(entity);
FillDataObject(entity);
context.SubmitChanges();
The correct implementation is done on the methods

Code: Select all

class BaseClass
{
...
        public virtual T Save(Data.PumaDataContext context)
        {
            bool found = true;
            T entity = GetDataObjectById(context);
            if (entity == null)
            {
                if (Id == 0)
                    Id = GetNextSequenceNumber();
                entity = new T();
                (entity as IUniqueIdentified).Id = Id; // Must add the Id here to avoid error on the InsertOnSubmit
                found = false;
            }

            if (!found)
                GetStorage(context).InsertOnSubmit(entity);

            FillDataObject(context, entity);

            return entity;
        }

        protected virtual void FillDataObject(Data.PumaDataContext context, T entity)
        {
            entity.Id = this.Id;
        }
}

class WorkflowExecution: BaseClass
{
...
        protected override void FillDataObject(Data.PumaDataContext context, Data.WorkflowExecution entity)
        {
            if (WorkflowInstanceId == null && WorkflowId == null)
                throw new Exception("Either the workflow instance id or the workflow identifier must be filled");
            base.FillDataObject(context, entity);
            entity.WorkflowInstanceId = WorkflowInstanceId;
            entity.StateSequence = StateSequence;
            entity.TaskSequence = TaskSequence;
            entity.ActionSequence = ActionSequence;
            entity.Finished = Finished;
            entity.StatusId = (int)Status;
            entity.ProcessingServer = ProcessingServer;
            entity.ModificationDate = ModificationDate;
            entity.Comments = Comments.Truncate(4000);
            entity.PredecessorId = PredecessorId;
            entity.ParentId = ParentId;
            if (WorkflowId.HasValue)
                entity.WorkflowId = WorkflowId.Value;
            entity.ProductId = ProductId;
            entity.StatefulObjectId = StatefulObjectId;
            entity.RetryCount = RetryCount;
            entity.SophisUserId = SophisUserId;
            entity.ChildProductId = ChildProductId;
        }
...
}
by bmarotta
Wed 02 Feb 2011 20:25
Forum: dotConnect for Oracle
Topic: New LoadWith bug on version 6.10
Replies: 8
Views: 1372

New LoadWith bug on version 6.10

Hi,

There is a new bug on the version 6.10 not found on version 5.70.

If you have a Master/Detail table and you use the LoadWith, the correct values are not grabbed.

Something like this will throw an exception:

Code: Select all

var dictionary = new Dictionary();
foreach (var m in context.Masters.LoadWith(n => n.Detail))
  dictionary.Add(m.Id, m);
For some reason the Id comes more than once. This happened in, at least, two parts of the code, so it is not really linked to the table structure. I am sure that on the DB, the Id does not happen more than once as it is the PK of the table.

As an example, this is the query generated by Devart

Code: Select all

SELECT t1.ID, t1.NAME, t1.KIND_ID, t2.ID AS ID1, t2.STATUS_ID, t2.VALUE, t2.ORDER_SEQUENCE
FROM PUMA_STATUS_DEFINITION t1
LEFT OUTER JOIN PUMA_STATUS_VALUE_DEFINITION t2 ON t1.ID = t2.STATUS_ID
-- Context: Devart.Data.Oracle.Linq.Provider.OracleDataProvider Model: ao Build: 2.20.11.0
For us this is a show stopper, as we cannot replace these cases all over the code.