You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Kevin J. Menard, Jr." <ni...@negativetwenty.net> on 2004/06/30 15:00:37 UTC

Tapestry / Torque Integration

I originally sent the following message to the spindle user group.  Based
on feedback there, I'm asking the question here to reach a wider audience.
 To make things a little more general, I've changed it to Tapestry &
Torque rather than just Spindle & Torque (although the latter is still
fine).  Any feedback would be greatly appreciated.



Hi,

I'm fairly new to using torque (Spindle even for that matter) and was
wondering if anyone had any tips/techniques for integrating torque with a
Tapestry project maintained by Spindle.  Sorry if this sounds a bit
vague, but I'm generally looking for "best of" practices.  Maybe the
collection of ideas here could be added to the wiki for others as well.

Thanks,
Kevin

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


Re: Tapestry / Torque Integration

Posted by Adam Greene <ag...@iq-2000.com>.
I used Torque with Tapestry for 3 years.  This is what I did:

1.  Put all the jars in common/lib (if using Tomcat) except torque.jar.
2.  Put torque.jar in the WEB-INF/lib
3.  I then wrote my own servlet that in the init section did :

if (!Torque.isInit()) {
<!-- Initialize Torque -->
}

4.  I create a new project to hold the Torque Generator project and set a
project dependency in the web application project to the torque generator
project.

But since doing an indepth review of Torque vs Hibernate, I switched to
hibernate :-)

It was much better in the area of cache support (Because Torque cache
support is seriously broken, I had to hack the Torque source code for
several days to get it to work) and in complex relationships and lazy
loading.

----- Original Message ----- 
From: "Todd O'Bryan" <to...@mac.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Wednesday, June 30, 2004 1:44 PM
Subject: Re: Tapestry / Torque Integration


> If you're just getting started with Torque, you may want to consider
> Cayenne or Hibernate.
>
> They seem to get much more mention around here.
>
> Todd
>
> On Jun 30, 2004, at 10:02 AM, Kevin J. Menard, Jr. wrote:
>
> >> Dunno if this is what you are looking for or not
> >
> > Thanks for the response.  And indeed, this is the sorta thing I was
> > looking for, as vague as it is.  I'm just looking for odd tidbits on
> > getting things going together.  For example, I hadn't even thought of
> > the
> > approach you took.  I wrote a ServletContextListener object to
> > initialize
> > torque for me.
> >
> > I guess something a little more concrete (and this goes along with a
> > recent post about how to layout a tapestry app) would be how others
> > actually integrate torque with their source structure.  Example
> > questions
> > here would be something like the following:
> >
> > o Do you keep the torque jars in your WEB-INF/lib directory, in your
> > servlet container's common lib directory, or elsewhere?
> >
> > o Do you integrate the OM source build process with your web app's
> > build
> > process, or do you just do it manually and move the source over?
> >
> > o How do you access the database adapters?
> >
> > o How do you integrate the two while keeping your existing Tapestry
> > stuff
> > independ enough from the Torque distribution so your project doesn't
> > get
> > cluttered?
> >
> > I guess things along those lines.  Like I said before, just general
> > best
> > practices for someone to follow.
> >
> > Thanks again,
> > Kevin
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>


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


Re: Tapestry / Torque Integration

Posted by Todd O'Bryan <to...@mac.com>.
If you're just getting started with Torque, you may want to consider 
Cayenne or Hibernate.

They seem to get much more mention around here.

Todd

On Jun 30, 2004, at 10:02 AM, Kevin J. Menard, Jr. wrote:

>> Dunno if this is what you are looking for or not
>
> Thanks for the response.  And indeed, this is the sorta thing I was
> looking for, as vague as it is.  I'm just looking for odd tidbits on
> getting things going together.  For example, I hadn't even thought of 
> the
> approach you took.  I wrote a ServletContextListener object to 
> initialize
> torque for me.
>
> I guess something a little more concrete (and this goes along with a
> recent post about how to layout a tapestry app) would be how others
> actually integrate torque with their source structure.  Example 
> questions
> here would be something like the following:
>
> o Do you keep the torque jars in your WEB-INF/lib directory, in your
> servlet container's common lib directory, or elsewhere?
>
> o Do you integrate the OM source build process with your web app's 
> build
> process, or do you just do it manually and move the source over?
>
> o How do you access the database adapters?
>
> o How do you integrate the two while keeping your existing Tapestry 
> stuff
> independ enough from the Torque distribution so your project doesn't 
> get
> cluttered?
>
> I guess things along those lines.  Like I said before, just general 
> best
> practices for someone to follow.
>
> Thanks again,
> Kevin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>


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


Re: Tapestry / Torque Integration

Posted by James Sherwood <js...@romulin.com>.
Many of those questions really depend on our project

For the om, usually I just link the omsrc so anytime i rebuild I just have
to refresh the project and its there

One project has the om in the tomcat common lib as we have multiple projects
that use many parts of the same om

For the torque lib, usually in the project and in 1 project we have torque
expanded to be part of the project as some of it had to be changed.

James
----- Original Message ----- 
From: "Kevin J. Menard, Jr." <ni...@negativetwenty.net>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Wednesday, June 30, 2004 11:02 AM
Subject: Re: Tapestry / Torque Integration


