spacer tapestry-jdo guide

Skip to end of metadata
  • Page restrictions apply
  • Added by Alex Kotchnev, last edited by Alex Kotchnev on Jan 15, 2012  (view change)
Go to start of metadata
spacer Version Status : 0.0.1 initial release, looking for feedback

Tested with Tapestry 5.2.x and 5.3.x

  • Introduction
  • Configuration
    • Add dependency on Tapestry-JDO
    • Add your JDO implementation
    • Configure build to instrument your JDO classes:
    • Add your persistence store driver :
    • Contribute the PersistenceManagerFactory name to your AppModule:
  • Usage
    • Inject PersistenceManager into your pages:
    • Auto-Commit in your pages
    • Configure service transactional behavior
    • Use JDO object as page contex

Introduction

The Tynamo Tapestry-JDO module allows you to work with a JDO2 (www.oracle.com/technetwork/java/index-jsp-135919.html) backed persistence layer, similarly to the way you would work w/ a JPA or Hibernate based persistence layer. JDO's main appeal is in its extensive support for ORM into relational databases (e.g. MySQL) as well as non-relational data stores (e.g. MongoDB through Datanucleus MongoDB Support, Google AppEngine JDO API, etc)

Configuration

In order to have a working configuration, the following are required:

  • A dependency on org.tynamo:tapestry-jdo
  • A JDO implementation (we use datanucleus in our examples, but others such as Apache JDO should work as well). The implementations typically have some way of integrating the JDO Enhancement process into the build; although not absolutely necessary (e.g. you could probably do that manually after you run your build and before packaging your app), it would probably be a good idea
  • A properly configured jdoconfig.xml 

Add dependency on Tapestry-JDO

Just adding this dependency will bring transitive dependency on jdo2.

 

Maven dependency for tapestry-jdo

Add your JDO implementation

Add your own dependencies for your JDO implementation if you're using something different:

 

JDO Implementation Dependencies

Configure build to instrument your JDO classes:

JDO Enhancer Configuration in Maven

 

Add your persistence store driver :

JDBC Driver Dependency

 

Setup your JDO configuration (jdoconfig.xml):

jdoconfig.xml

 

Contribute the PersistenceManagerFactory name to your AppModule:

Contribute Persistence Manager Factory name

 

Usage

 

Inject PersistenceManager into your pages:

Injecting JDO Persistence Manager

 

Auto-Commit in your pages

@CommitAfter in pages

 

Configure service transactional behavior

Service transactions

 

Use JDO object as page contex

Classes that use a simple primary key (e.g. Long, String, etc) can be used as an acitvation/passivation context directly

Activate/Passivate
Labels
  • None

gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.