<< Back to previous view

[QB-1324] how to get names of all child configuration in quickbuild using groovy script
Created: 27/Jul/12  Updated: 31/Jul/12

Status: Resolved
Project: QuickBuild
Component/s: None
Affects Version/s: 4.0.14
Fix Version/s: None

Type: Task Priority: Major
Reporter: abhinav singh Assigned To: Robin Shen
Resolution: Fixed Votes: 0
Remaining Estimate: Unknown Time Spent: Unknown
Original Estimate: Unknown
Environment: unix


 Description   
i want to get names of all child configurations under a given parent configuration recursively.
i tried :
1-configuration.getChildren()
2-configuration.getDescendents()
but i am not able to find the result:

i have used it like this-
config = system.getConfiguration("root/testing1");
logger.info(config.getChildren().toString());

but everytime it throws error like :

Caused by: com.pmease.quickbuild.QuickbuildException: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.pmease.quickbuild.model.Configuration.children, no session or session was closed
        at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:383)
        at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:375)

 Comments   
Comment by Robin Shen [ 27/Jul/12 01:03 PM ]
groovy:

import com.pmease.quickbuild.persistence.*;

SessionManager.openSession();
try {
  def reloaded = system.configurationManager.load(<id of some configuration>);
  for (child in reloaded.getDescendents()) {
    // do something with the child.
  }
} finally {
  SessionManager.closeSession();
}
Comment by abhinav singh [ 31/Jul/12 11:07 AM ]
as solved above
for getting a list of chidren of a given parent id as
i tried as

import com.pmease.quickbuild.persistence.*;
      
    logger.info("The purpose of this script is to take backup of views of all projects");
    SessionManager.openSession();
    try {
     def reloaded = system.configurationManager.load(1);
     for (child in reloaded.getDescendents())
     {
      
     }
    } finally {
     SessionManager.closeSession();
     }


The problem is that it was working fine till yesterday,but today it is not working,
on my locally installed QB it is still working fine but on the linux server where actually it is to be deployed it is throwing error as :

Caused by: com.pmease.quickbuild.QuickbuildException: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.pmease.quickbuild.model.Configuration.children, no session or session was closed

NOTE: it was working fine till yesterday
Generated at Fri May 17 12:31:43 UTC 2024 using JIRA 189.