2 Replies Latest reply on Apr 29, 2008 4:06 PM by metal610

    Possible Bug

    metal610

      Hi all,


      I may have found a bug in Seam, but I'm not sure of a few things.


      1. If it is even a bug or if it's just my application.


      2. Where and how to appropriately track the bug.


      This problem only occurs right after the web project has been first deployed. When I go to a page that uses a HibernateEntityQuery object, it tells me that the session is null. But, if I refresh the page, it works just fine. This only happens on this page. If I go to another page after startup, then it works fine.


      Any feedback would be great.


      Thanks,


      Robert

        • 1. Re: Possible Bug
          jbalunas.jbalunas.jboss.org

          1. If it is even a bug or if it's just my application.

          Could you post some more info about your app and environment?



          • app server?

          • version of seam?

          • configuration details?

          • Have you taken a look at the examples and maybe seen a similar application to compare with?





          2. Where and how to appropriately track the bug.

          Seam uses Jira to track defects, features, and tasks.  It is often useful to search the forums and Jira for the problem as well.


          http://jira.jboss.com/jira/browse/JBSEAM


          • 2. Re: Possible Bug
            metal610

            Here's the info on my setup:


            JBoss 4.2.1.GA
            Seam 2.1.0.A1


            This is the class that the error is happening with,


            package us.gaaoc.ejb.list;
            
            import org.hibernate.Session;
            import us.gaaoc.entity.*;
            import org.jboss.seam.annotations.Name;
            import java.util.List;
            import java.util.Arrays;
            import org.jboss.seam.ScopeType;
            import org.jboss.seam.annotations.In;
            import org.jboss.seam.annotations.Scope;
            import org.jboss.seam.framework.HibernateEntityQuery;
            
            @Name("eventTList")
            @Scope(ScopeType.SESSION)
            public class EventTList extends HibernateEntityQuery<EventT> {
            
                @In
                private Session registrationDatabase;
                
                 private static final String[] RESTRICTIONS = {
                           "lower(eventT.id) like concat(lower(#{eventTList.eventT.id}),'%')",
                           "lower(eventT.discription) like concat(lower(#{eventTList.eventT.discription}),'%')",
                           "lower(eventT.location) like concat(lower(#{eventTList.eventT.location}),'%')",
                           "lower(eventT.name) like concat(lower(#{eventTList.eventT.name}),'%')",};
            
                 private EventT eventT = new EventT();
            
                 @Override
                 public String getEjbql() {
                      return "select eventT from EventT eventT";
                 }
            
                 @Override
                 public Integer getMaxResults() {
                      return 10;
                 }
            
                 public EventT getEventT() {
                      return eventT;
                 }
            
                 @Override
                 public List<String> getRestrictions() {
                      return Arrays.asList(RESTRICTIONS);
                 }
            
                @Override
                public Session getSession() {
                    return registrationDatabase;
                }
            
                @Override
                public void setSession(Session arg0) {
                    super.setSession(registrationDatabase);
                }
            
                    
            }
            
            



            The reason behind injecting the Session is because when I don't, I get an error saying that the resultList cannot be read. Therefore I have to overwrite the Session with mine for it to work.


            My configuration is simple. All it does it set up the session.


            <core:init debug="@debug@" jndi-pattern="@jndiPattern@"/>
                
                <core:manager concurrent-request-timeout="500" 
                              conversation-timeout="120000" 
                              conversation-id-parameter="cid"
                              parent-conversation-id-parameter="pid"/>
            
                <persistence:hibernate-session-factory name="factoryForTheSessions"/>
                
                <persistence:managed-hibernate-session name="registrationDatabase" auto-create="true" session-factory="#{factoryForTheSessions}"/>
                
                <transaction:hibernate-transaction session="#{registrationDatabase}"/>
            



            I've taken a look at the seam-gen code that was generated for me, that's where I got this code from, but it didn't include any hibernate set up, or at least I couldn't get it to work, so I guess, no, I have nothing to compare it to, and yes, I may possibly have something to compare it to.