« Return to Thread: JNDI connection pooling issues

Re: Environment datasource details from service

by burtbeckwith :: Rate this Message:

Reply to Author | View in Thread

You shouldn't create a new service instance:
>          def pricelistService = new PricelistService()

use dependency injection like you did for the DataSource:

      def pricelistService

      def list = {
          pricelistService.fromERPtoWeb()
      ....

and you'll get the proper singleton service instance with its dependencies
injected.

Burt


On Friday 02 May 2008 1:44:50 am Ladislav Skokan wrote:

>  Jeff,
>
>  this is my service:
>
>  class PricelistService {
>
>      def dataSource
>     
>      boolean transactional = true
>
>      def fromERPtoWeb() {
>          println "!!! Info " + dataSource
>         
>      }
>
>  }
>
>  Invoking from controller, from list()
>
>      def list = {
>
>          def pricelistService = new PricelistService()
>          pricelistService.fromERPtoWeb()
>      ....
>
>  L.      
>
>
>  Jeff Brown napsal(a):
> On Thu, May 1, 2008 at 5:22 PM, Ladislav Skokan <lsk@...> wrote:
>
>  Jeff,
>
>  if does not seems to work. the "dataSource" is always null.
>
>  L.
>
>
>
> Can you show me what your service class looks like?  Also, can you
> show the class that is using the service?
>
>
>
> jb
>
>
>
>    --------------------------------------------------------------------- To
> unsubscribe from this list, please visit:
> http://xircles.codehaus.org/manage_email



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


 « Return to Thread: JNDI connection pooling issues

LightInTheBox - Buy quality products at wholesale price