static methods and EJB's

Discussions

EJB programming & troubleshooting: static methods and EJB's

  1. static methods and EJB's (3 messages)

    OK, I know it's acceptable to have a class with a statick method that calls an EJB (e.g. a singleton calling an ejb). And I know it's not acceptable to have a static method inside an EJB. But what if you have an EJB that uses a class that has a static method? I'm thinking of doing this (pseudocode):

    ApplicationDAO, with a method like this: static void updateDatabaseRecord(appId, some values)

    And then have an ejb called ApplicationManagerBean that uses ApplicationDAO.updateDatabaseRecord

    Is that ok?? THanks

    Threaded Messages (3)

  2. static methods and EJB's[ Go to top ]


    Yes you can do that. Don't expect your class containing the static method to be a singleton though... that you can't count on.

    Daniel.
  3. static methods and EJB's[ Go to top ]

    I was planning on the data acess classes just being a bunch of static methods. I see no need to create objects, that's just unnecessary overhead for classes that do nothing but store and retrieve data. THis is an ASP environment and needs to be VERY scalable and memory conscious. It will be thread-safe, I just wasn't sure if I was going against the EJB spec.

    Other opinions?
  4. static methods and EJB's[ Go to top ]

    ttt