Re: Hibernate Search Fix
This would also work (and would only happen at most once per request: @Scope(ScopeConstants.PERTHREAD) public static FullTextSession buildFullTextSession(HibernateSessionManager sessionManager) { return Search.getFullTextSession(sessionManager.getSession()); }
Re: Hibernate Search Fix
Seems like it's caused by your jvm's security and accessing a private class. This should work (less verbose too): public static FullTextSession buildFullTextSession( final HibernateSessionManager sessionManager, PropertyShadowBuilder propertyShadowBuilder) { Object lazyBuilder = new Object() { public FullTextSession getFullTextSession() { return Search.getFullTextSession(sessionManager.getSession()); } }; return propertyShadowBuilder.build(lazyBuilder, "fullTextSession", FullTextSession.class); }
Re: Hibernate Search Fix
Hi, Lance Java offered the following snippet of code back in http://apache-tapestry-mailing-list-archives.1045711.n5.nabble.com/grid-dont-link-hibernate-classic-session-td5669885.html -- You could add this to your app module: private static class LazyFullTextSession { private HibernateSessionManager sessionManager; public LazyFullTextSession(HibernateSessionManager sessionManager) { this.sessionManager = sessionManager; } public FullTextSession getFullTextSession() { return Search.getFullTextSession(sessionManager.getSession()); } } public static FullTextSession buildFullTextSession(HibernateSessionManager sessionManager, PropertyShadowBuilder propertyShadowBuilder) { //Seems to be failing on this line LazyFullTextSession lazy = new LazyFullTextSession(sessionManager); return propertyShadowBuilder.build(lazy, "fullTextSession", FullTextSession.class); } I'm seeing the following exception and wondering what might be causing it. I"m using 5.4.22 org.apache.tapestry5.ioc.internal.OperationException *Error invoking method public static org.hibernate.search.FullTextSession org.company.tapdemo.services.AppModule.buildFullTextSession(org.apache.tapestry5.hibernate.HibernateSessionManager,org.apache.tapestry5.ioc.services.PropertyShadowBuilder): Unable to instantiate instance of transformed class $FullTextSession_132be93a98bd23ee: java.lang.reflect.InvocationTargetException* trace - Handling page render request for page forsale/Index - Triggering event 'activate' on forsale/Index - Realizing service FullTextSession - Instantiating service FullTextSession implementation via org.company.tapdemo.services.AppModule.buildFullTextSession(HibernateSessionManager, PropertyShadowBuilder) (at AppModule.java:218) - Constructing service implementation via org.company.tapdemo.services.AppModule.buildFullTextSession(HibernateSessionManager, PropertyShadowBuilder) (at AppModule.java:218) java.lang.RuntimeException *Error invoking method public static org.hibernate.search.FullTextSession org.company.tapdemo.services.AppModule.buildFullTextSession(org.apache.tapestry5.hibernate.HibernateSessionManager,org.apache.tapestry5.ioc.services.PropertyShadowBuilder): Unable to instantiate instance of transformed class $FullTextSession_132be93a98bd23ee: java.lang.reflect.InvocationTargetException* java.lang.reflect.InvocationTargetExceptiontargetExceptionjava.lang.IllegalAccessError: tried to access class org.company.tapdemo.services.AppModule$LazyFullTextSession from class $FullTextSession_132be93a98bd23ee java.lang.IllegalAccessError *tried to access class org.company.tapdemo.services.AppModule$LazyFullTextSession from class $FullTextSession_132be93a98bd23ee* George Christman www.CarDaddy.com P.O. Box 735 Johnstown, New York
Re: Hibernate Search Fix
Interesting...thanks, Lance. Probably improves performance in search results page loading. -- View this message in context: http://tapestry.1045711.n5.nabble.com/grid-dont-link-hibernate-classic-session-tp5669885p5671534.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Hibernate Search Fix
You could add this to your app module: private static class LazyFullTextSession { private HibernateSessionManager sessionManager; public LazyFullTextSession(HibernateSessionManager sessionManager) { this.sessionManager = sessionManager; } public FullTextSession getFullTextSession() { return Search.getFullTextSession(sessionManager.getSession()); } } public static FullTextSession buildFullTextSession(HibernateSessionManager sessionManager, PropertyShadowBuilder propertyShadowBuilder) { LazyFullTextSession lazy = new LazyFullTextSession(sessionManager); return propertyShadowBuilder.build(lazy, "fullTextSession", FullTextSession.class); } Then in you component / page, you could @Inject FullTextSession.
Hibernate Search Fix
Yep. That was it...Tapestry Hibernate Session needs work to play nice within FullTextSession. Workaround is in thread below: http://tapestry.1045711.n5.nabble.com/Hibernate-Search-td4446040.html Also, JIRA already open... https://issues.apache.org/jira/browse/TAP5-1178 I would add 1. Hibernate-Lucene search is one of the hottest (or coolest!) thing out ... this would be a priority 2. (and/or) disambiguate session generated by services as a tapestry creation...to perhaps avoid the confusion. Basically, I did this... 1. First inject the HibernateSessionManager just like you would Session. import org.apache.tapestry5.hibernate.HibernateSessionManager; import org.hibernate.Session; @Inject private Session session; @Inject private HibernateSessionManager sessionManager; 2. Use it to get the session (and not wrap just the plain old session)...the session may be used elsewhere to do usual CRUD, not hibernate search FullTextSession fullTextSession = Search.getFullTextSession(sessionManager.getSession()); // instead of // FullTextSession fullTextSession = Search.getFullTextSession(session); -- View this message in context: http://tapestry.1045711.n5.nabble.com/grid-dont-link-hibernate-classic-session-tp5669885p5670148.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org