Error updating SeedData Field?


#1

I dont understand why I cant update a field on the VADNodeConfig type, I know I can update other SeedData types w/ the merge API. The only thing that seems strange is that the type def mixes in a Parametric type w/o actually specifying the parameter, ie it is:
entity type VADNodeConfig mixes SeedData …
when is should be
entity type VADNodeConfig mixes SeedData

Heres what I did:
VADNodeConfig.merge({“id”:“ariba”,“name”:“ariba node enabled”,“enabled”:true})

Here is the error:
{
“id” : “2630.98594”,
“codes” : [ “SeedField” ],
“key” : “c3.engine.database.DbException_validationErrors”,
“template” : “{}”,
“parameters” : [ “Write failed: Seed Data value can not be updated for field enabled in type VADNodeConfig” ]
}

Here is the type def:
entity type VADNodeConfig mixes SeedData schema name ‘VAD_ND_CFG’ {
/**

  • The id of the VADNodeConfig should be the same as the node classId that it corresponds to.
    */
    id: ~

/**

  • The name of the config.
    */
    name: !~

/**

  • Whether the node is enabled. Note that the logic in VAD effectively makes this false by default.
  • If a VADNodeConfig with enabled set to true does not exist for a given node, then that node will be hidden.
    */
    enabled: !boolean
    }

#2

This is the correct behavior. SeedData types are not user updatable by default. To make them user updatable you need to specify:

@seed(userUpdatable=true)

on either the type (makes all fields user updatable that don’t have userUpdatable set to false) or on individual fields if the entire type is not meant to be updatable.


#3

I see, thank you.

Is the type definition also correct? Specifically, do we not need to explicitly specify the Parameter in parametric type ‘SeedData’?


#4

You should define the parameter as the type mixing in SeedData. If you don’t, functions such as:

updateSeedData: function(obj: T, srcObj: T, spec: UpsertSpec): T

won’t work. I believe you will get an exception when calling them.


#5

Also, John says it’s a bug that you aren’t getting an error during provisioning. Ultimately, we have a planned feature where you won’t need to specify it if it can be inferred but that feature isn’t completed yet. Please file a ticket for not getting an error at present and assign it to David.


#6

What is the difference between the obj and srcObj parameters in the updateSeedData() function Tom references above?

Both seem to be referencing the same Type T that mixes SeedData.


#7

I believe the srcObj parameter for SeedData.updateSeedData(obj, srcObj, spec): T exists for the same reason the srcObj parameter exists for Upsertable.update(srcObj, spec): Upsertable:

srcObj: If specified, the initial state of obj before any updates. The actual update to the obj will be only the diff between the obj and srcObj. If not specified, the obj will completely replace the existing one.