Author: buildbot
Date: Sat Dec 13 13:20:11 2014
New Revision: 932575
Log:
Production update by buildbot for tapestry
Modified:
websites/production/tapestry/content/cache/main.pageCache
websites/production/tapestry/content/using-tapestry-with-hibernate.html
Modified: websites/production/tapestry/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.
Modified:
websites/production/tapestry/content/using-tapestry-with-hibernate.html
==============================================================================
--- websites/production/tapestry/content/using-tapestry-with-hibernate.html
(original)
+++ websites/production/tapestry/content/using-tapestry-with-hibernate.html Sat
Dec 13 13:20:11 2014
@@ -48,19 +48,13 @@
</div></div>
<div id="top">
-<div id="smallbanner"><div class="searchbox" style="float:right;margin: .3em
1em .1em 1em">
-<p>
-<span style="color: #999; font-size: 90%">Tapestry docs, issues, wikis &
blogs:</span>
-</p><form enctype="application/x-www-form-urlencoded" method="get"
action="http://tapestry.apache.org/search.html">
+<div id="smallbanner"><div class="searchbox" style="float:right;margin: .3em
1em .1em 1em"><span style="color: #999; font-size: 90%">Tapestry docs, issues,
wikis & blogs:</span>
+<form enctype="application/x-www-form-urlencoded" method="get"
action="http://tapestry.apache.org/search.html">
<input type="text" name="q">
<input type="submit" value="Search">
</form>
-</div>
-
-<div class="emblem" style="float:left"><a shape="rect" href="index.html"><img
class="confluence-embedded-image"
src="https://cwiki.apache.org/confluence/download/attachments/21791252/tapestry_s.png?version=3&modificationDate=1293093635000&api=v2"
data-image-src="/confluence/download/attachments/21791252/tapestry_s.png?version=3&modificationDate=1293093635000&api=v2"></a></div>
-<div class="title" style="float:left; margin: 0 0 0 3em">
-<h1 id="SmallBanner-PageTitle">Using Tapestry With Hibernate</h1></div></div>
+</div><div class="emblem" style="float:left"><p><a shape="rect"
href="index.html"><img class="confluence-embedded-image
confluence-external-resource"
src="http://tapestry.apache.org/images/tapestry_small.png"
data-image-src="http://tapestry.apache.org/images/tapestry_small.png"></a></p></div><div
class="title" style="float:left; margin: 0 0 0 3em"><h1
id="SmallBanner-PageTitle">Using Tapestry With Hibernate</h1></div></div>
<div class="clearer"></div>
</div>
@@ -82,6 +76,7 @@ table.ScrollbarTable td.ScrollbarNextIco
/*]]>*/</style><div class="Scrollbar"><table class="ScrollbarTable"><tr><td
colspan="1" rowspan="1" class="ScrollbarPrevIcon"><a shape="rect"
href="using-beaneditform-to-create-user-forms.html"><img align="middle"
border="0" src="https://cwiki.apache.org/confluence/images/icons/back_16.gif"
width="16" height="16"></a></td><td colspan="1" rowspan="1"
class="ScrollbarPrevName" width="33%"><a shape="rect"
href="using-beaneditform-to-create-user-forms.html">Using BeanEditForm To
Create User Forms</a> </td><td colspan="1" rowspan="1"
class="ScrollbarParent" width="33%"><sup><a shape="rect"
href="tapestry-tutorial.html"><img align="middle" border="0"
src="https://cwiki.apache.org/confluence/images/icons/up_16.gif" width="8"
height="8"></a></sup><a shape="rect" href="tapestry-tutorial.html">Tapestry
Tutorial</a></td><td colspan="1" rowspan="1" class="ScrollbarNextName"
width="33%"> </td></tr></table></div><p>So, you fill in all the fields,
submit the form (without validation erro
rs) and voila: you get back the same form, blanked out. What happened, and
where did the data go?</p><p>What happened is that we haven't told Tapestry
what to do after the form is successfully submitted (by successful, we mean,
with no validation errors). Tapestry's default behavior is to redisplay the
active page, and that occurs in a new request, with a new instance of the
Address object (because the address field is not a peristent
field).</p><p>Well, since we're creating objects, we might as well store them
somewhere ... in a database. We're going to quickly integrate Tapestry with <a
shape="rect" class="external-link" href="http://hibernate.org" >Hibernate</a>
as the object/relational mapping layer, and ultimately store our data inside a
<a shape="rect" class="external-link" href="http://www.hsqldb.org/" >HSQLDB</a>
database. HSQLDB is an embedded database engine and requires no installation
– it will be pulled down as a dependency via maven.</p><h2
id="UsingTapestryWithH
ibernate-Re-configuringtheProject">Re-configuring the Project</h2><p>We're
going to bootstrap this project from a simple Tapestry project to one that uses
Hibernate and HSQLDB.</p><h3
id="UsingTapestryWithHibernate-UpdatingtheDependencies">Updating the
Dependencies</h3><p>First, we must update the POM to list a new set of
dependencies, that includes Hibernate, the Tapestry/Hibernate integration
library, and the HSQLDB JDBC driver:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeHeader panelHeader pdl"
style="border-bottom-width: 1px;"><b>src/pom.xml (partial)</b></div><div
class="codeContent panelContent pdl">
<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[ <dependencies>
+
<dependency>
<groupId>org.apache.tapestry</groupId>
<artifactId>tapestry-hibernate</artifactId>
@@ -93,10 +88,10 @@ table.ScrollbarTable td.ScrollbarNextIco
<artifactId>hsqldb</artifactId>
<version>1.8.0.7</version>
</dependency>
-
+ ...
</dependencies>
]]></script>
-</div></div><p>The tapestry-hibernate library includes, as transitive
dependencies, Hibernate and tapestry-core. This means that you can simply
replace "tapestry-core" with "tapestry-hibernate" inside the <artifactId>
element.</p><p>Since Hibernate can work with so many different databases, we
must explicitly add in the correct driver.</p><p>After changing the POM, you
must re-execute the command <code>mvn eclipse:eclipse
-DdownloadSources=true</code>. Then, inside Eclipse, right click on the project
(in Package Explorer) and select the "Refresh" menu item. You should also stop
Jetty.</p><h3 id="UsingTapestryWithHibernate-HibernateConfiguration">Hibernate
Configuration</h3><p>Hibernate has a master configuration file used to store
connection and other data.</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width:
1px;"><b>src/main/resources/hibernate.cfg.xml</b></div><div class="codeContent
panelContent pdl">
+</div></div><p>The tapestry-hibernate library includes, as transitive
dependencies, Hibernate and tapestry-core. This means that you can simply
replace "tapestry-core" with "tapestry-hibernate" inside the <artifactId>
element.</p><p>After changing the POM and saving, Maven should automatically
download the new dependencies.</p><h3
id="UsingTapestryWithHibernate-HibernateConfiguration">Hibernate
Configuration</h3><p>Hibernate has a master configuration file used to store
connection and other data.</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width:
1px;"><b>src/main/resources/hibernate.cfg.xml</b></div><div class="codeContent
panelContent pdl">
<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">