[ https://issues.apache.org/jira/browse/ATLAS-709?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15257638#comment-15257638 ]
Shwetha G S commented on ATLAS-709: ----------------------------------- ATLAS-499 has the same intentions. Can we resolve this as duplicate of ATLAS-499? cc [~dkantor] > Creating an instance with bi-directional reference does not set the reverse > reference > ------------------------------------------------------------------------------------- > > Key: ATLAS-709 > URL: https://issues.apache.org/jira/browse/ATLAS-709 > Project: Atlas > Issue Type: Bug > Reporter: Prasad S Madugundu > > Steps to create the issue: > 1. I have defined 2 classes (DeletePackage_Account and > DeletePackage_Customer) with a bi-directional reference > (DeletePackage_Account.primaryCustomer and > DeletePackage_Customer.ownsAccount). > 2. I have created instance of the 1st class (DeletePackage_Account) and got > GUID. > 3. I have created instance of the 2nd class (DeletePackage_Customer) and set > the GUID of the first instance (ownsAccount) for establishing the > bi-directional reference between these instances. > 4. If I GET the first instance (DeletePackage_Account), I expect that the > reference (primaryCustomer) is created to the 2nd instance. But, it does not. > I am sending the JSON for all the above 4 steps. > Register types request (DeletePackage_Customer and DeletePackage_Account that > have bi-directional reference as highlighted in bold below) > ------------------------------------- > uri = http://9.184.184.47:21000/api/atlas/types, > json = > {"enumTypes":[],"structTypes":[],"traitTypes":[{"superTypes":[],"hierarchicalMetaTypeName":"org.apache.atlas.typesystem.types.TraitType","typeName":"DeletePackage_frozen","typeDescription":"","attributeDefinitions":[]}], > "classTypes":[{"superTypes":["OMSBase_OMObject"],"hierarchicalMetaTypeName":"org.apache.atlas.typesystem.types.ClassType","typeName":"DeletePackage_Customer","typeDescription":"","attributeDefinitions":[{"name":"name","dataTypeName":"string","multiplicity":"optional","isComposite":false,"reverseAttributeName":null,"isUnique":false,"isIndexable":true},{"name":"primaryAccount","dataTypeName":"DeletePackage_Account","multiplicity":"optional","isComposite":false,"reverseAttributeName":null,"isUnique":false,"isIndexable":true},{"name":"ownsAccount","dataTypeName":"array<DeletePackage_Account>","multiplicity":"optional","isComposite":false,"reverseAttributeName":"primaryCustomer","isUnique":false,"isIndexable":true}]}, > {"superTypes":["OMSBase_OMObject"],"hierarchicalMetaTypeName":"org.apache.atlas.typesystem.types.ClassType","typeName":"DeletePackage_Account","typeDescription":"","attributeDefinitions":[{"name":"balance","dataTypeName":"double","multiplicity":"optional","isComposite":false,"reverseAttributeName":null,"isUnique":false,"isIndexable":true},{"name":"recentDepositAmounts","dataTypeName":"array<float>","multiplicity":"optional","isComposite":false,"reverseAttributeName":null,"isUnique":false,"isIndexable":true},{"name":"lastModified","dataTypeName":"date","multiplicity":"optional","isComposite":false,"reverseAttributeName":null,"isUnique":false,"isIndexable":true},{"name":"number","dataTypeName":"string","multiplicity":"optional","isComposite":false,"reverseAttributeName":null,"isUnique":false,"isIndexable":true},{"name":"signators","dataTypeName":"array<string>","multiplicity":"optional","isComposite":false,"reverseAttributeName":null,"isUnique":false,"isIndexable":true},{"name":"props","dataTypeName":"map<string,string>","multiplicity":"optional","isComposite":false,"reverseAttributeName":null,"isUnique":false,"isIndexable":true},{"name":"recentDeposits","dataTypeName":"array<date>","multiplicity":"optional","isComposite":false,"reverseAttributeName":null,"isUnique":false,"isIndexable":true},{"name":"primaryCustomer","dataTypeName":"array<DeletePackage_Customer>","multiplicity":"optional","isComposite":false,"reverseAttributeName":"ownsAccount","isUnique":false,"isIndexable":true}]}]} > Create DeletePackage_Account instance request > -------------------------------------------------------- > uri = http://9.184.184.47:21000/api/atlas/entities, > json = > [{"jsonClass":"org.apache.atlas.typesystem.json.InstanceSerialization$_Reference","id":{"jsonClass":"org.apache.atlas.typesystem.json.InstanceSerialization$_Id","id":"-420977068982507","version":0,"typeName":"DeletePackage_Account"},"typeName":"DeletePackage_Account","values":{"balance":1000.0,"omCreationTimestamp":"2016-04-26T05:40:35.008Z","omModifiedByUser":"oms","number":"acc1","omOptimisticLockId":0,"omModificationTimestamp":"2016-04-26T05:40:35.008Z","omCreatedByUser":"oms"},"traitNames":[],"traits":{}}] > response = {"requestId":"qtp1712669532-12 - > 81263bbc-fc13-4bee-afe6-95315ba6d3e1","GUID":["3606cb47-ada7-4fa2-abbc-5d1d7d3ae1ff"],"definition":{"jsonClass":"org.apache.atlas.typesystem.json.InstanceSerialization$_Reference","id":{"jsonClass":"org.apache.atlas.typesystem.json.InstanceSerialization$_Id","id":"3606cb47-ada7-4fa2-abbc-5d1d7d3ae1ff","version":0,"typeName":"DeletePackage_Account"},"typeName":"DeletePackage_Account","values":{"signators":null,"number":"acc1","omContainerId":null,"omCreatedByUser":"oms","lastModified":null,"balance":1000,"omModificationTimestamp":"2016-04-26T05:40:35.008Z","omOptimisticLockId":0,"primaryCustomer":null,"omModifiedByUser":"oms","omCreationTimestamp":"2016-04-26T05:40:35.008Z","props":null,"recentDeposits":null,"recentDepositAmounts":null},"traitNames":[],"traits":{}}} > Create request for DeletePackage_Customer instance with reference to > "DeletePackage_Account" > ------------------------------------------------ > uri = http://9.184.184.47:21000/api/atlas/entities, > json = > [{"jsonClass":"org.apache.atlas.typesystem.json.InstanceSerialization$_Reference","id":{"jsonClass":"org.apache.atlas.typesystem.json.InstanceSerialization$_Id","id":"-420977559701575","version":0,"typeName":"DeletePackage_Customer"},"typeName":"DeletePackage_Customer","values":{"omCreationTimestamp":"2016-04-26T05:40:35.500Z","name":"Adam","omModifiedByUser":"oms","ownsAccount":[{"jsonClass":"org.apache.atlas.typesystem.json.InstanceSerialization$_Id","id":"3606cb47-ada7-4fa2-abbc-5d1d7d3ae1ff","version":0,"typeName":"DeletePackage_Account"}],"omOptimisticLockId":0,"omModificationTimestamp":"2016-04-26T05:40:35.500Z","omCreatedByUser":"oms"},"traitNames":[],"traits":{}}] > Create instances response = {"requestId":"qtp1712669532-14 - > 4e21ad1d-6484-4eb1-ae51-8e30acf5d9de","GUID":["eea44634-6841-40b8-90b5-2f580c2ca904"],"definition":{"jsonClass":"org.apache.atlas.typesystem.json.InstanceSerialization$_Reference","id":{"jsonClass":"org.apache.atlas.typesystem.json.InstanceSerialization$_Id","id":"eea44634-6841-40b8-90b5-2f580c2ca904","version":0,"typeName":"DeletePackage_Customer"},"typeName":"DeletePackage_Customer","values":{"name":"Adam","omContainerId":null,"omCreatedByUser":"oms","ownsAccount":[{"jsonClass":"org.apache.atlas.typesystem.json.InstanceSerialization$_Id","id":"3606cb47-ada7-4fa2-abbc-5d1d7d3ae1ff","version":0,"typeName":"DeletePackage_Account"}],"omModificationTimestamp":"2016-04-26T05:40:35.500Z","omOptimisticLockId":0,"primaryAccount":null,"omModifiedByUser":"oms","omCreationTimestamp":"2016-04-26T05:40:35.500Z"},"traitNames":[],"traits":{}}} > Get DeletePackage_Customer instance Request (I can see the ownsAccount > reference) > -------------------------------------------------------- > uri = > http://9.184.184.47:21000/api/atlas/entities/eea44634-6841-40b8-90b5-2f580c2ca904 > response = {"requestId":"qtp1712669532-16 - > cf6deb04-a061-4e6d-a729-bff40b07689b","GUID":"eea44634-6841-40b8-90b5-2f580c2ca904","definition":{"jsonClass":"org.apache.atlas.typesystem.json.InstanceSerialization$_Reference","id":{"jsonClass":"org.apache.atlas.typesystem.json.InstanceSerialization$_Id","id":"eea44634-6841-40b8-90b5-2f580c2ca904","version":0,"typeName":"DeletePackage_Customer"},"typeName":"DeletePackage_Customer","values":{"name":"Adam","omContainerId":null,"omCreatedByUser":"oms","ownsAccount":[{"jsonClass":"org.apache.atlas.typesystem.json.InstanceSerialization$_Id","id":"3606cb47-ada7-4fa2-abbc-5d1d7d3ae1ff","version":0,"typeName":"DeletePackage_Account"}],"omModificationTimestamp":"2016-04-26T05:40:35.500Z","omOptimisticLockId":0,"primaryAccount":null,"omModifiedByUser":"oms","omCreationTimestamp":"2016-04-26T05:40:35.500Z"},"traitNames":[],"traits":{}}} > Get DeletePackage_Account instance Request (I do not see primaryCustomer > reference): > ------------------------------------------------------ > uri = > http://9.184.184.47:21000/api/atlas/entities/3606cb47-ada7-4fa2-abbc-5d1d7d3ae1ff > response = {"requestId":"qtp1712669532-16 - > 49fd76b4-9fcd-4dba-8518-f525fe475c26","GUID":"3606cb47-ada7-4fa2-abbc-5d1d7d3ae1ff","definition":{"jsonClass":"org.apache.atlas.typesystem.json.InstanceSerialization$_Reference","id":{"jsonClass":"org.apache.atlas.typesystem.json.InstanceSerialization$_Id","id":"3606cb47-ada7-4fa2-abbc-5d1d7d3ae1ff","version":0,"typeName":"DeletePackage_Account"},"typeName":"DeletePackage_Account","values":{"signators":null,"number":"acc1","omContainerId":null,"omCreatedByUser":"oms","lastModified":null,"balance":1000,"omModificationTimestamp":"2016-04-26T05:40:35.008Z","omOptimisticLockId":0,"primaryCustomer":null,"omModifiedByUser":"oms","omCreationTimestamp":"2016-04-26T05:40:35.008Z","props":null,"recentDeposits":null,"recentDepositAmounts":null},"traitNames":[],"traits":{}}} -- This message was sent by Atlassian JIRA (v6.3.4#6332)