3 Replies Latest reply on Jun 25, 2010 10:01 AM by Sean Tozer

    help needed in search

    Anitha Raj Newbie


      I have created an application using seam gen. I have site and location tables in my application. Site id is used as a foreign key in Location table. I have used @factory annotation in my locationhome.java file to get a drop down which consists of all entered site names.

      Now if i want to search the locations based on the site names that are selected, what should i do?

        • 1. Re: help needed in search
          Sean Tozer Newbie

          Are you looking to do a full-text indexed search, using hibernate lucene? Or just a regular kind of sql list?

          Seam-gen should actually create LocationList.xhtml and LocationList.java files that do a simple lookup and search. You can base your search off of those if that's sufficient. In LocationList.java, you should see a number of restrictions that you can use for searching any of the properties of the location table. If you want to search through to some property of a foreign key table, you have a few options, depending on what exactly you want to do. If you just want to show all the locations related to a selected site, that's easy to do by using the collection stored in SiteHome. If you want to then search that list, you could just iterate through the collection, or you could craft a class that used the database to query "siteid=? and locationname like '%?%'". Either way should work.

          If you want to do more powerful full-text searching, you'll need to setup the Lucene index using @field and @indexembedded annotations, and then call the indexer during startup.

          • 2. Re: help needed in search
            shyam HP Newbie

            Hai.....i am working on seam frame work....if i create a new seam project every time am getting NullPointerException....even there is a only one text box through this persisting data into database...i am getting this error.....Please tel me...solution..

            • 3. Re: help needed in search
              Sean Tozer Newbie

              Shyam, I don't mean to be rude, but your postings are extremely difficult to read. Elipsises (...) are not meant to be used as nearly as often as you use them, and they're certainly not meant to be used in place of a period. It makes you sound like Shatner, which is not conducive to getting help.

              A NullPointerException could be cause by just about anything. Without significantly more context, it's impossible to give any useful advice whatsoever.