4 Replies Latest reply on May 14, 2003 12:39 PM by Nicolas Fournier

    no ejb select in home limitation

    Nicolas Fournier Newbie

      This week is the first time I needed to get only one field from an ejb. So I set up a find that does so but it did not work.

      Digging up a bit I found the existance of ejb Selects which supported what I want. But they can only be defined in the bean. I was really amazed, I would really like to know the valid technical explaination behind this limitation. But that's not the point of my post.

      Currently I have a field in a bean called category, and I want to know which one are used doing only one access to db. The thing is I need to do a find before being able to call the ejbSelect on the bean. I found two possible workarounds but they do not meat my criteria of no db access:

      1- findAll and take first. With small number of beans, could work ok. But will at least result in a select of the primary keys. But that's not my case, there will be several thousands of rows in my case.

      2-findOne using jboss-ql and putting a LIMIT 1. But then it is not portable and each time I need a ejbSelect I also need to add a findOne.

      Does somebody a better solution ??