vraptor-jpa

Sonatype helps open source projects to set up Maven repositories on https://oss.sonatype.org/

License

License

GroupId

GroupId

br.com.caelum.vraptor
ArtifactId

ArtifactId

vraptor-jpa
Last Version

Last Version

4.0.5
Release Date

Release Date

Type

Type

jar
Description

Description

vraptor-jpa
Sonatype helps open source projects to set up Maven repositories on https://oss.sonatype.org/
Project URL

Project URL

http://vraptor.caelum.com.br
Project Organization

Project Organization

Caelum
Source Code Management

Source Code Management

http://github.com/caelum/vraptor-jpa

Download vraptor-jpa

How to add to project

<!-- https://jarcasting.com/artifacts/br.com.caelum.vraptor/vraptor-jpa/ -->
<dependency>
    <groupId>br.com.caelum.vraptor</groupId>
    <artifactId>vraptor-jpa</artifactId>
    <version>4.0.5</version>
</dependency>
// https://jarcasting.com/artifacts/br.com.caelum.vraptor/vraptor-jpa/
implementation 'br.com.caelum.vraptor:vraptor-jpa:4.0.5'
// https://jarcasting.com/artifacts/br.com.caelum.vraptor/vraptor-jpa/
implementation ("br.com.caelum.vraptor:vraptor-jpa:4.0.5")
'br.com.caelum.vraptor:vraptor-jpa:jar:4.0.5'
<dependency org="br.com.caelum.vraptor" name="vraptor-jpa" rev="4.0.5">
  <artifact name="vraptor-jpa" type="jar" />
</dependency>
@Grapes(
@Grab(group='br.com.caelum.vraptor', module='vraptor-jpa', version='4.0.5')
)
libraryDependencies += "br.com.caelum.vraptor" % "vraptor-jpa" % "4.0.5"
[br.com.caelum.vraptor/vraptor-jpa "4.0.5"]

Dependencies

compile (1)

Group / Artifact Type Version
br.com.caelum : vraptor jar 4.2.0-RC3

provided (5)

Group / Artifact Type Version
org.hibernate.javax.persistence : hibernate-jpa-2.1-api jar 1.0.0.Final
javax.enterprise : cdi-api jar 1.1
org.jboss.weld.servlet : weld-servlet-core jar 2.1.2.Final
org.jboss.weld : weld-core-impl jar 2.1.2.Final
org.mortbay.jetty : servlet-api jar 3.0.20100224

test (4)

Group / Artifact Type Version
junit : junit jar 4.10
org.mockito : mockito-core jar 1.8.5
org.hamcrest : hamcrest-core jar 1.2
org.hamcrest : hamcrest-library jar 1.2

Project Modules

There are no modules declared in this project.

vraptor-jpa

Build status

A VRaptor JPA plugin to use with VRaptor 4 with environment support.

Installing

Copy the jar file to your app or use:

<dependency>
	<groupId>br.com.caelum.vraptor</groupId>
	<artifactId>vraptor-jpa</artifactId>
	<version>4.0.2</version> <!-- or the latest version -->
</dependency>

This plugin doesn't include any JPA Provider. You need to add your prefered provider.

Transactional Control

The default behavior is that each request will have a transaction available.

If you want, you can enable a decorator to change this behavior.

When enabled, it will open transactions only for methods with @Transactional annotation.

To do that you just need to add the follow content into your project's beans.xml:

<decorators>
    <class>br.com.caelum.vraptor.jpa.TransactionDecorator</class>
</decorators>

CDI Events

While the JPATransactionInterceptor worries about handling the transaction, you can observe CDI events to include some logic of yours.

Please, note that if you specializes or override the JPATransactionInterceptor, those events won't be fired.

Remember that CDI Events doesn't have an order when executing observers, so, when observing the same event in more than one method, they should be independents.

The events are:

  • Before trying to commit the transaction: BeforeCommit;
  • After successfully committing the transaction: AfterCommit;
  • After successfully rolling back (rollback) the transaction: AfterRollback;
import javax.enterprise.event.Observes;

import br.com.caelum.vraptor.jpa.event.BeforeCommit;
import br.com.caelum.vraptor.jpa.event.AfterCommit;
import br.com.caelum.vraptor.jpa.event.AfterRollback;

public class JPATransactionEventsObserver {
	/* You can @Inject any dependencies here. */

	public void beforeCommit(@Observes BeforeCommit before) {/* ... */}

	public void afterCommit(@Observes AfterCommit after) {/* ... */}

	public void afterRollback(@Observes AfterRollback after) {/* ... */}
}

Help

Get help from vraptor developers and the community at VRaptor's mailing list.

br.com.caelum.vraptor

Caelum

Versions

Version
4.0.5
4.0.4
4.0.3
4.0.2
4.0.1
4.0.0.Final
4.0.0-RC2
1.0.2
1.0.1
1.0.0