Uploaded image for project: 'OpenNMS'
  1. OpenNMS
  2. NMS-8294

Expose the complete OnmsNode object in Scriptd to avoid LazyInitializationExceptions

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: Meridian-2015.1.1, 17.1.1, Meridian-2016.1.13
    • Fix Version/s: 25.0.0
    • Security Level: Default (Default Security Scheme)
    • Labels:
      None
    • Sprint:
      Horizon 2019 - September 11th, Horizon 2019 - September 18th

      Description

      A lot of people use Scriptd to create automations based on events.

      When an event has a node associated, Scriptd gets the node and expose it. The problem is that it only exposes the top-level object, which means, if you try to list IP interfaces, categories, etc. that will throw a LazyInitializationException because the object is considered a detached object by Hibernate, as it is running outside a transaction.

      I propose to either make sure that a BeanShell/Groovy script runs inside a transaction (which will make a lot of integrations easier), or be sure that the LaziyInitializationException won't be generated.

      Currently, you have to use Groovy, in order to handle the transactions on your script and be able to perform DAO calls. This is not possible with BeanShell at the moment.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                cgorantla Chandra Gorantla
                Reporter:
                agalue Alejandro Galue
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: