Showing posts with label Unique. Show all posts
Showing posts with label Unique. Show all posts

Hidden Concepts of ATG Repository- Part 2

2. Required , Unique and Default Properties

Scenario 1: You have property of Item, that is must required for creating Item.From DataBase perspective, you have column which cannot be null and requires user entered value.

Solution 1: Use the attribute required=true at property level.

           <property name="mustNeeded" data-type="string" required="true" />

Dont's:
  • If DataBase defines NOT NULL constraint to column, then required attribute must be set to "true". Vice-versa is not always true, if you are not manually entering the data in DataBase.In other words, even if the NOT NULL constraint is not defined, it would still go good.
  • If Property reference to other Item, you can only set required="true" at repository level, but donot add constraint NOT NULL to column in DataBase.(Reason: During Deployments, BCC writes row without reference properties first and then Updates the same row with properties with referenced properties.)
  • Donot add required attribute to collection properties. like, data-type="set". Its not supported by ATG.