Author Topic: Automation issue with Tagged Values in Oracle DB  (Read 93330 times)

emourot

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Automation issue with Tagged Values in Oracle DB
« on: March 08, 2016, 09:14:01 pm »
Hello EA guys, I'm blocked for days and I would like assistance for the following issue.  :o
I receive the following error when I try to create a tagged value on a package object...

Code: [Select]
OraOLEDB [-2147217900]
ORA-01400: cannot insert NULL into ("IB0040_ENT_ARCH_TEST"."T_OBJECTPROPERTIES"."PROPERTYID")

I'm using Visual Studio 2015 and I use the DLL provided via EA version 12 (the latest one).
When I inspect the content of the Element COM object, I see the TaggedValuesEx collection with 2 items.
When I try to add a 3rd one, the addItem() seems to work but the collection is not updated ?
Aftert that, when I try to call the Update() method, I received the error I described before.

Code: [Select]
   Private Sub SetReqId(element As EA.Element, value As String)
        Dim taggedValue As EA.TaggedValue = CType(element.TaggedValuesEx.GetByName("HPALM_ReqId"), EA.TaggedValue)
        If taggedValue Is Nothing Then
            Dim obj As Object = element.TaggedValuesEx.AddNew("HPALM_ReqId", "String")
            taggedValue = CType(obj, EA.TaggedValue)
        End If
        taggedValue.Value = value
        taggedValue.Update()
    End Sub

Your help will be precious for me.  :-[
I would like to avoid to access directly and dirtily to database.

Cheers.
Emmanuel @ Eurocontrol

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Automation issue with Tagged Values in Oracle DB
« Reply #1 on: March 08, 2016, 09:57:17 pm »
I guess your value is null or nil. Try replacing it with a "" string.

q.

emourot

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Automation issue with Tagged Values in Oracle DB
« Reply #2 on: March 09, 2016, 01:27:20 am »
Dear Qwerty,

Unfortunately, the issue seems not coming from the Value attribute.
This is a screen capture of the taggedValue object and Value object before the error occurs.



I'm wondering if the issue is not linked with a bug like this http://sparxsystems.com/forums/smf/index.php?topic=9739.0
?

Thanls for your help.

Cheers.
Emmanuel @ Eurocontrol

PS : We bought all yours books and we really loved them.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13286
  • Karma: +556/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Automation issue with Tagged Values in Oracle DB
« Reply #3 on: March 09, 2016, 03:25:38 am »
I don't think you should be using the TaggedValuesEx collection.

Try to do the same with TaggedValues collection instead.

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Automation issue with Tagged Values in Oracle DB
« Reply #4 on: March 09, 2016, 08:05:58 am »
Honestly, the documentation is not clear about that. The Ex method is r/o as the no-Ex. Though I belief you are right.

Roy, this should be noted in the help.


I just tried the addNew with the Ex variant. Works without issue.

q.

P.S. The bug you linked is for V9. Which release is yours?
« Last Edit: March 09, 2016, 08:10:13 am by qwerty »

emourot

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Automation issue with Tagged Values in Oracle DB
« Reply #5 on: March 09, 2016, 07:36:32 pm »
Hello  ;D

I develop on a virtual machine with EA 12 (we plan to install EA 12 in Eurocontrol)
And my workstation has EA 10 installed, and my colleagues also.

For your information, my issue is the same with TaggedValue and TaggedValueEx collections.

As investigation, on yesterday, I used Oracle SQL Developer and tried to reproduce the Oracle error I got :

Code: [Select]
SQL Error: ORA-01400: cannot insert NULL into ("IB0040_ENT_ARCH_TEST"."T_OBJECTPROPERTIES"."PROPERTYID")
And I got exactly the same error with the following request :

Code: [Select]
INSERT INTO t_objectproperties (propertyid,object_id,property,value,notes,ea_guid)
VALUES ('',6408,'HPALM_ReqID',1,'','')

Two solutions :
  • The PropertyID should be generated by EA and it is not. We've to do a bug report.
  • The PropertyID is auto-generated and incremented by database. So in Oracle schema, this auto-numbering is disabled.

Quick and dirty solution (I need your opinion on it) :
Use a direct SQL statement on SQL database

Code: [Select]
INSERT INTO t_objectproperties
SELECT MAX(propertyid) +1,6408,'HPALM_ReqID',1,'',(GUID to be generated with EA)
FROM t_objectproperties

And execute it via the Repository.Execute( sql ); method

Cheers.
Emmanuel @ Eurocontrol
« Last Edit: March 09, 2016, 07:38:15 pm by emourot »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13286
  • Karma: +556/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Automation issue with Tagged Values in Oracle DB
« Reply #6 on: March 09, 2016, 07:45:11 pm »
Emmanuel,

You should definitely check this with Sparx support.
They should be able to tell you if the ID field should be auto-increment or not.

You can also check the dberror.txt file in your %appdata%\Sparx Systems\EA folder.
That should contain the exact sql statement that triggered the error.

Geert

emourot

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Automation issue with Tagged Values in Oracle DB
« Reply #7 on: March 09, 2016, 08:32:28 pm »
By checking the dberror.txt file I've read the following message :

Code: [Select]
08-03-2016 15:12:48
OraOLEDB [-2147217900]

ORA-01400: cannot insert NULL into ("IB0040_ENT_ARCH_TEST"."T_OBJECTPROPERTIES"."PROPERTYID")

Context:
Select * from t_objectproperties where PropertyID=0

Don't know its meaning...
I've also asked for an official Sparx Support.