Setting Activity parameter property "literal" with OMB Plus

Does anybody know how the property "literal" can be set to "false" with an OMB command?
To change e.g. the value, the following command works:
OMBALTER PROCESS_FLOW 'LOAD_STAGE' \
MODIFY ACTIVITY 'STG_POS_MAP' MODIFY PARAMETER 'P_AUDITID' SET PROPERTIES (VALUE) VALUES ('parent_audit_id')
This works for all other properties like DIRECTION, DATA_TYPE, BINDING, etc. but not for LITERAL. The following command doesn't work:
OMBALTER PROCESS_FLOW 'LOAD_STAGE' \
MODIFY ACTIVITY 'STG_POS_MAP' MODIFY PARAMETER 'P_AUDITID' SET PROPERTIES (LITERAL) VALUES ('false')
In the OWB API and Scripting Reference there is no information about this property. It seems that Oracle forgot to implement it...

Hi
For a while I though the same...the property is ISLITERALVALUE see the blog post for an example;
http://blogs.oracle.com/warehousebuilder/newsItems/viewFullItem$183
Cheers
David

Similar Messages

  • Execute process flow with OMB*Plus

    Hello,
    somebody know how to execute a process flow designed with OWB 9.0.4.8.21 within OMB*Plus?
    Thanks,
    Pedro

    Currently it is not possible to execute Process Flows or Mappings from OMB. OMB is to be used mostly as a metadata manipulation and processing platform, not for run-time management.
    What you could do is to put OMB metadata operation commands and runtime execution commands one after the other in a shell script and then run everything from this shell script (if this is what you are trying to do).
    Regards:
    Igor

  • How to set privillages for created user with iSQL *Plus

    The hosting company has provided ISQL * Plus interface. I have created user by using the following command:
    Create user test identified by test;
    Grant connect, resource to test;
    But I am unable to load or import data into db. How can I import/load data as its giving permission denied message.
    I think there is a lack of imp/loading data grants. Who do I set?
    Thanks & best regards
    Message was edited by:
    Raakh

    1. which version of the database ?iSQL *Plus 10.2.0.1.0
    2. how you are trying/want to import/load data ?from online control pannel I am selecting the Load Data option and processing 7 steps. message appears "Successfully Loaded" but when am seeing log file its given me
    Step: Load
    Page Refreshed Jun 7, 2007 6:38:47 AM
    Status Succeeded
    Targets orcl
    Started Jun 7, 2007 6:38:11 AM GMT-04:00
    Ended Jun 7, 2007 6:38:11 AM GMT-04:00
    Elapsed Time 0 seconds
    Output Log
    Username:SQL*Loader-704: Internal error: ulconnect: OCIServerAttach [0]
    ORA-12546: TNS:permission denied
    SQL*Loader: Release 10.2.0.1.0 - Production on Thu Jun 7 06:38:11 2007
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Message was edited by:
    Raakh

  • WCF :Consider marking the type with the CollectionDataContractAttribute attribute or the SerializableAttribute attribute or adding a setter to the property

    Hi All,
    Currently I am working in a WCF project here when I try to send data from WCF Project 1 to WCF project 2 I am getting the below error.
    The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:subscriber. The InnerException message was 'The use of type 'Integra.Business.ICC.ObjectChangeTracker'
    as a get-only collection is not supported with NetDataContractSerializer.  Consider marking the type with the CollectionDataContractAttribute attribute or the SerializableAttribute attribute or adding a setter to the property.'.  Please see InnerException
    for more details.
    I don't understand what issue this is since I am new to WCF. Please help me on this thanks in advance.

    You've posted to a forum for Microsoft Project - a project management program.  Please re-post your question to the WCF forum:
    http://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=wcf
    Sorry - I cannot seem to move your post for you.
    Julie

  • OMB*Plus error defining CONTROL_FILE_LOCATION property

    Hello,
    I have built a script which creates a mapping that, simply, maps all fields from a flat file to a stage table. A column called 'CAP_DATE' is added to the table and this column is mapped from a constant. The mapping is under 'STG' module within 'Databases/Oracle' module.
    I want to set the CONTROL_FILE_LOCATION mapping property in order to set the location which the .ctl file will be deployed in. The location name is 'PHASE_1B' and it is defined within 'Files' module.
    So, when I try to run the following statement (within 'STG' context):
    OMBALTER MAPPING '$map_0' SET PROPERTIES (CONTROL_FILE_NAME,CONTROL_FILE_LOCATION) VALUES ('$map_0.tcl','PHASE_1B')
    I get the error:
    OMB02902: Error setting property CONTROL_FILE_LOCATION of M_ST_NCRM_INTTXT: PUB02106: Invalid value PHASE_1B for property CONTROL_FILE_LOCATION on map M_ST_NCRM_INTTXT: PUB02769 : PHASE_1B is not the name of a valid location for this property.
    I think this is because the location I'm trying to assign is in another context and OMB*Plus doesn't find it. Am I right? How can I solve this problem?
    Kind regards,
    Natividad.

    Stas,
    I don't think you're doing something wrong... I just did:
    OMB+> OMBREDEFINE CLASS_DEFINITION 'PROJECT' \
    ADD PROPERTY_DEFINITION 'WHATEVER' \
    SET PROPERTIES (TYPE) VALUES ('STRING')OMB+> OMBALTER PROJECT 'MY_PROJECT' \
    SET PROPERTIES (UDP_WHATEVER) \
    VALUES ('Hello')
    which works fine. I think you are hitting a bug. Have to admit, I am running version 9.2.0.4 for this example... but I get the same problem for your scenario. I.e. I filed bug 3686842. Only workaround is to use the UI for now.
    Thanks,
    Mark.

  • How to set dynamic parameter in list of values in parameter property

    Hi,
    I am using cr4e-all-in-one-win_2.0.1version.I have created .rpt file in that how to set dynamic parameters(from database) in list of values parameter property
    Regards,
    amol

    Hi,
    I am using cr4e-all-in-one-win_2.0.1version.I have created .rpt file in that how to set dynamic parameters(from database) in list of values parameter property
    Regards,
    amol

  • Exception setting property value with CGLIB ( in hibernate)

    My hbm.xml file is:
    <hibernate-mapping>
    <class name="com.dst.fourx.model.codeModel.CodeGroupDisplay" table="CODE_GROUP_DISPAY1">
    <composite-id name="codeGroupDisplayKey" class="com.dst.fourx.model.codeModel.CodeGroupDisplayKey">
    <key-property name="nlsLanguage" type="java.lang.String" column="LANG_CD" />
    <key-many-to-one name="codeGroupCode" class="com.dst.fourx.model.codeModel.CodesGroup" column="CD_GRP_CD" />
    </composite-id>
    <property name="createDate" column="CREATE_DT" type="java.util.Date" not-null="true"/>
    <property name="createUserCode" column="CREATE_USER_CD" type="java.lang.String" not-null="true"/>
    <property name="updateDate" column="LAST_MOD_DT" type="java.util.Date"/>
    <property name="updateUserCode" column="LAST_MOD_USER_CD" type="java.lang.String"/>
    <property name="displayText" column="DISPLAY_TXT" type="java.lang.String" not-null="true"/>
    </class>
    <query name="findAllEditableCodeGroups">
    <![CDATA[from CodeGroupDisplay]]>
         </query>
    </hibernate-mapping>
    I m getting the following error while running the above query:
    org.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of com.dst.fourx.model.codeModel.CodeGroupDisplayKey.setCodeGroupCode
         at org.hibernate.tuple.PojoComponentTuplizer.setPropertyValues(PojoComponentTuplizer.java:63)
         at org.hibernate.type.ComponentType.setPropertyValues(ComponentType.java:262)
         at org.hibernate.type.ComponentType.resolve(ComponentType.java:447)
         at org.hibernate.type.ComponentType.nullSafeGet(ComponentType.java:182)
         at org.hibernate.loader.Loader.getKeyFromResultSet(Loader.java:759)
         at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:292)
         at org.hibernate.loader.Loader.doQuery(Loader.java:412)
         at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218)
         at org.hibernate.loader.Loader.doList(Loader.java:1593)
         at org.hibernate.loader.Loader.list(Loader.java:1577)
         at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:395)
         at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:271)
         at org.hibernate.impl.SessionImpl.list(SessionImpl.java:844)
         at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
         at com.dst.fourx.core.impl.ao.dao.actions.HibernateNamedQueryAction.execute(HibernateNamedQueryAction.java:79)
         at com.dst.fourx.core.impl.ao.dao.BaseDAOHibernate.execute(BaseDAOHibernate.java:129)
         at com.dst.fourx.core.impl.ao.dao.AddEditCodeDAO.getAllFundingTypes(AddEditCodeDAO.java:47)
         at com.dst.fourx.core.impl.ao.dao.AddEditDAOTest.testGetCreditBankAccts(AddEditDAOTest.java:29)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at junit.framework.TestCase.runTest(TestCase.java:154)
         at junit.framework.TestCase.runBare(TestCase.java:127)
         at junit.framework.TestResult$1.protect(TestResult.java:106)
         at junit.framework.TestResult.runProtected(TestResult.java:124)
         at junit.framework.TestResult.run(TestResult.java:109)
         at junit.framework.TestCase.run(TestCase.java:118)
         at junit.framework.TestSuite.runTest(TestSuite.java:208)
         at junit.framework.TestSuite.run(TestSuite.java:203)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
    Caused by: net.sf.cglib.beans.BulkBeanException: com.dst.fourx.model.codeModel.CodesGroup$$EnhancerByCGLIB$$fd9c7e4e
         at com.dst.fourx.model.codeModel.CodeGroupDisplayKey$$BulkBeanByCGLIB$$ae2c0401_2.setPropertyValues(<generated>)
         at org.hibernate.tuple.PojoComponentTuplizer.setPropertyValues(PojoComponentTuplizer.java:59)
         ... 32 more
    Caused by: java.lang.ClassCastException: com.dst.fourx.model.codeModel.CodesGroup$$EnhancerByCGLIB$$fd9c7e4e
         ... 34 more

    check the setter method for the property LANG_CD in com.dst.fourx.model.codeModel.CodeGroupDisplay.
    it must be like -
    setNlsLanguage(CodesGroup xyz) { ... }
    The paremeters must be objects, not the type of the database column. We can specify the actual field in CodesGroup which acts as the foreign key in CodeGroupDisplay in the "property-ref" attribute of <many-to-one> element in the mapping file for CodeGroupDisplay.
    This worked for me. Hope it works for you too.

  • Multiplot waveform graph plots are different colors when set to be the same with a property node.

    The graphs were working yesterday. I made a few changes to another part of the block diagram and now the graphs do not plot all of the plots the same color. I am using a for loop with a property node with the elements active plot connected to the iteration terminal, and plot color to a color box. My for loop increments programmaticaly from another part of the code to create plots as it runs. I have replaced the graphs with new ones and they will work sometimes.
    I am using Win2k and LV 7.1
    Thanks,
    Brett

    Hi bh3560,
    Have you tried chaging the color by right clicking on the line in the plot legend.  There is an option to change the color of the plot.
    Brian K.

  • After you increase the page size with Ctrl/plus, is there a way to keep the new setting?

    ''Duplicate post, continue here - [https://support.mozilla.com/en-US/questions/845611]''
    My new laptop has great features but a smaller screen. Changing the resolution makes everything look awful. Using Ctrl/plus to increase the page size in Firefox solves the problem, but you lose the new setting when you go to a different page. Is there a way to keep the new setting until you reverse it with Ctrl/minus ?

    There are some add-ons that can be used to change the zoom level on all sites, for example:
    * NoSquint - https://addons.mozilla.org/firefox/addon/nosquint
    * Default FullZoom Level - https://addons.mozilla.org/firefox/addon/default-fullzoom-level

  • How can a property panel set some parameter for its base taskflow

    Hi,
    How can a property panel set some parameter for its base taskflow (the tf for which this property panel was registered).
    Thanks
    Mayank.

    This question should go to Jdeveloper & ADF Forum: JDeveloper and ADF
    Regards,
    Venkat

  • OMB Plus to set CDC properties of Oracle Module

    Hi,
    Does anybody know if it is possible to set the CDC properties of an Oracle Module using OMB Plus?
    I was thinking in the lines of
    OMBALTER ORACLE_MODULE 'MY_CDC_MODULE' SET PROPERTIES (CDC_CODE_TEMPLATE) VALUES ('PUBLIC_PROJECT/BUILT_IN_CT/JCT_10G_CONSISTENT_MINER')
    but this does not work, and I can't see any appropriate properties in the documentation.
    In addition to setting the CDC template I would like to be able to choose the tables to include in CDC using a script as well. Any help would be appreciated
    Roald
    Edited by: roheie on Oct 12, 2010 12:17 AM

    Hi Oleg,
    I think I may need to clarify my question. I am no trying to alter a template mapping, I am trying to alter the properties of the Oracle Module that is the source for the CDC template mappings
    What I am trying to do in the script is the same operation as you do in the Design Center when you expand Databases->Oracle and then double click your 'CDC_SOURCE_SYSTEM' (example name) module to get to the properties wizard. In there you can set 'Metadata Location', 'Data Location', 'CDC Code Template', and 'CDC tables'. The first two of these I am already setting in my script, what I am asking is how I can set the last two of these properties
    Regards,
    Roald

  • OMBCREATE LOCATION hangs (OMB*Plus 11.1.0.7)

    My try to create a file location in OMBPlus failed.
    OMBCONNECT <ConnectString> USE WORKSPACE 'RUNTIME' USE MULTIPLE_USER_MODEConnected.
    OMBCONNECT CONTROL_CENTER <ConnectString> USE WORKSPACE 'OWNER.RUNTIME'Control Center connected.
    OMBCREATE LOCATION 'LOC_FILE' SET PROPERTIES (TYPE, ROOTPATH) VALUES ('FILE_SYSTEM', '/tmp')Even after several minutes there is no return of the last command !
    Info: The location already exist, OMB*Plus is 11.1.0.7
    Any ideas how to solve that issue?
    Beat

    user12086319 wrote:
    Hi EdStevens,
    Following the instructions in previous post, I can connect with SQL plus (the database is on the same box* as your sqlplus client); I just enter sqlplus in windows console.
    In addition, i am still curious about how SQL plus connect to a remote* box. Could you shed more light on that?SQLPlus connects to a remote db the same way any other app does. After all, sqlplus is just another client app.
    It's all in the connect string. So say, at a command prompt you enter
    $> sqlplus scott/tiger@mydbso in the above example, 'scott' is the user, 'tiger' is the password, and 'mydb' is the tns service name. Of course, the OS passes all that to sqlplus as a command line parameter. Internally, sqlplus makes a call to the tns layer and passes it the connect information it has. TNS will take a look at the tnsnames.ora file and find an entry for 'mydb', and from there it will get the name or ip address of the host server, a port number, and a service name. That information will be passed on down the network stack for routing. (If a name was provided instead of an ip address, the OS network stack will use whatever means are at its disposal - a hosts file, a dns lookup, or whatever, to get an ip address). The request will arrive at the specified host and placed on the specified port. If everything was configured correctly, there will be an oracle listener process monitoring that port. It will pick up the request and see if it recognizes the service name. If it does, it will spawn a user server process on a different port to complete the connection, then get out of the way and continue listening for more requests.
    This is how it happens most of the time. There are a lot of other variants, but that's the gist of it.
    More information can be found in the fine documentation at tahiti.oracle.com.

  • How to stop a scheduled job using OMB*Plus ?

    Hello everyone,
    I use a OMB*Plus script to deploy a project in various environments. This includes scheduled jobs.
    In this context, I need to stop the schedules of the previous versions to avoid a script crash.
    I found the OMBSTOP command thad could do, but I need to retrieve the job ID of the schedule I want to stop. And I don't know how to get the Job ID.
    I could get it from a previous launch and save it somewhere, but it wouldn't work if the schedule was manually stopped and restarted. Maybe is there a command that lists the running / scheduled jobs and their IDs? I didn't find it.
    Thanks in advance for your help.
    Cedric.

    Frankly, I cannot see where this is available via pure OMB+, however you could back-door it if if you can figure out how to get these values from the public views (I would guess from the "Scheduling Views" section at http://download-east.oracle.com/docs/cd/B31080_01/doc/owb.102/b28225/toc.htm).
    Then you could use my SQL library from OMB+ to get these values and stop the schedules before deploying. you can save this file as omb_sql_library.tcl and then just "source /path/to/omb_sql_library.tcl in your own script to make the functions available in your script.
    {code}
    package require java
    # PVCS Version Information
    #/* $Workfile: omb_sql_library.tcl $ $Revision: 1.0 $ */
    #/* $Author: $
    #/* $Date: 03 Apr 2008 13:43:34 $ */
    proc oracleConnect { serverName databaseName portNumber username password } {
    # import required classes
    java::import java.sql.Connection
    java::import java.sql.DriverManager
    java::import java.sql.ResultSet
    java::import java.sql.SQLWarning
    java::import java.sql.Statement
    java::import java.sql.CallableStatement
    java::import java.sql.ResultSetMetaData
    java::import java.sql.DatabaseMetaData
    java::import java.sql.Types
    java::import oracle.jdbc.OracleDatabaseMetaData
    # load database driver .
    java::call Class forName oracle.jdbc.OracleDriver
    # set the connection url.
    append url jdbc:oracle:thin
    append url :
    append url $username
    append url /
    append url $password
    append url "@"
    append url $serverName
    append url :
    append url $portNumber
    append url :
    append url $databaseName
    set oraConnection [ java::call DriverManager getConnection $url ]
    set oraDatabaseMetaData [ $oraConnection getMetaData ]
    set oraDatabaseVersion [ $oraDatabaseMetaData getDatabaseProductVersion ]
    puts "Connected to: $url"
    puts "$oraDatabaseVersion"
    return $oraConnection
    proc oracleDisconnect { oraConnect } {
    $oraConnect close
    proc oraJDBCType { oraType } {
    #translation of JDBC types as defined in XOPEN interface
    set rv "NUMBER"
    switch $oraType {
    "0" {set rv "NULL"}
    "1" {set rv "CHAR"}
    "2" {set rv "NUMBER"}
    "3" {set rv "DECIMAL"}
    "4" {set rv "INTEGER"}
    "5" {set rv "SMALLINT"}
    "6" {set rv "FLOAT"}
    "7" {set rv "REAL"}
    "8" {set rv "DOUBLE"}
    "12" {set rv "VARCHAR"}
    "16" {set rv "BOOLEAN"}
    "91" {set rv "DATE"}
    "92" {set rv "TIME"}
    "93" {set rv "TIMESTAMP"}
    default {set rv "OBJECT"}
    return $rv
    proc oracleQuery { oraConnect oraQuery } {
    set oraStatement [ $oraConnect createStatement ]
    set oraResults [ $oraStatement executeQuery $oraQuery ]
    # The following metadata dump is not required, but will be a helpfull sort of thing
    # if ever want to really build an abstraction layer
    set oraResultsMetaData [ $oraResults getMetaData ]
    set columnCount [ $oraResultsMetaData getColumnCount ]
    set i 1
    #puts "ResultSet Metadata:"
    while { $i <= $columnCount} {
    set fname [ $oraResultsMetaData getColumnName $i]
    set ftype [oraJDBCType [ $oraResultsMetaData getColumnType $i]]
    #puts "Output Field $i Name: $fname Type: $ftype"
    incr i
    # end of metadata dump
    return $oraResults
    # SAMPLE CODE to run a quick query and dump the results. #
    #set oraConn [ oracleConnect myserver orcl 1555 scott tiger ]
    #set oraRs [ oracleQuery $oraConn "select name, count(*) numlines from user_source group by name" ]
    #for each row in the result set
    #while {[$oraRs next]} {
    #grab the field values
    # set procName [$oraRs getString name]
    # set procCount [$oraRs getInt numlines]
    # puts "Program unit $procName comprises $procCount lines"
    #$oraRs close
    #oracleDisconnect $oraConn
    {code}
    So you would want to connect to the control center, query for scheduled jobs, stop them, and then continue on with your deployment. I assume that you also need to pause and check that an scheduled job in mid-run has time to exit before moving ahead. You could do a sleep loop querying against system tables looking for active sessions running mappings and waiting until they are all done or something if you really want to bulletproof the process.
    Hope this helps,
    Mike

  • Oerr facility for OMB Plus errors

    oerr facility for OMB scirpting errors
    Hello,
    is there a facility to troubleshoot errors encountered running OWB scripts ?
    My below command failed with MMM1034 error :
    OMBCREATE ORACLE_MODULE 'SRAV_MODULE' \
    SET PROPERTIES (DESCRIPTION, BUSINESS_PROPERTIES) VALUES \
    ('Target Module for testing relational objects' , 'Rel_Objects')
    MMM1034: Property BUSINESS_PROPERTIES does not exist.
    ===========
    Now, how do I troubleshoot this error? Is there a document with all the errors listing of MMM.
    I tried 'oerr MMM 1034' but it complained with "unknown facility" error.
    I did not find anything in the OWB scripting doc. What other documents can I refer to learn more about OMB plus scripting ?

    Patrick,
    thanks for your response.
    Yes, that fixed it. Is there any kind of reference book for all error listings and their fixes ? The scripting reference do not mention anything about error messages.
    Now, this is my new problem. The 1st script is fine, creates the table with 1 column. When I extend the script to create 2 columns, it complains.
    =====
    OMBCREATE TABLE 'SRAV_TBL_CHILD' \
    SET PROPERTIES (DESCRIPTION) VALUES \
    ('This table connects to TBL_PARENT') \
    ADD COLUMN 'ID1' \
    SET PROPERTIES (DATATYPE) VALUES ('NUMBER')
    =====
    OMBCREATE TABLE 'SRAV_TBL_CHILD' \
    SET PROPERTIES (DESCRIPTION) VALUES \
    ('This table connects to TBL_PARENT') \
    ADD COLUMN 'ID1' \
    SET PROPERTIES (DATATYPE) VALUES ('NUMBER') \
    ADD COLUMN 'COL2' \
    SET PROPERTIES (DATATYPE , NOT_NULL, DESCRIPTION) VALUES \
    ('NUMBER',1,'COL2 is the second col of PK')
    ======
    OMB00001: Encountered <EOF> at line: 1, column: 250. Was expecting one of: "("
    What am I missing ? When it says, column 250 - is it the 250th character of the complete script, as it seems there is no 2nd line in the scripting - everything in the sccript is in 1 line. Is there a way we can break the line into many, so debugging becomes easy. Instead of saying Line 1 column 250 - it would be better if it says line 4 column 10.
    Please advice.
    Thanks
    Sravan

  • Why do I have to set the PrincipalName property on my discovered ApplicationComponent instances?

    In the simple example below I define three classes:
    MyComputerRoleClass (with base Microsoft.Windows.ComputerRole)
    MyLocalApplicationClass (with base Microsoft.Windows.LocalApplication)
    MyApplicationComponentClass (with base Microsoft.Windows.ApplicationComponent)
    As well as a hosting relationship
    MyLocalApplicationClassHostsMyApplicationComponentClass
    that let's MyLocalApplicationClass host MyApplicationComponentClasses.
    In a timed PowerShell discovery targeting the RootManagementServer (Root Management Server Emulator) I create
    1 MyComputerRoleClass instance
    1 MyLocalApplicationClass instance and 
    2 MyApplicationComponentClass instances hosted on the instance of MyLocalApplicationClass
    By setting the PrincipalName property for the instances of MyComputerRoleClass
    and MyLocalApplicationClass I implicitly create hosting relationship instances of
    Microsoft.Windows.ComputerHostsComputerRole and Microsoft.Windows.ComputerHostsLocalApplication
    respectively.
    But why do I have to set PrincipalName on instances of MyApplicationComponentClass as well? If I don't I'll get this error:
    Microsoft.EnterpriseManagement.Common.DiscoveryDataMissingKeyException,Missing key in the discovery data item.
    Key property name: Microsoft.Windows.Computer.PrincipalName
    Here my discovery script:
    param($sourceId,$managedEntityId)
    $api = new-object -comObject "MOM.ScriptAPI"
    $api.LogScriptEvent('DiscoverClassesAndRelationships.ps1', 1001, 0, "Discovery started (12)")
    $discoveryData = $api.CreateDiscoveryData(0,$sourceId,$managedEntityId)
    $computer = 'SomeServer.SomeDomain'
    $myComputerRoleClass = $discoveryData.CreateClassInstance("$MPElement[Name='MyDiscoveryDemoManagementPack.MyComputerRoleClass']$")
    $myComputerRoleClass.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "MyComputerRoleClass instance on $computer")
    $myComputerRoleClass.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $computer)
    $discoveryData.AddInstance($myComputerRoleClass)
    $myLocalApplicationClass = $discoveryData.CreateClassInstance("$MPElement[Name='MyDiscoveryDemoManagementPack.MyLocalApplicationClass']$")
    $myLocalApplicationClass.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "MyLocalApplicationClass instance on $computer")
    $myLocalApplicationClass.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $computer)
    $discoveryData.AddInstance($myLocalApplicationClass)
    $myApplicationComponentClass1 = $discoveryData.CreateClassInstance("$MPElement[Name='MyDiscoveryDemoManagementPack.MyApplicationComponentClass']$")
    $myApplicationComponentClass1.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "MyApplicationComponentClass instance")
    $myApplicationComponentClass1.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $computer) # Why is this needed
    $myApplicationComponentClass1.AddProperty("$MPElement[Name='MyDiscoveryDemoManagementPack.MyApplicationComponentClass']/Name$", "Number 1")
    $discoveryData.AddInstance($myApplicationComponentClass1)
    $myApplicationComponentClass2 = $discoveryData.CreateClassInstance("$MPElement[Name='MyDiscoveryDemoManagementPack.MyApplicationComponentClass']$")
    $myApplicationComponentClass2.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "MyApplicationComponentClass instance")
    $myApplicationComponentClass2.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $computer) # Why is this needed
    $myApplicationComponentClass2.AddProperty("$MPElement[Name='MyDiscoveryDemoManagementPack.MyApplicationComponentClass']/Name$", "Number 2")
    $discoveryData.AddInstance($myApplicationComponentClass2)
    $relationshipInstance1 = $discoveryData.CreateRelationshipInstance("$MPElement[Name='MyDiscoveryDemoManagementPack.MyLocalApplicationClassHostsMyApplicationComponentClass']$")
    $relationshipInstance1.Source = $myLocalApplicationClass
    $relationshipInstance1.Target = $myApplicationComponentClass1
    $discoveryData.AddInstance($relationshipInstance1)
    $relationshipInstance2 = $discoveryData.CreateRelationshipInstance("$MPElement[Name='MyDiscoveryDemoManagementPack.MyLocalApplicationClassHostsMyApplicationComponentClass']$")
    $relationshipInstance2.Source = $myLocalApplicationClass
    $relationshipInstance2.Target = $myApplicationComponentClass2
    $discoveryData.AddInstance($relationshipInstance2)
    $api.LogScriptEvent('DiscoverClassesAndRelationships.ps1', 1002, 0, "Discovery ended - data returned now")
    #$api.return($discoveryData)
    $discoveryData
    Here my classes and relationships:
    <TypeDefinitions>
    <EntityTypes>
    <ClassTypes>
    <ClassType ID="MyDiscoveryDemoManagementPack.MyComputerRoleClass" Base="Windows!Microsoft.Windows.ComputerRole" Accessibility="Internal" Abstract="false" Hosted="true" Singleton="false"/>
    <ClassType ID="MyDiscoveryDemoManagementPack.MyLocalApplicationClass" Base="Windows!Microsoft.Windows.LocalApplication" Accessibility="Internal" Abstract="false" Hosted="true" Singleton="false"/>
    <ClassType ID="MyDiscoveryDemoManagementPack.MyApplicationComponentClass" Base="Windows!Microsoft.Windows.ApplicationComponent" Accessibility="Internal" Abstract="false" Hosted="true" Singleton="false">
    <Property Key="true" ID="Name" Type="string"/>
    </ClassType>
    </ClassTypes>
    <RelationshipTypes>
    <RelationshipType ID="MyDiscoveryDemoManagementPack.MyLocalApplicationClassHostsMyApplicationComponentClass" Base="System!System.Hosting" Abstract="false" Accessibility="Internal">
    <Source ID="Source" Type="MyDiscoveryDemoManagementPack.MyLocalApplicationClass"/>
    <Target ID="Target" Type="MyDiscoveryDemoManagementPack.MyApplicationComponentClass"/>
    </RelationshipType>
    </RelationshipTypes>
    </EntityTypes>
    </TypeDefinitions>
    For anyone who would like to try this out, the complete management pack (you need to change $computer = 'SomeServer.SomeDomain' to match some managed computer in your system):
    <?xml version="1.0" encoding="utf-8"?>
    <ManagementPack SchemaVersion="2.0" ContentReadable="true" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <Manifest>
    <Identity>
    <ID>MyDiscoveryDemoManagementPack</ID>
    <Version>1.0.0.28</Version>
    </Identity>
    <Name>MyDiscoveryDemoManagementPack</Name>
    <References>
    <Reference Alias="SC">
    <ID>Microsoft.SystemCenter.Library</ID>
    <Version>7.0.8433.0</Version>
    <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
    </Reference>
    <Reference Alias="Windows">
    <ID>Microsoft.Windows.Library</ID>
    <Version>7.5.8501.0</Version>
    <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
    </Reference>
    <Reference Alias="System">
    <ID>System.Library</ID>
    <Version>7.5.8501.0</Version>
    <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
    </Reference>
    </References>
    </Manifest>
    <TypeDefinitions>
    <EntityTypes>
    <ClassTypes>
    <ClassType ID="MyDiscoveryDemoManagementPack.MyComputerRoleClass" Base="Windows!Microsoft.Windows.ComputerRole" Accessibility="Internal" Abstract="false" Hosted="true" Singleton="false" />
    <ClassType ID="MyDiscoveryDemoManagementPack.MyLocalApplicationClass" Base="Windows!Microsoft.Windows.LocalApplication" Accessibility="Internal" Abstract="false" Hosted="true" Singleton="false" />
    <ClassType ID="MyDiscoveryDemoManagementPack.MyApplicationComponentClass" Base="Windows!Microsoft.Windows.ApplicationComponent" Accessibility="Internal" Abstract="false" Hosted="true" Singleton="false">
    <Property Key="true" ID="Name" Type="string" />
    </ClassType>
    </ClassTypes>
    <RelationshipTypes>
    <RelationshipType ID="MyDiscoveryDemoManagementPack.MyLocalApplicationClassHostsMyApplicationComponentClass" Base="System!System.Hosting" Abstract="false" Accessibility="Internal">
    <Source ID="Source" Type="MyDiscoveryDemoManagementPack.MyLocalApplicationClass" />
    <Target ID="Target" Type="MyDiscoveryDemoManagementPack.MyApplicationComponentClass" />
    </RelationshipType>
    </RelationshipTypes>
    </EntityTypes>
    </TypeDefinitions>
    <Monitoring>
    <Discoveries>
    <Discovery ID="MyDiscoveryDemoManagementPack.MyDiscovery" Target="SC!Microsoft.SystemCenter.RootManagementServer" Enabled="true" ConfirmDelivery="false" Remotable="true" Priority="Normal">
    <Category>Discovery</Category>
    <DiscoveryTypes>
    <DiscoveryClass TypeID="MyDiscoveryDemoManagementPack.MyComputerRoleClass" />
    <DiscoveryClass TypeID="MyDiscoveryDemoManagementPack.MyLocalApplicationClass" />
    <DiscoveryClass TypeID="MyDiscoveryDemoManagementPack.MyApplicationComponentClass" />
    <DiscoveryRelationship TypeID="MyDiscoveryDemoManagementPack.MyLocalApplicationClassHostsMyApplicationComponentClass" />
    </DiscoveryTypes>
    <DataSource ID="DS" TypeID="Windows!Microsoft.Windows.TimedPowerShell.DiscoveryProvider">
    <IntervalSeconds>300</IntervalSeconds>
    <SyncTime />
    <ScriptName>DiscoverClassesAndRelationships.ps1</ScriptName>
    <ScriptBody><![CDATA[param($sourceId,$managedEntityId)
    $api = new-object -comObject "MOM.ScriptAPI"
    $api.LogScriptEvent('DiscoverClassesAndRelationships.ps1', 1001, 0, "Discovery started (12)")
    $discoveryData = $api.CreateDiscoveryData(0,$sourceId,$managedEntityId)
    $computer = 'SomeServer.SomeDomain'
    $myComputerRoleClass = $discoveryData.CreateClassInstance("$MPElement[Name='MyDiscoveryDemoManagementPack.MyComputerRoleClass']$")
    $myComputerRoleClass.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "MyComputerRoleClass instance on $computer")
    $myComputerRoleClass.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $computer)
    $discoveryData.AddInstance($myComputerRoleClass)
    $myLocalApplicationClass = $discoveryData.CreateClassInstance("$MPElement[Name='MyDiscoveryDemoManagementPack.MyLocalApplicationClass']$")
    $myLocalApplicationClass.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "MyLocalApplicationClass instance on $computer")
    $myLocalApplicationClass.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $computer)
    $discoveryData.AddInstance($myLocalApplicationClass)
    $myApplicationComponentClass1 = $discoveryData.CreateClassInstance("$MPElement[Name='MyDiscoveryDemoManagementPack.MyApplicationComponentClass']$")
    $myApplicationComponentClass1.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "MyApplicationComponentClass instance")
    $myApplicationComponentClass1.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $computer) # Why is this needed
    $myApplicationComponentClass1.AddProperty("$MPElement[Name='MyDiscoveryDemoManagementPack.MyApplicationComponentClass']/Name$", "Number 1")
    $discoveryData.AddInstance($myApplicationComponentClass1)
    $myApplicationComponentClass2 = $discoveryData.CreateClassInstance("$MPElement[Name='MyDiscoveryDemoManagementPack.MyApplicationComponentClass']$")
    $myApplicationComponentClass2.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "MyApplicationComponentClass instance")
    $myApplicationComponentClass2.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $computer) # Why is this needed
    $myApplicationComponentClass2.AddProperty("$MPElement[Name='MyDiscoveryDemoManagementPack.MyApplicationComponentClass']/Name$", "Number 2")
    $discoveryData.AddInstance($myApplicationComponentClass2)
    $relationshipInstance1 = $discoveryData.CreateRelationshipInstance("$MPElement[Name='MyDiscoveryDemoManagementPack.MyLocalApplicationClassHostsMyApplicationComponentClass']$")
    $relationshipInstance1.Source = $myLocalApplicationClass
    $relationshipInstance1.Target = $myApplicationComponentClass1
    $discoveryData.AddInstance($relationshipInstance1)
    $relationshipInstance2 = $discoveryData.CreateRelationshipInstance("$MPElement[Name='MyDiscoveryDemoManagementPack.MyLocalApplicationClassHostsMyApplicationComponentClass']$")
    $relationshipInstance2.Source = $myLocalApplicationClass
    $relationshipInstance2.Target = $myApplicationComponentClass2
    $discoveryData.AddInstance($relationshipInstance2)
    $api.LogScriptEvent('DiscoverClassesAndRelationships.ps1', 1002, 0, "Discovery ended - data returned now")
    #$api.return($discoveryData)
    $discoveryData]]></ScriptBody>
    <Parameters>
    <Parameter>
    <Name>sourceId</Name>
    <Value>$MPElement$</Value>
    </Parameter>
    <Parameter>
    <Name>managedEntityId</Name>
    <Value>$Target/Id$</Value>
    </Parameter>
    </Parameters>
    <TimeoutSeconds>120</TimeoutSeconds>
    </DataSource>
    </Discovery>
    </Discoveries>
    </Monitoring>
    <LanguagePacks>
    <LanguagePack ID="ENU" IsDefault="true">
    <DisplayStrings>
    <DisplayString ElementID="MyDiscoveryDemoManagementPack.MyComputerRoleClass">
    <Name>A demo Computer Role (base Microsoft.Windows.ComputerRole)</Name>
    <Description></Description>
    </DisplayString>
    <DisplayString ElementID="MyDiscoveryDemoManagementPack.MyLocalApplicationClass">
    <Name>A demo Local Application (base Microsoft.Windows.LocalApplication)</Name>
    <Description></Description>
    </DisplayString>
    <DisplayString ElementID="MyDiscoveryDemoManagementPack.MyApplicationComponentClass">
    <Name>A demo Application Component (base Microsoft.Windows.ApplicationComponent)</Name>
    <Description></Description>
    </DisplayString>
    <DisplayString ElementID="MyDiscoveryDemoManagementPack.MyDiscovery">
    <Name>My Demo Discovery</Name>
    <Description>Script based discovey of all demo classes and relationships in this demo. To run at the Root Management Server Simulator</Description>
    </DisplayString>
    </DisplayStrings>
    <KnowledgeArticles></KnowledgeArticles>
    </LanguagePack>
    </LanguagePacks>
    </ManagementPack>

    According to
    System Center Authoring Hub:
    "Any key properties of the class being discovered and the key properties of any of its parents must be provided. Values for other properties are optional. In this example [as well as mine], the class being discovered is hosted by Windows Computer
    and the key property of that class is added to the instance."
    http://social.technet.microsoft.com/wiki/contents/articles/14261.operations-manager-management-pack-authoring-discovery-scripts.aspx
    So that's why :-)
    Michael

Maybe you are looking for