seerick
seerick

Reputation: 31

stringtemplate4 Getting "Anonymous()" as output

Trying to figure out what I'm doing wrong here.

public String getSysJobTempl(String JobID, String SysID, String JobCode, String SchedID) {

    String finalString= "";

    ST sysJob = new ST("INSERT INTO system_job (SYSTEM_JOB_ID,SYSTEM_ID,CODE,IS_ACTIVE,DELAY_TIME,JOB_SCHEDULER_ID) VALUES ('<jobid>','<sysid>','<jobcode>','1','00:00:00','<schedid>');");
    sysJob.add("jobid", JobID);
    sysJob.add("sysid", SysID);
    sysJob.add("jobcode", JobCode);
    sysJob.add("schedid", SchedID);

    finalString = sysJob.toString();

    return finalString;
}

Then later calling like:

String sysJob = myTemp.getSysJobTempl(getPjobID(), getPsysID(), getPjobCode(), getSchedulerID());
osw.newLine();
osw.write(sysJob);

Gives the output of "anonymous()" instead of the insert. What am I doing wrong here?

Upvotes: 0

Views: 80

Answers (1)

seerick
seerick

Reputation: 31

Nevermind I found the answer but figure I should post it and leave it in case others come across it.

I needed to change .toString() to the api version of it called .render() Once I did that it worked.

Missed that bit in the documentation till I went back and looked again.

Upvotes: 1

Related Questions