You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Stéphane MOR <st...@yahoo.fr> on 2002/02/25 04:41:36 UTC

Turbine 2.1 - Torque : How to access the data ?

Hello,

I'm very enthusiasthic about Turbine, and moreover about Torque.
This is why I started using Turbine (2.1, awaiting decoupled versions !).
Templates, Layouts, Navigations and Screens work fine, but I can't use any
Torque
code !

I read each and every HOW-TO, tutorial on Turbine's site, but couldn' t find
any answer to
"how to integrate Torque in Turbine ?".
Analysing the TDK's source code didn't help as Flux is integrated as a tool,
which is a
quite different thing (I think so, at least).

In my own app, Flux tool works fine, and I can access Roles, Permissions,
etc.
easily but my data can't be accessed, whereas they are both sharing the same
database.

To start simple I only have this configuration :

- a schema : shop-schema.xml :
<database name="shop">
    <table name="customer">
        <column name="id" size="99" type="VARCHAR"/>
        <column name="name" size="99" type="VARCHAR"/>
    </table>
</database>
which generated the appropriate CustomerPeer, CustomerBase and Customer.
I have no problems at all with schemas and Torque Ant Tasks.

- a screen : ${package}.modules.screens.Default
public class Default extends VelocityScreen
{
    public void doBuildTemplate(RunData data, Context context) throws
Exception
    {
        Criteria crit = new Criteria();
        Vector customers = CustomerPeer.doSelect(crit);
        context.put("customers", customers);
    }
}
I am not sure at all that this code should be there ...

- a template : ${WEBAPP_ROOT}/templates/app/screens/Default.vm
The customers :<br/>
#foreach ( $customer in $customers )
Name : $customer.Name   ,     ID : $customer.Id    <br/>
#end
I tried using fake Customer classes instead of the Torque ones with success
in this
template.

When trying to retrieve my data, i get a : " java.SQL.SQLException :
Connection Object
is null ! " log in turbine.log , and a redirection to the error template.

What I would like is a very basic and simple plan to integrate Torque in
Turbine :
1) configure Turbine like that (actually as Flux works I guess it is
correctly configured )
2) write your Criteria code in this class (Action ? Screen ?)
3) initialize the connection like this
etc.

This is the last thing that prevents me from switching definitely to
Turbine, so I hope it
can be solved !

Thanks a lot (even without Torque I had a great pleasure discovering and
playing with
Turbine !).

Stephane



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Turbine 2.1 - Torque : How to access the data ?

Posted by Stéphane MOR <st...@yahoo.fr>.
I think so, because the Flux tools work.
My database "shop" contains all the "turbine_ ..." tables and my table
"customer"
with the proper fields ("name" & "id").

When I edit Roles and Groups and Permissions, etc. from within my Turbine
app
( using the Flux tool from the TDK's "Newapp") everything is fine and my db
is updated.

I don't think the problem comes from my settings ...

Thanx, anyway.

----- Original Message -----

> Hi,
>
> Are the database settings in your app's TurbineResources.properties
> correct? (JDBC URL, username, password, etc.)
>
> Hope this helps,
> -jeff



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Turbine 2.1 - Torque : How to access the data ?

Posted by Jeff Linwood <je...@greenninja.com>.
Hi,

Are the database settings in your app's TurbineResources.properties
correct? (JDBC URL, username, password, etc.)

Hope this helps,
-jeff
----- Original Message -----
From: "Stéphane MOR" <st...@yahoo.fr>
To: <tu...@jakarta.apache.org>
Sent: Sunday, February 24, 2002 9:41 PM
Subject: Turbine 2.1 - Torque : How to access the data ?


> Hello,
>
> I'm very enthusiasthic about Turbine, and moreover about Torque.
> This is why I started using Turbine (2.1, awaiting decoupled versions !).
> Templates, Layouts, Navigations and Screens work fine, but I can't use any
> Torque
> code !
>
> I read each and every HOW-TO, tutorial on Turbine's site, but couldn' t
find
> any answer to
> "how to integrate Torque in Turbine ?".
> Analysing the TDK's source code didn't help as Flux is integrated as a
tool,
> which is a
> quite different thing (I think so, at least).
>
> In my own app, Flux tool works fine, and I can access Roles, Permissions,
> etc.
> easily but my data can't be accessed, whereas they are both sharing the
same
> database.
>
> To start simple I only have this configuration :
>
> - a schema : shop-schema.xml :
> <database name="shop">
>     <table name="customer">
>         <column name="id" size="99" type="VARCHAR"/>
>         <column name="name" size="99" type="VARCHAR"/>
>     </table>
> </database>
> which generated the appropriate CustomerPeer, CustomerBase and Customer.
> I have no problems at all with schemas and Torque Ant Tasks.
>
> - a screen : ${package}.modules.screens.Default
> public class Default extends VelocityScreen
> {
>     public void doBuildTemplate(RunData data, Context context) throws
> Exception
>     {
>         Criteria crit = new Criteria();
>         Vector customers = CustomerPeer.doSelect(crit);
>         context.put("customers", customers);
>     }
> }
> I am not sure at all that this code should be there ...
>
> - a template : ${WEBAPP_ROOT}/templates/app/screens/Default.vm
> The customers :<br/>
> #foreach ( $customer in $customers )
> Name : $customer.Name   ,     ID : $customer.Id    <br/>
> #end
> I tried using fake Customer classes instead of the Torque ones with
success
> in this
> template.
>
> When trying to retrieve my data, i get a : " java.SQL.SQLException :
> Connection Object
> is null ! " log in turbine.log , and a redirection to the error template.
>
> What I would like is a very basic and simple plan to integrate Torque in
> Turbine :
> 1) configure Turbine like that (actually as Flux works I guess it is
> correctly configured )
> 2) write your Criteria code in this class (Action ? Screen ?)
> 3) initialize the connection like this
> etc.
>
> This is the last thing that prevents me from switching definitely to
> Turbine, so I hope it
> can be solved !
>
> Thanks a lot (even without Torque I had a great pleasure discovering and
> playing with
> Turbine !).
>
> Stephane
>
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>