Hi Dave
Okay the code is below.  What I am doing is creating
sampleRequest from the action, then calling isAllowed.
 The sampleRequest is being successfully made and
persisted in the db.  The isAlowed is failing.  I got
both working from fine from the command line.  I am a
relative struts newbie and this is the first time I am
trying this type of coding under Tomcat 5.5.12. 
Thanks for your attention and any comments.

public class sampleRequest
    implements InstanceCallbacks {

  private String fromHere;
  private Date atThisTime;
  private String thisMP3;
  private String thisSession;
  private String type;

  public sampleRequest() {
  }

  public sampleRequest(String remoteAddr, Date
dateTime, String thisMP3,
                       String thisSession, String
type, PersistenceManager pm) {

/**
    PersistenceManagerFactory pmf =
KodoHelper.getPersistenceManagerFactory(
        "kodo.properties");
    PersistenceManager pm =
pmf.getPersistenceManager();

**/
    String db =
pm.getPersistenceManagerFactory().getConnectionURL();
    System.out.println("the database= " + db);
    this.fromHere = remoteAddr;
    this.atThisTime = dateTime;
    this.thisMP3 = thisMP3;
    this.thisSession = thisSession;
    this.type=type;
    pm.currentTransaction().begin();
    pm.makePersistent(this);
    pm.currentTransaction().commit();
    //pm.close();  
}

  public boolean isAllowed(int
samples,PersistenceManager pm) {
    //051112 cp could be very dangerous on the issue
of closing the pm.
    //051112 cp for production really the same issues,
just getting it from the TC plugin.
    //051120 cp question if I can really use the same
pm.  cant get a new one.
    //051121 cp i am assuming the pm will "stay" with
the object.  this could be dangerous.
/**
    PersistenceManagerFactory pmf =
KodoHelper.getPersistenceManagerFactory("kodo.properties");
    PersistenceManager pm =
pmf.getPersistenceManager();
 **/

    KodoQuery q = (KodoQuery)
pm.newQuery(filesDM.helper.sampleRequest.class,"thisSession==thisSession
& thisSession!=null");
    q.setResult("count(this)");
    Long count = (Long) q.execute();
    System.out.println("from isAllowed count= " +
count);
    q.close(count);
    pm.close();
    boolean
returnValue=(samples<count.intValue()?false:true);
    System.out.println("samples < count.intValue())?
false : true "+returnValue);
    return returnValue;
  }
}

--- Dave Newton <[EMAIL PROTECTED]> wrote:

> Chris Pat wrote:
> 
> >Can anyone provide any insight? 
> >  
> >
> Not too much without information (code, configs,
> ...)
> 
> Dave
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 



        
                
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to