Uploaded image for project: 'Seam 2'
  1. Seam 2
  2. JBSEAM-2243

org.jboss.seam.persistence.HibernateSessionProxy does not implement org.hibernate.event.EventSource

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 2.0.0.GA
    • Fix Version/s: 2.0.1.GA, 2.1.0.A1
    • Component/s: None
    • Labels:
      None

      Description

      When using the following search pattern:
      FullTextEntityManager fullTextEntityManager = org.hibernate.search.jpa.Search.createFullTextEntityManager(em);
      MultiFieldQueryParser parser = new MultiFieldQueryParser(new String[]

      {"username", "description"}

      , new SloAnalyzer());
      org.apache.lucene.search.Query query = parser.parse( this.qs );
      javax.persistence.Query hibQuery = fullTextEntityManager.createFullTextQuery( query, User.class );

      The code dies with something in the lines of "FullTextHibernateSessionProxy cannot be cast to EventSource".

      This happens because of constructor in org.hibernate.search.impl.FullTextSessionImpl:
      public FullTextSessionImpl(org.hibernate.Session session)

      { this.session = (Session) session; this.eventSource = (EventSource) session; this.sessionImplementor = (SessionImplementor) session; }

      The quick solution is to fix org.jboss.seam.persistence.HibernateSessionProxy (which is extended by FullTextHibernateSessionProxy) to implement org.hibernate.event.EventSource and add the following code:
      public void delete(String arg0, Object arg1, boolean arg2, Set arg3)

      { ((EventSource) delegate).delete(arg0, arg1, arg2, arg3); }

      public void forceFlush(EntityEntry arg0) throws HibernateException

      { ((EventSource) delegate).forceFlush(arg0); }

      public ActionQueue getActionQueue()

      { return ((EventSource) delegate).getActionQueue(); }

      public Object instantiate(EntityPersister arg0, Serializable arg1)
      throws HibernateException

      { return ((EventSource) delegate).instantiate(arg0, arg1); }

      public void merge(String arg0, Object arg1, Map arg2)
      throws HibernateException

      { ((EventSource) delegate).merge(arg0, arg1, arg2); }

      public void persist(String arg0, Object arg1, Map arg2)
      throws HibernateException

      { ((EventSource) delegate).persist(arg0, arg1, arg2); }

      public void persistOnFlush(String arg0, Object arg1, Map arg2)

      { ((EventSource) delegate).persistOnFlush(arg0, arg1, arg2); }

      public void refresh(Object arg0, Map arg1) throws HibernateException

      { ((EventSource) delegate).refresh(arg0, arg1); }

      public void saveOrUpdateCopy(String arg0, Object arg1, Map arg2)
      throws HibernateException

      { ((EventSource) delegate).saveOrUpdateCopy(arg0, arg1, arg2); }

      I have not gone into details if any of these methods need to do EL interpolation or not, but my first hunch tells me that either no or it's not important for this usage scenario.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  epbernard Emmanuel Bernard
                  Reporter:
                  boky29 Bojan Cekrlic
                • Votes:
                  1 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: