You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Samuel Trégouët (Jira)" <ji...@apache.org> on 2019/09/18 09:12:00 UTC

[jira] [Updated] (OFBIZ-11203) get Delegator instance without calling `main`

     [ https://issues.apache.org/jira/browse/OFBIZ-11203?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Samuel Trégouët updated OFBIZ-11203:
------------------------------------
    Description: 
I'd like to run a groovy script to make some database queries without running a full ofbiz server. Something like the following

 

```groovy
 Delegator d = getDelegator("default")println("will make call on database")def result = EntityQuery.use(d).from("Product").queryList()println(result)
 ```

 

But to do so I need to call `ComponentContainer.init` which retrieve `Config` from `Start` singleton. So to make my use case work I only need a public `setConfig` method on `Start` class, is this ok for you ?

  was:
I'd like to run a groovy script to make some database queries without running a full ofbiz server. Something like the following

 

```groovy

{{}}
Delegator d = getDelegator("default")println("will make call on database")def result = EntityQuery.use(d).from("Product").queryList()println(result)
```

 

But to do so I need to call `ComponentContainer.init` which retrieve `Config` from `Start` singleton. So to make my use case work I only need a public `setConfig` method on `Start` class, is this ok for you ?


> get Delegator instance without calling `main`
> ---------------------------------------------
>
>                 Key: OFBIZ-11203
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-11203
>             Project: OFBiz
>          Issue Type: Improvement
>            Reporter: Samuel Trégouët
>            Priority: Major
>         Attachments: start-setconfig.patch
>
>
> I'd like to run a groovy script to make some database queries without running a full ofbiz server. Something like the following
>  
> ```groovy
>  Delegator d = getDelegator("default")println("will make call on database")def result = EntityQuery.use(d).from("Product").queryList()println(result)
>  ```
>  
> But to do so I need to call `ComponentContainer.init` which retrieve `Config` from `Start` singleton. So to make my use case work I only need a public `setConfig` method on `Start` class, is this ok for you ?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)