]
Bojan Cekrlic commented on JBSEAM-2243:
---------------------------------------
This was found in one of the usage examples (i think it was even Seam tutorial).
I don't see how using the injection would help solve the issue?
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: