Hi, There,
  I found a strange problem with torque :

  the following code:

          IpPhoneSession.saveIpPhoneMap(ipd.CallerIp, ipd.CallerPhone) ;
          BigDecimal caller_id=IpPhoneSession.getIdFromPhone(ipd.CallerPhone);

returns caller_id to be 0 in web environment , but in standalone environment returns 
the correct value
1212. I used mysql and IDBroker and tdk 2.2 version. the above coce basically save a 
object, and then 
immediately do a search of the db, and try to get its id back. I wonder What is the 
problem.

the whole function looks like this:


    public void doInsert(RunData data, Context context)
        throws Exception
    {
        IpPhoneData ipd = new IpPhoneData(data);
        String host=data.getRequest().getRemoteAddr();
        if (host.equals(ipd.CallerIp))
        {

          IpPhoneSession.saveIpPhoneMap(ipd.CallerIp, ipd.CallerPhone) ;
          IpPhoneSession.saveIpPhoneMap("", ipd.CalleePhone) ;

          ipd.setRunData(data) ;
         BigDecimal caller_id=IpPhoneSession.getIdFromPhone(ipd.CallerPhone);
          BigDecimal callee_id=IpPhoneSession.getIdFromPhone(ipd.CalleePhone);
          IpPhoneSession.saveCallSessionMap(caller_id, callee_id) ;
          data.getParameters().add("Result","success") ;
        }
        else
          data.getParameters().add("Result","fail") ;

          setTemplate ( data, "IpPhoneSessionIndex.vm" );
    }

another strange thing is that when I take the line 

setTemplate ( data, "IpPhoneSessionIndex.vm" );
off, it doesn't save any record into db at all.

Does somebody know ?

Jinsong

Reply via email to