Message-ID: <1607558655.15532.1414312353929.JavaMail.email@example.com> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_15531_657999694.1414312353928" ------=_Part_15531_657999694.1414312353928 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Tapestry JPA provides integration between Tapestry 5 and the JPA= Specifications ( JPA1: JSR-220 and JPA2: JSR-317). It is modeled after tapestry's hibernate module and provid= es the same features. It has been used in production for some time now and = is considered to be stable.
In order to start using Tapestry JPA, you need to meet the following req= uirements.
You need the following modules in order to use the JPA functionality.
These artifacts are available in the maven main repository. No need to c= onfigure any additional repositories.=20 =20
For the module to work, you first need to tell tapestry-jpa what Persist= enceUnit to use.
That should be everything needed.
In any Service, Page or Component you may inject an
/code> like in the following example:
You may manage your transactions manually by retrieving a transaction us=
em.getTransaction(). But to make your life easier, you can=
Annotating a method with
@CommitAfter will automatically co=
mmit the transaction after successfull execution. It is rollbacked if an ex=
ception is thrown.
If you are using tapestry-jpa-core in a tapestry-ioc module, the @Commit= After does not work. To make it work, you need to do something like this:= p>
@Match annotation which says what interfaces shoul=
d be checked for the
@CommitAfter annotation. Other useful val=
ues could be "*Service". In this case all interfaces named
CustomerService would be matched.
Because tapestry-ioc is not able to check the annotations inside the imp= lementation, it must be in the interface!