Unique index from base class doesn't work
Hi guys!
My student asked my why his unit tests don't work as they should, and I just could answer him. Here is the simplified case.
There is a class with a required unique property Name:
Class Test.NewClass [ Abstract ]
{
Property Name As %String [ Required ];
Index NameIndex On Name [ Unique ];
}
And there is an inherited class:
Class Test.NewClass1 Extends (%Persistent, Test.NewClass)
{
}
What I expect to happen, is when I save two objects of class Test.NewClass1
with the same value of property Name, for the second one to get an error stating that it violates the unique index.
set a = ##class(Test.NewClass1).%New()
set a.Name = "A1"
w a.%Save()
set a = ##class(Test.NewClass1).%New()
set a.Name = "A1"
w a.%Save()
Right now, it saves both objects without any problems. And there's no index global as well.
What is wrong with this picture and how do I explain why it doesn't work as one would expect?
Product version: IRIS 2022.1