> > Dunno if this is what you are looking for or not
>
> Thanks for the response.  And indeed, this is the sorta thing I was
> looking for, as vague as it is.  I'm just looking for odd tidbits on
> getting things going together.  For example, I hadn't even thought of the
> approach you took.  I wrote a ServletContextListener object to initialize
> torque for me.
>
> I guess something a little more concrete (and this goes along with a
> recent post about how to layout a tapestry app) would be how others
> actually integrate torque with their source structure.  Example questions
> here would be something like the following:
>
> o Do you keep the torque jars in your WEB-INF/lib directory, in your
> servlet container's common lib directory, or elsewhere?
>
> o Do you integrate the OM source build process with your web app's build
> process, or do you just do it manually and move the source over?
>
> o How do you access the database adapters?
>
> o How do you integrate the two while keeping your existing Tapestry stuff
> independ enough from the Torque distribution so your project doesn't get
> cluttered?
>
> I guess things along those lines.  Like I said before, just general best
> practices for someone to follow.
>
> Thanks again,
> Kevin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>



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


Tapestry Wish List

Posted by Jeremy Kassis <jk...@jkassis.com>.
I. Simplify the Component Specification Property Binding Syntax

in a .html page template, i use this syntax...
 for ognl bindings:
 <span jwcid="someID@SomeComponent"
someParameterName="ognl:someOgnlExpression" />

 and this syntax for message bindings:
 <span jwcid="someID@SomeComponent " someParameterName
="message:someMessage" />


while in a .jwc (components) or .page (page) specification, i use this
syntax...
 for ognl bindings:
  <component id="someID" type="SomeComponent">
     <binding name="value" expression="someProperty"/>
  </component>
  
 and this syntax for message bindings:
  <component id=" someID " type=" SomeComponent ">
     <message-binding name="value" key="someProperty"/>
  </component>


and i have a <static-binding> tag and an <inherited-binding> tag!  WHEW! All
those different xml tags for something as simple as a parameter binding! Why
not just simplify the syntax? Try.

  <component id="headingInsert" type="Insert">
     <bind param="someParam" to="{type}:someValue"/>
  </component>

              OR

  <component id="headingInsert" type="Insert">
     <bind param="someParam" to="someValue" type="{type}"/>
  </component>

where {type} can be "ognl" | "literal" | "message" | "param"

i'm a real fan of "pretty" xml. and i'm sure i'm not the only one.







II. Support OGNL, message, static, and parameter expressions in the
setInitialValue attribute of the <property-specification> tag

<property-specification name="allowedRoles" type="java.util.List"
persistent="no" initial-value="{ 'root', 'webuser'
}"></property-specification>
Following the pattern of the <binding> and <message-binding> tags, I'd have
to have a <property-specification> and <message-property-specification>.
This doesn't make sense. Tapestry should standardize on the expression
pattern used in the templates. i.e. initial-value="foo" or
initial-value="ognl:foo" or initial-value="message:foo", etc.




III. Simplify the Component Specification Asset Declaration Syntax
I have a <private-asset> tag, a <context-asset> tag, and an <external-asset>
tag.  Why not.
  <asset name="someName" location="someLocation" type="context"/>

where type can be "context" | "private"




Any support or thoughts?



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


Re: Tapestry / Torque Integration

Posted by "Kevin J. Menard, Jr." <ni...@negativetwenty.net>.
> Dunno if this is what you are looking for or not

Thanks for the response.  And indeed, this is the sorta thing I was
looking for, as vague as it is.  I'm just looking for odd tidbits on
getting things going together.  For example, I hadn't even thought of the
approach you took.  I wrote a ServletContextListener object to initialize
torque for me.

I guess something a little more concrete (and this goes along with a
recent post about how to layout a tapestry app) would be how others
actually integrate torque with their source structure.  Example questions
here would be something like the following:

o Do you keep the torque jars in your WEB-INF/lib directory, in your
servlet container's common lib directory, or elsewhere?

o Do you integrate the OM source build process with your web app's build
process, or do you just do it manually and move the source over?

o How do you access the database adapters?

o How do you integrate the two while keeping your existing Tapestry stuff
independ enough from the Torque distribution so your project doesn't get
cluttered?

I guess things along those lines.  Like I said before, just general best
practices for someone to follow.

Thanks again,
Kevin

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


Re: Tapestry / Torque Integration

Posted by James Sherwood <js...@romulin.com>.
This is a bit vague,

Best I can do is to assume you know how to do your schema and
Torque.properties file and start a tapestry project.

Then put something like this in  your servlet to activate torque:

public void init() throws ServletException {

if (!Torque.isInit()) {

try {

Torque.init(new
StreamConfiguration(this.getClass().getResourceAsStream("Path to
Torque.properties")));

} catch (TorqueException e) {

throw new ServletException(e);

} catch (IOException e) {

throw new ServletException(e);

}

}



after that you can just use the standard create and object and .save() it
to add to database and Criteria objects to pull from the database.

Dunno if this is what you are looking for or not



James

----- Original Message ----- 
From: "Kevin J. Menard, Jr." <ni...@negativetwenty.net>
To: <ta...@jakarta.apache.org>
Sent: Wednesday, June 30, 2004 10:00 AM
Subject: Tapestry / Torque Integration


> I originally sent the following message to the spindle user group.  Based
> on feedback there, I'm asking the question here to reach a wider audience.
>  To make things a little more general, I've changed it to Tapestry &
> Torque rather than just Spindle & Torque (although the latter is still
> fine).  Any feedback would be greatly appreciated.
>
>
>
> Hi,
>
> I'm fairly new to using torque (Spindle even for that matter) and was
> wondering if anyone had any tips/techniques for integrating torque with a
> Tapestry project maintained by Spindle.  Sorry if this sounds a bit
> vague, but I'm generally looking for "best of" practices.  Maybe the
> collection of ideas here could be added to the wiki for others as well.
>
> Thanks,
> Kevin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>



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