[jbossseam-issues] [JBoss JIRA] Updated: (JBSEAM-2243) org.jboss.seam.persistence.HibernateSessionProxy does not implement org.hibernate.event.EventSource

Pete Muir (JIRA) jira-events at lists.jboss.org
Tue Nov 13 04:47:44 EST 2007


     [ http://jira.jboss.com/jira/browse/JBSEAM-2243?page=all ]

Pete Muir updated JBSEAM-2243:
------------------------------

     Issue Type: Bug  (was: Patch)
    Component/s:     (was: Core)
                     (was: EJB3)
       Assignee: Emmanuel Bernard

> org.jboss.seam.persistence.HibernateSessionProxy does not implement org.hibernate.event.EventSource
> ---------------------------------------------------------------------------------------------------
>
>                 Key: JBSEAM-2243
>                 URL: http://jira.jboss.com/jira/browse/JBSEAM-2243
>             Project: JBoss Seam
>          Issue Type: Bug
>    Affects Versions: 2.0.0.GA
>            Reporter: Bojan Cekrlic
>         Assigned To: Emmanuel Bernard
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list