You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Bill Lear <ra...@zopyra.com> on 2003/10/13 16:59:30 UTC
Tapestry and iBatis Database Example
On Monday, October 13, 2003 at 07:00:18 (-0500) Lenny Sorey writes:
>To be honest, I'm am a new using regarding Tapestry and very excited about the potential of using Tapestry.
>
>Would anyone have a simple MySQL database example using any of the following with Tapestry 3.0 beta3 that's demonstrates the following?
Harish surely knows more about this particular topic, as I believe
he is also using iBatis.
I use Tapestry with MySQL, HiveMind, and just today, iBatis (it is
very nifty; I thought it would take more than 45 minutes to write the
iBatis part, but I was wrong). The most difficult aspect of this is
really getting everything to build under Ant --- it just takes a bit
of copying jar files here and there, ensuring you have the proper
targets set up in Ant, etc.
I have a wrapper around HiveMind, as such:
public class Services {
private Registry registry;
public Services() {
ClassResolver resolver = new DefaultClassResolver();
RegistryBuilder builder = new RegistryBuilder();
builder.processModules(resolver);
registry = builder.constructRegistry(Locale.getDefault());
}
/**
* Gets a service based on the class name.
*
* @param theClass the class for which to fetch the service.
* @return the Object that provides the requested service.
*/
public Object getService(Class theClass) {
return registry.getService(theClass.getName(), theClass);
}
}
Then, in my Global class, I use hivemind through the above to create
an instance of the DAO factory, and then use it to build the DAO:
public class Global {
private DAO dao;
public Global() throws DAOException {
Services services = new Services();
DAOFactory factory =
(DAOFactory) services.getService(DAOFactory.class);
dao = factory.createDAO();
}
public DAO getDAO() {
return dao;
}
}
For IBatis, I configure an IBatis DAO in the hivemind.xml file:
<module id="com.zopyra.eci.dao" version="1.0.0">
<service-point id="DAOFactory"
interface="com.zopyra.eci.dao.DAOFactory">
<invoke-factory service-id="hivemind.BuilderFactory">
<construct
class="com.zopyra.eci.dao.ibatis.IBatisDAOFactory">
<set property="resource"
value="com/zopyra/eci/dao/ibatis/maps/SqlMapConfig.xml"/>
</construct>
</invoke-factory>
</service-point>
</module>
The IBatis DAO factory looks like this:
public class IBatisDAOFactory implements DAOFactory {
private String resource;
public void setResource(String argResource) {
this.resource = argResource;
}
public String getResource() {
return this.resource;
}
public DAO createDAO() {
IBatisDAO dao = new IBatisDAO();
try {
Reader reader = Resources.getResourceAsReader(getResource());
dao.setSqlMap(XmlSqlMapBuilder.buildSqlMap(reader));
} catch (IOException ex) {
throw new RuntimeException("Could not create IBatis DAO", ex);
}
return dao;
}
}
The IBatis DAO:
public class IBatisDAO implements DAO {
private SqlMap sqlMap;
void setSqlMap(SqlMap argSqlMap) {
this.sqlMap = argSqlMap;
}
public Employee getEmployee(Integer employeeID) throws DAOException {
try {
return (Employee) sqlMap.executeQueryForObject("getEmployee",
employeeID);
} catch (SQLException sex) {
throw new DAOException("Unable to fetch employee for ID "
+ employeeID, sex);
}
}
public Employee[] getEmployees(String sortColumn) throws DAOException {
try {
List list = sqlMap.executeQueryForList("getEmployees", sortColumn);
return (Employee[]) list.toArray(new Employee[0]);
} catch (SQLException sex) {
throw new DAOException("Unable to fetch employee list", sex);
}
}
}
The IBatis SQL Map file:
<sql-map name="Employee">
<mapped-statement name="getEmployees"
result-class="com.zopyra.eci.model.Employee">
SELECT
*
FROM
employee
</mapped-statement>
<mapped-statement name="getEmployee"
result-class="com.zopyra.eci.model.Employee">
SELECT
*
FROM
employee
WHERE
employeeID = #value#
</mapped-statement>
</sql-map>
The IBatis SQL Map config file:
<sql-map-config>
<properties
resource="com/zopyra/eci/dao/ibatis/maps/SqlMapConfig.properties"/>
<settings
maxExecute="0"
maxExecutePerConnection="0"
maxTransactions="5"
statementCacheSize="0"
useGlobalTransactions="false"
useBeansMetaClasses="true"
cacheModelsEnabled="true"/>
<datasource name="basic" default="true"
factory-class="com.ibatis.db.sqlmap.datasource.SimpleDataSourceFactory">
<property name="JDBC.Driver" value="${driver}"/>
<property name="JDBC.ConnectionURL" value="${url}"/>
<property name="JDBC.Username" value="${username}"/>
<property name="JDBC.Password" value="${password}"/>
<property name="JDBC.DefaultAutoCommit" value="true" />
<property name="Pool.MaximumActiveConnections" value="10"/>
<property name="Pool.MaximumIdleConnections" value="5"/>
<property name="Pool.MaximumCheckoutTime" value="120000"/>
<property name="Pool.TimeToWait" value="500"/>
<property name="Pool.PingQuery" value="select 1 from Employee"/>
<property name="Pool.PingEnabled" value="false"/>
<property name="Pool.PingConnectionsOlderThan" value="1"/>
<property name="Pool.PingConnectionsNotUsedFor" value="1"/>
<property name="Pool.QuietMode" value="true"/>
</datasource>
<sql-map resource="com/zopyra/eci/dao/ibatis/maps/Employee.xml" />
</sql-map-config>
and, the IBatis properties file:
driver=org.gjt.mm.mysql.Driver
url=jdbc:mysql://localhost:3306/eci
username=<your name here>
password=<your password here>
The DB looks like this:
CREATE TABLE employee (
employeeID INTEGER NOT NULL AUTO_INCREMENT,
lastName VARCHAR(40),
firstName VARCHAR(40),
email VARCHAR(40),
department VARCHAR(30),
officeAddress1 VARCHAR(60),
officeAddress2 VARCHAR(60),
officeCity VARCHAR(40),
officeState VARCHAR(20),
officeZip VARCHAR(10),
officePhone VARCHAR(30),
remoteOfficePhone VARCHAR(30),
officeFax VARCHAR(30),
homeAddress1 VARCHAR(60),
homeAddress2 VARCHAR(60),
homeAddress3 VARCHAR(60),
homeCity VARCHAR(40),
homeState VARCHAR(20),
homeZip VARCHAR(10),
homePhone VARCHAR(30),
cellPhone VARCHAR(30),
pager VARCHAR(30),
hasImage BIT DEFAULT 0,
image LONG VARBINARY,
imageContentType VARCHAR(40),
isLocation BIT DEFAULT 0,
PRIMARY KEY(employeeID),
UNIQUE (employeeID)
);
and of course, I have a Java Bean class, Employee, that is
straightforward.
The iBatis stuff is very nice; I think you'll like it.
Bill
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Tapestry and Cayenne Example
Posted by Eric Schneider <er...@centralparksoftware.com>.
Hi Lenny,
Yeah, I tested against 3.23.54. I'll email you personally about how to
change this Java type in the modeler.
Cheers,
Eric
----- Original Message -----
From: "Lenny Sorey" <lr...@fatdot.com>
To: "Tapestry User Group" <ta...@jakarta.apache.org>; "Eric
Schneider" <er...@centralparksoftware.com>
Sent: Saturday, October 18, 2003 11:39 AM
Subject: Re: Tapestry and Cayenne Example
> Eric,
>
> First of all, thank you for your Tapestry/Cayenne Artist Example.
>
> For me, everything seem to work fine except for one thing and I believe
> I've located that issue.
>
> It seems that the tutorial doesn't like my version of MySQL 4.1 Alpha
regarding Dates.
>
> There was a change by MySQL in 4.1 from MySQL 4.0 regarding Dates. My
problem
> is that I'm not quite sure where I should make a change regarding the date
reference
> in your tutorial . I believe that I should change my type in the MySQL 4.1
Artist table from Date to either DATETIME or TIMESTAMP.
>
> In addition, I don't know if I should make a change in Tapestry or
Cayennes datamap.map.xml file.
>
> My platform is as follows:
>
> J2SDK 1.4.2
> Tomcat 4.1.24
> MySQL 4.1.0 - Alpha
> MyConnector/J 3.10 JDBC
>
> Once again, thanks for your tutorial. I think that I'm going to like
Cayenne & Tapestry very
> much once I get a good understanding of the two working together.
>
> Are you using MySQL 4.1 with Cayenne and have you run across anything like
this regarding Dates with
> following error message?
>
> Here's the error message I got:
>
> Regards,
>
> Lenny Sorey
>
>
****************************************************************************
****************************************************************************
****************************************************************************
****************
>
> An exception has occured.
> You may continue by restarting the session.
>
> org.apache.tapestry.ApplicationRuntimeException
> [v.1.0.1 October 13 2003] Global exception.
> component:
cayenne.tutorial.tapestry.pages.BrowseArtistsPage@ec6bb1[BrowseArtistsPage]
> location: context:/WEB-INF/templates/pages/BrowseArtistsPage.page, line 6,
column 79
>
> org.objectstyle.cayenne.CayenneRuntimeException
> [v.1.0.1 October 13 2003] Global exception.
>
> java.lang.ClassCastException
>
> Stack Trace:
>
org.objectstyle.cayenne.access.types.UtilDateType.materializeObject(UtilDate
Type.java:98)
>
org.objectstyle.cayenne.access.DefaultResultIterator.readDataRow(DefaultResu
ltIterator.java:242)
>
org.objectstyle.cayenne.access.DefaultResultIterator.nextDataRow(DefaultResu
ltIterator.java:197)
>
org.objectstyle.cayenne.access.DefaultResultIterator.dataRows(DefaultResultI
terator.java:217)
> org.objectstyle.cayenne.access.DataNode.runSelect(DataNode.java:395)
> org.objectstyle.cayenne.access.DataNode.performQueries(DataNode.java:281)
>
org.objectstyle.cayenne.access.DataDomain.performQueries(DataDomain.java:466
)
>
org.objectstyle.cayenne.access.DataContext.performQueries(DataContext.java:8
22)
>
org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.java:874
)
>
org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.java:752
)
>
cayenne.tutorial.tapestry.pages.BrowseArtistsPage.prepareForRender(BrowseArt
istsPage.java:75)
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:876)
> org.apache.tapestry.AbstractPage.renderPage(AbstractPage.java:341)
> org.apache.tapestry.engine.RequestCycle.renderPage(RequestCycle.java:411)
>
org.apache.tapestry.engine.AbstractEngine.renderResponse(AbstractEngine.java
:774)
> org.apache.tapestry.engine.PageService.service(PageService.java:118)
> org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:912)
>
org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:238
)
> org.apache.tapestry.ApplicationServlet.doGet(ApplicationServlet.java:199)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
>
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
>
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:256)
>
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
>
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:191)
>
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
>
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2
46)
>
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
>
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
)
>
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
>
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:171)
>
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
>
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172
)
>
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
>
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:174)
>
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
>
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne
ction(Http11Protocol.java:392)
> org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
>
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:619)
> java.lang.Thread.run(Thread.java:534)
>
>
> On Mon, 13 Oct 2003 12:21:44 -0400, Eric Schneider wrote:
>
> >Hi,
> >
> >For all that are interested, I've posted a Tapestry/Cayenne example on my
> >web site. There has been much discussion of O/R frameworks lately, and I
> >wanted to give Cayenne its due.
> >
> >Similar to the way Tapestry has derived many of its patterns from Apple's
> >WOF (WebObjects Framework), Cayenne is a pure java spin off of EOF.
Anyone
> >with a NeXT/EOF background will hit the ground running with Cayenne.
> >
> >This example has been tested with:
> >
> >Tomcat 4.1.24,
> >Cayenne 1.0,
> >Tapestry 3.0 beta 3,
> >MySQL
> >
> >http://www.centralparksoftware.com/downloads/cayenne-artist-app.zip
> >
> >The example includes a create script, tutorialdb.sql, that will create
the
> >tables and insert a handful of bogus records (for MySQL). This script
can
> >easily be augmented to work with another DB vendor other than MySQL.
Note,
> >primary key support differs depending on db vendor. (more details can on
pk
> >support can be found here:
>
>http://www.objectstyle.org/cayenne/modelerguide/common-tasks/pksupport.html
)
> >
> >To get the example running:
> >
> >1) Run the create script on your db (tutorialdb.sql)
> >
> >2) Modify datanode.driver.xml to include the appropriate driver, url,
> >username, password, etc. (located in /cayenne-artist-app/src/resources).
> >This can be done simply by hand, or with the cayenne modeler.
> >
> >3) Build a .war file and deploy to you container. ("ant")
> >
> >I believe that's it. You can contact me directly if you have issues
setting
> >up the example. All cayenne related questions should be posted to the
> >cayenne mailing list.
> >
> >I'll be contacting Andrus at objectstyle.org to update the example on the
> >cayenne site shortly.
> >
> >Cheers,
> >Eric,
> >eric@centralparksoftware.com
> >
> >FYI, if you are an eclipse user and want to modify the project, the
example
> >contains project descriptors located in the /opt/eclipse folder
(.project,
> >.classpath). Extract the example to your file system and create a new
> >"Simple" project in eclipse pointing to the /cayenne-artist-app folder.
> >Copy the .project and .classpath files from /opt/eclipse to the root
> >directory of the example, then refresh the project in the "Resource
> >Perspective" and you are good to go.
> >
> >
> >
> >---------------------------------------------------------------------
> >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 and Cayenne Example
Posted by Lenny Sorey <lr...@fatdot.com>.
Eric,
First of all, thank you for your Tapestry/Cayenne Artist Example.
For me, everything seem to work fine except for one thing and I believe
I've located that issue.
It seems that the tutorial doesn't like my version of MySQL 4.1 Alpha regarding Dates.
There was a change by MySQL in 4.1 from MySQL 4.0 regarding Dates. My problem
is that I'm not quite sure where I should make a change regarding the date reference
in your tutorial . I believe that I should change my type in the MySQL 4.1 Artist table from Date to either DATETIME or TIMESTAMP.
In addition, I don't know if I should make a change in Tapestry or Cayennes datamap.map.xml file.
My platform is as follows:
J2SDK 1.4.2
Tomcat 4.1.24
MySQL 4.1.0 - Alpha
MyConnector/J 3.10 JDBC
Once again, thanks for your tutorial. I think that I'm going to like Cayenne & Tapestry very
much once I get a good understanding of the two working together.
Are you using MySQL 4.1 with Cayenne and have you run across anything like this regarding Dates with
following error message?
Here's the error message I got:
Regards,
Lenny Sorey
****************************************************************************************************************************************************************************************************************************************************
An exception has occured.
You may continue by restarting the session.
org.apache.tapestry.ApplicationRuntimeException
[v.1.0.1 October 13 2003] Global exception.
component: cayenne.tutorial.tapestry.pages.BrowseArtistsPage@ec6bb1[BrowseArtistsPage]
location: context:/WEB-INF/templates/pages/BrowseArtistsPage.page, line 6, column 79
org.objectstyle.cayenne.CayenneRuntimeException
[v.1.0.1 October 13 2003] Global exception.
java.lang.ClassCastException
Stack Trace:
org.objectstyle.cayenne.access.types.UtilDateType.materializeObject(UtilDateType.java:98)
org.objectstyle.cayenne.access.DefaultResultIterator.readDataRow(DefaultResultIterator.java:242)
org.objectstyle.cayenne.access.DefaultResultIterator.nextDataRow(DefaultResultIterator.java:197)
org.objectstyle.cayenne.access.DefaultResultIterator.dataRows(DefaultResultIterator.java:217)
org.objectstyle.cayenne.access.DataNode.runSelect(DataNode.java:395)
org.objectstyle.cayenne.access.DataNode.performQueries(DataNode.java:281)
org.objectstyle.cayenne.access.DataDomain.performQueries(DataDomain.java:466)
org.objectstyle.cayenne.access.DataContext.performQueries(DataContext.java:822)
org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.java:874)
org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.java:752)
cayenne.tutorial.tapestry.pages.BrowseArtistsPage.prepareForRender(BrowseArtistsPage.java:75)
org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:876)
org.apache.tapestry.AbstractPage.renderPage(AbstractPage.java:341)
org.apache.tapestry.engine.RequestCycle.renderPage(RequestCycle.java:411)
org.apache.tapestry.engine.AbstractEngine.renderResponse(AbstractEngine.java:774)
org.apache.tapestry.engine.PageService.service(PageService.java:118)
org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:912)
org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:238)
org.apache.tapestry.ApplicationServlet.doGet(ApplicationServlet.java:199)
javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
java.lang.Thread.run(Thread.java:534)
On Mon, 13 Oct 2003 12:21:44 -0400, Eric Schneider wrote:
>Hi,
>
>For all that are interested, I've posted a Tapestry/Cayenne example on my
>web site. There has been much discussion of O/R frameworks lately, and I
>wanted to give Cayenne its due.
>
>Similar to the way Tapestry has derived many of its patterns from Apple's
>WOF (WebObjects Framework), Cayenne is a pure java spin off of EOF. Anyone
>with a NeXT/EOF background will hit the ground running with Cayenne.
>
>This example has been tested with:
>
>Tomcat 4.1.24,
>Cayenne 1.0,
>Tapestry 3.0 beta 3,
>MySQL
>
>http://www.centralparksoftware.com/downloads/cayenne-artist-app.zip
>
>The example includes a create script, tutorialdb.sql, that will create the
>tables and insert a handful of bogus records (for MySQL). This script can
>easily be augmented to work with another DB vendor other than MySQL. Note,
>primary key support differs depending on db vendor. (more details can on pk
>support can be found here:
>http://www.objectstyle.org/cayenne/modelerguide/common-tasks/pksupport.html)
>
>To get the example running:
>
>1) Run the create script on your db (tutorialdb.sql)
>
>2) Modify datanode.driver.xml to include the appropriate driver, url,
>username, password, etc. (located in /cayenne-artist-app/src/resources).
>This can be done simply by hand, or with the cayenne modeler.
>
>3) Build a .war file and deploy to you container. ("ant")
>
>I believe that's it. You can contact me directly if you have issues setting
>up the example. All cayenne related questions should be posted to the
>cayenne mailing list.
>
>I'll be contacting Andrus at objectstyle.org to update the example on the
>cayenne site shortly.
>
>Cheers,
>Eric,
>eric@centralparksoftware.com
>
>FYI, if you are an eclipse user and want to modify the project, the example
>contains project descriptors located in the /opt/eclipse folder (.project,
>.classpath). Extract the example to your file system and create a new
>"Simple" project in eclipse pointing to the /cayenne-artist-app folder.
>Copy the .project and .classpath files from /opt/eclipse to the root
>directory of the example, then refresh the project in the "Resource
>Perspective" and you are good to go.
>
>
>
>---------------------------------------------------------------------
>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 and Cayenne Example
Posted by Eric Schneider <er...@centralparksoftware.com>.
Hi,
For all that are interested, I've posted a Tapestry/Cayenne example on my
web site. There has been much discussion of O/R frameworks lately, and I
wanted to give Cayenne its due.
Similar to the way Tapestry has derived many of its patterns from Apple's
WOF (WebObjects Framework), Cayenne is a pure java spin off of EOF. Anyone
with a NeXT/EOF background will hit the ground running with Cayenne.
This example has been tested with:
Tomcat 4.1.24,
Cayenne 1.0,
Tapestry 3.0 beta 3,
MySQL
http://www.centralparksoftware.com/downloads/cayenne-artist-app.zip
The example includes a create script, tutorialdb.sql, that will create the
tables and insert a handful of bogus records (for MySQL). This script can
easily be augmented to work with another DB vendor other than MySQL. Note,
primary key support differs depending on db vendor. (more details can on pk
support can be found here:
http://www.objectstyle.org/cayenne/modelerguide/common-tasks/pksupport.html)
To get the example running:
1) Run the create script on your db (tutorialdb.sql)
2) Modify datanode.driver.xml to include the appropriate driver, url,
username, password, etc. (located in /cayenne-artist-app/src/resources).
This can be done simply by hand, or with the cayenne modeler.
3) Build a .war file and deploy to you container. ("ant")
I believe that's it. You can contact me directly if you have issues setting
up the example. All cayenne related questions should be posted to the
cayenne mailing list.
I'll be contacting Andrus at objectstyle.org to update the example on the
cayenne site shortly.
Cheers,
Eric,
eric@centralparksoftware.com
FYI, if you are an eclipse user and want to modify the project, the example
contains project descriptors located in the /opt/eclipse folder (.project,
.classpath). Extract the example to your file system and create a new
"Simple" project in eclipse pointing to the /cayenne-artist-app folder.
Copy the .project and .classpath files from /opt/eclipse to the root
directory of the example, then refresh the project in the "Resource
Perspective" and you are good to go.
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org