Enity bean for reading

Discussions

EJB programming & troubleshooting: Enity bean for reading

  1. Enity bean for reading (2 messages)

    Hi ,
     Is it a good idea to use entity bean to read data from the db? If the functionality of the bean is just to see if a particular row exists in the database(for example a user's permission to some resource), is entity bean a good idea?? Also, if the db row gets changed by some other source while the user is logged on, how can it be reflected to the user? Will an EJB finder method return me the latest db data??

    Thanks
    George

    Threaded Messages (2)

  2. Re: Enity bean for reading[ Go to top ]

    If the functionality is just to see if a particular row exists, entity bean is an over-kill, because there are a lot of overheads involve in maintaining an EJB. I would suggest to just use JDBC to serve this purpose.

    For your second question (If the db row gets changed by some other source), if you're referring to the same operation above (i.e. check if a particular row exists), then I believe it is enough to use JDBC without cache, so that you read from the db every single time.

    However, if you're referring to more complicated operation, then it may justify the usage of entity bean (you know, the synchronization between db and entity bean is managed by the EJB container).
  3. Re: Enity bean for reading[ Go to top ]

    Thanks Alan for the response. I appreciate that.