You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Angelo Chen <an...@yahoo.com.hk> on 2007/09/14 10:31:18 UTC

T5: Hibernate and InjectService

Hi,

I need to use Tapestry-Hibernate in a service, what is the correct way of
calling the Session? following construct does not compile:

     @InjectService("Session") Session _session;

     public List members() {
       
        List lst = _session.createQuery("from MemberNew m order by name
desc").list();
        return lst;

    }
-- 
View this message in context: http://www.nabble.com/T5%3A-Hibernate-and-InjectService-tf4440952.html#a12670846
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: T5: Hibernate and InjectService

Posted by Davor Hrg <hr...@gmail.com>.
You were probably just mislead by how things work for pages and compoenents,

tapestry does much more to pages and components, like parameter injection
for example.

however for services there  are (as I'm aware) two ways only to inject,
via constructor for autobuilt services, and via builderMethod parameters.
this fact should be better explained in the docs...

for a parameter in a page you must explicitly say @Inject
but for service
 - autobuilt services -  it is default behavior for container to look at
longest constructor
and to try to find a service that matches each constructor parameter type.
 - services built via buildMyService methods, dependancies are all the
parameters of the builder method

Davor Hrg

On 9/14/07, Angelo Chen <an...@yahoo.com.hk> wrote:
>
>
> Hi Davor,
>
> This works, kind of amazing, I read that section about service, but can't
> find info about this, maybe I'm not reading enough? Thanks,
> A.C.
>
>
> Davor Hrg wrote:
> >
> > declare Session as parameter in you service constructor
> > you dont even need to call any inject annotation ...
> >
> >
> > MyServiceImpl(Session session){
> >   this.session=session;
> > }
> >
> > in your module use:
> >
> >   public static void bind(ServiceBinder binder)
> >   {
> >     binder.bind(MyService.class, MyServiceImpl.class);
> >   }
> >
> >
> >
> >
> > please read this page:
> > http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/T5%3A-Hibernate-and-InjectService-tf4440952.html#a12672539
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: T5: Hibernate and InjectService

Posted by Angelo Chen <an...@yahoo.com.hk>.
Hi Davor,

This works, kind of amazing, I read that section about service, but can't
find info about this, maybe I'm not reading enough? Thanks,
A.C.


Davor Hrg wrote:
> 
> declare Session as parameter in you service constructor
> you dont even need to call any inject annotation ...
> 
> 
> MyServiceImpl(Session session){
>   this.session=session;
> }
> 
> in your module use:
> 
>   public static void bind(ServiceBinder binder)
>   {
>     binder.bind(MyService.class, MyServiceImpl.class);
>   }
> 
> 
> 
> 
> please read this page:
> http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html
> 
> 

-- 
View this message in context: http://www.nabble.com/T5%3A-Hibernate-and-InjectService-tf4440952.html#a12672539
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: T5: Hibernate and InjectService

Posted by Davor Hrg <hr...@gmail.com>.
declare Session as parameter in you service constructor
you dont even need to call any inject annotation ...


MyServiceImpl(Session session){
  this.session=session;
}

in your module use:

  public static void bind(ServiceBinder binder)
  {
    binder.bind(MyService.class, MyServiceImpl.class);
  }




please read this page:
http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html

Davor Hrg

On 9/14/07, Angelo Chen <an...@yahoo.com.hk> wrote:
>
>
> Hi,
>
> I need to use Tapestry-Hibernate in a service, what is the correct way of
> calling the Session? following construct does not compile:
>
>      @InjectService("Session") Session _session;
>
>      public List members() {
>
>         List lst = _session.createQuery("from MemberNew m order by name
> desc").list();
>         return lst;
>
>     }
> --
> View this message in context:
> http://www.nabble.com/T5%3A-Hibernate-and-InjectService-tf4440952.html#a12670846
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: T5 & JSP Tag Libarary

Posted by Christian Gruber <ch...@gmail.com>.
Tapestry, particularly T5 uses XML/xhtml as a template, not a  
scripting language.  It doesn't interpret tags via the standard JSP  
tag system, if I am not mistaken.

JSPs are converted to servlet code which is then compiled.  No such  
transformation happens in Tapestry.  So while you might be able to use  
the existing underlying JSP code to lay out your templates  
structurally, you are certainly not able to use your taglibs.  It's  
sort of like asking if you can use your Visual Basic code in your new  
Java Program.  You can use it to inform your creation of the java  
logic, but you can't just use it as it is - not the same kind of system.

Unless I have completely misunderstood.

Christian.



On 14-Sep-07, at 5:57 PM, Angelo Chen wrote:

>
> Hi Hong,
>
> Not so sure, but I'm doubtful about using those tags with T5 when  
> even T4's
> own tags cant be used. I come from desktop background and trying to  
> find a
> framework for my first web application, evaluated JSP, GWT, Struts,  
> T4 and
> T5, and found T5 is the easiest and powerful framework among them, the
> concept is very natural reminding me of Delphi in the Windows,  
> especially
> those onActiveEvents which look very much the same as Delphi's form  
> events,
> html/java per page is similar to Delphi's dfm/pas, the only thing  
> lacking
> maybe is just a visual IDE. When learning those web frameworks I  
> have been
> always forced to read MVC tutorials of different frameworks and  
> wondering
> why I have to be back to basic every time a new framework is under
> evaluation, with T5 I started to program as soon as possible and later
> realize how come I did not read its MVC first:) However I have to be  
> honest,
> the first Hi/Lo tutorial took me several hours to complete because  
> of some
> mistakes in the tutorial, I just came across another posting  
> regarding the
> same problem yesterday, with more documenation and Ajax support T5  
> will be a
> better option.
>
>
> Hong Yu (hoyu2) wrote:
>>
>> Hi,
>>
>> I'm evaluating different web development framework right now and I  
>> have
>> found T5 very attractive. We have a large JSP Tag library that  
>> corporate
>> uses to enforce the standard interface look&feel. My question is  
>> whether
>> it is possible to use T5 and our corporate JSP Tag library together.
>>
>> Your advice would be greatly appreciated.
>>
>> Hong
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>
> -- 
> View this message in context: http://www.nabble.com/T5%3A-Hibernate-and-InjectService-tf4440952.html#a12684537
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>


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


Re: T5 & JSP Tag Libarary

Posted by Angelo Chen <an...@yahoo.com.hk>.
Hi Hong,

Not so sure, but I'm doubtful about using those tags with T5 when even T4's
own tags cant be used. I come from desktop background and trying to find a
framework for my first web application, evaluated JSP, GWT, Struts, T4 and
T5, and found T5 is the easiest and powerful framework among them, the
concept is very natural reminding me of Delphi in the Windows, especially
those onActiveEvents which look very much the same as Delphi's form events,
html/java per page is similar to Delphi's dfm/pas, the only thing lacking
maybe is just a visual IDE. When learning those web frameworks I have been
always forced to read MVC tutorials of different frameworks and wondering
why I have to be back to basic every time a new framework is under
evaluation, with T5 I started to program as soon as possible and later
realize how come I did not read its MVC first:) However I have to be honest,
the first Hi/Lo tutorial took me several hours to complete because of some
mistakes in the tutorial, I just came across another posting regarding the
same problem yesterday, with more documenation and Ajax support T5 will be a
better option. 


Hong Yu (hoyu2) wrote:
> 
> Hi,
> 
> I'm evaluating different web development framework right now and I have
> found T5 very attractive. We have a large JSP Tag library that corporate
> uses to enforce the standard interface look&feel. My question is whether
> it is possible to use T5 and our corporate JSP Tag library together. 
> 
> Your advice would be greatly appreciated.
> 
> Hong
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/T5%3A-Hibernate-and-InjectService-tf4440952.html#a12684537
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


T5 & JSP Tag Libarary

Posted by "Hong Yu (hoyu2)" <ho...@cisco.com>.
Hi,

I'm evaluating different web development framework right now and I have
found T5 very attractive. We have a large JSP Tag library that corporate
uses to enforce the standard interface look&feel. My question is whether
it is possible to use T5 and our corporate JSP Tag library together. 

Your advice would be greatly appreciated.

Hong

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