Skip to main content

[jsr352-public] Re: Injection into a Batchlet

  • From: Vijay Nair < >
  • To:
  • Subject: [jsr352-public] Re: Injection into a Batchlet
  • Date: Sun, 5 May 2013 00:05:39 +0530

Hi Mahesh,

****************
Batchlet code
****************

package com.ofss;

import javax.batch.api.AbstractBatchlet;
import javax.batch.api.BatchProperty;
import javax.batch.runtime.context.JobContext;
import javax.inject.Inject;
import javax.persistence.EntityManager;

public class FCUBSBatchlet extends AbstractBatchlet{
   
    @Inject
    @UBS
    EntityManager em;
   
    @Inject
    JobContext jobCtx;
   
    @Inject
    @BatchProperty(name="procedureName")
    private String procedureName;
   
    @Inject
    @BatchProperty(name="procedureMethod")
    private String procedureMethod;
    @Override
    public String process(){
        try{
            System.out.println("Entity Manager is*****"+em); //Returns null
            return "SUCCESS";
        }catch(Exception ex){
            ex.printStackTrace();
            return "FAILURE";
        }
    }
}

**********
Job XML
**********
<job id="FCEODJOB-1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
    <step id="step-1">
        <batchlet ref="ubsBatchlet">
            <properties>
                <property name="procedureName" value="XXXXX"/>
                <property name="procedureMethod" value="YYYYYY"/>
            </properties>
        </batchlet>
    </step>
</job>

Thanks...Vijay


[jsr352-public] Injection into a Batchlet

fusionvj 05/04/2013

[jsr352-public] Re: Injection into a Batchlet

05/04/2013

[jsr352-public] Re: Injection into a Batchlet

Vijay Nair 05/04/2013

[jsr352-public] Re: Injection into a Batchlet

Scott Kurz 05/06/2013

[jsr352-public] Re: Injection into a Batchlet

Scott Kurz 05/06/2013

[jsr352-public] Re: Injection into a Batchlet

Vijay Nair 05/06/2013

[jsr352-public] Re: Injection into a Batchlet

Scott Kurz 05/06/2013

[jsr352-public] Re: Injection into a Batchlet

Vijay Nair 05/06/2013

[jsr352-public] Re: Injection into a Batchlet

Scott Kurz 05/06/2013

[jsr352-public] Re: Injection into a Batchlet

Vijay Nair 05/06/2013

[jsr352-public] Re: Injection into a Batchlet

Scott Kurz 05/06/2013

[jsr352-public] Re: Injection into a Batchlet

Ricardo Cervera-Navarro 05/06/2013

[jsr352-public] Re: Injection into a Batchlet

Vijay Nair 05/07/2013
 
 
Close
loading
Please Confirm
Close