Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Error when copying configuration recursively #3677

emna.bey ·
Hello,

I'm currently working on a configuration which can copy an existing configuration recursively using Groovy.
Here is my code:
def newConf = system.configurationManager.copyAsNew(sourceConf, true);


when executing the configuration, I got this error:
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.pmease.quickbuild.model.Configuration.children, no session or session was closed

Thanks for your help, and regards,
Emna
  • replies 3
  • views 1055
  • stars 0
robinshen ADMIN ·
Please run below script on QB server:

groovy:
import com.pmease.quickbuild.persistence.*;
SessionManager.openSession();
try {
def sourceConf = system.configurationManager.get("path/to/source/conf");
def newConf = system.configurationManager.copyAsNew(sourceConf, true);
// continue to call configuration manager to save copied configuration and all the children, refer to ConfigurationResource.java in source code for more information
....
} finally {
SessionManager.closeSession();
}
HealingQuickly ·

Hi Robin Shen. What happens after the newConf variable is created? How to use it to actually create the new config in the script, and how to name that new config?

Thank you

robinshen ADMIN ·