You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Nomen Nomanum <ge...@outlook.com> on 2013/05/18 22:05:03 UTC

Adding search service in Tapestry app

Hi. I am about to implement Hibernate Search +Lucene service in my Tap. Is there anything I should get in concern before doing it? How to wrap/decorate that service? And how could I make service to be injected? Thanks in reply.
 		 	   		  

Re: Adding search service in Tapestry app

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Sat, 18 May 2013 17:05:03 -0300, Nomen Nomanum <ge...@outlook.com>  
wrote:

> Hi. I am about to implement Hibernate Search +Lucene service in my Tap.

Hi! First of all, read this:  
http://tapestry.apache.org/defining-tapestry-ioc-services.html.

> Is there anything I should get in concern before doing it?

Learn what a Tapestry IoC service is.
If you don't know the basics of Hibernate and Lucene yet, do it. I haven't  
yet.

> How to wrap/decorate that service?

I don't know why you're asking this now, but check this  
http://tapestry.apache.org/service-advisors.html and this  
http://tapestry.apache.org/tapestry-ioc-decorators.html.

> And how could I make service to be injected?

Just make it a Tapestry IoC service and it's automatically injectable.

-- 
Thiago H. de Paula Figueiredo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


RE: Adding search service in Tapestry app

Posted by Nomen Nomanum <ge...@outlook.com>.
Thanks Thiago and Lance! I will try this and see what happens. 

> Date: Sat, 18 May 2013 21:47:22 +0100
> Subject: Re: Adding search service in Tapestry app
> From: lance.java@googlemail.com
> To: users@tapestry.apache.org
> 
> Unfortunately, hibernate's Search.getFullTextSession(...) casts the session
> to a concrete type which fails if you pass the session singleton provided
> by tapestry-hibernate.
> 
> Instead, you must do something like the following in your AppModule
> 
> @Scope(ScopeConstants.PERTHREAD)
> public static FullTextSession buildFullTextSession(HibernateSessionManager
> sessionManager {
>    return Search.getFullTextSession(sessionManager.getSession());
> }
> 
> 
> 
> On 18 May 2013 21:05, Nomen Nomanum <ge...@outlook.com> wrote:
> 
> > Hi. I am about to implement Hibernate Search +Lucene service in my Tap. Is
> > there anything I should get in concern before doing it? How to
> > wrap/decorate that service? And how could I make service to be injected?
> > Thanks in reply.
> >
 		 	   		  

Re: Adding search service in Tapestry app

Posted by Lance Java <la...@googlemail.com>.
Unfortunately, hibernate's Search.getFullTextSession(...) casts the session
to a concrete type which fails if you pass the session singleton provided
by tapestry-hibernate.

Instead, you must do something like the following in your AppModule

@Scope(ScopeConstants.PERTHREAD)
public static FullTextSession buildFullTextSession(HibernateSessionManager
sessionManager {
   return Search.getFullTextSession(sessionManager.getSession());
}



On 18 May 2013 21:05, Nomen Nomanum <ge...@outlook.com> wrote:

> Hi. I am about to implement Hibernate Search +Lucene service in my Tap. Is
> there anything I should get in concern before doing it? How to
> wrap/decorate that service? And how could I make service to be injected?
> Thanks in reply.
>