Posts:
Julius has not published any posts yet.
Replies:

First, the suggestion of Victor Gordillo  is correct.

do ##class(Some.Class).%BuildIndices()

solves most index related problems.

Second, there are a couple of things, we do not know, but you
- did you made an in-place-upgrade or a clean install + data transfer
- the class in question is the same on IRIS and Cache (i.e. no change was made)
- is the class re-compiled (on IRIS)
- what do you exactly mean when you say "Not opening an instance...": (1) you get an NULL-OREF or (2) you get an error
- what do you provide as a NULL value: (1) "", (2) $c(0), (3) " " or something else as open parameter

A shortened class definition (we don't need the whole definition) would be also helpfull, something like this

Class Problem.Class extends %Persistent
{
Property Field1 as %String;
Property Filed2 As %String;

Index composite on (Field1, Field2) [ Unique];
}

Some comments to %New() and %OpenId() methods.  A simple

set obj=##class(Some.Class).%New()

succeeds (in general) always. On the other hand, for

set obj=##class(Some.Class).%OpenId(rowId)

there are several reasons, not to succeed:
- the given rowId does not exists
- when data is stored in multiple nodes and the rowId is locked
- the internal storage structure is damaged (setting the data global by hand, improper changing the storage structure, etc.)

Hence, the correct modus operandi is

set obj=##class(Some.Class).%OpenId(rowId)
if 'obj do $system.OBJ.DisplayError() quit

// from here on, you can use the opened object

As Mr Cemper suggested, you could run an SQL select to find out the existing rowIds or alternatively, you could do a check before opening the object

if ##class(Some.Class).%ExistsId(rowId) { write rowId," exists" } else { write rowId," unknown" }

If your serial class is named Data.Serial (as in your example code) then you should use the same name for the serial property too

Class Data.Persistent Extends %Persistent
{
Property MPID as %Integer;
Property Name as Data.Serial;   <--- !!!!!
}

The correct way to set the values

Set Obj=##Class(Data.Persistent).%New()
Set Obj.MPID=MPID
Set Obj.Name.FirstName=FirstName   ; <----
Set Obj.Name.LastName=LastName     ; <----
Set tSC=Obj.%Save()
Followers:
Following:
Julius has not followed anybody yet.
Global Masters badges: