Home » Tag Archives: JPA (page 3)

Tag Archives: JPA

From JPA to Hibernate’s legacy and enhanced identifier generators


JPA identifier generators JPA defines the following identifier strategies:                 Strategy Description AUTO The persistence provider picks the most appropriate identifier strategy supported by the underlying database IDENTITY Identifiers are assigned by a database IDENTITY column SEQUENCE The persistence provider uses a database sequence for generating identifiers TABLE The persistence provider uses a ...

Read More »

How to use a JPA Type Converter to encrypt your data


A few days ago, I read an interesting article by Bear Giles about Database encryption using JPA listeners from 2012. He discusses his requirement for an encryption solution and provides a code example with JPA listeners. His main requirements are: provide a transparent encryption that does not affect the application, be able to add the encryption at deployment time, develop ...

Read More »

JPA 2.1 Type Converter – The better way to persist enums


Persisting enums with JPA 2.0 is possible, but there is no nice way to do it. Using the @Enumerated annotation, you can use EnumType.ORDINAL or EnumType.STRING to map the enum value to its database representation. But both options have some drawbacks, that we will discuss in the first part of this article. In the second part, I will show you ...

Read More »

SpringMVC4 + Spring Data JPA + SpringSecurity configuration using JavaConfig


In this article we will see how to configure and integrate SpringMVC4, Spring Data JPA with Hibernate and SpringSecurity using JavaConfig. 1. First let’s configure all the necessary dependencies in pom.xml                 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.sivalabs</groupId> <artifactId>spring-javaconfig</artifactId> <version>1.0</version> <packaging>war</packaging> <name>SpringApp JavaConfig Demo</name> <properties> <java.version>1.7</java.version> <junit.version>4.11</junit.version> <slf4j.version>1.7.5</slf4j.version> <logback.version>1.0.13</logback.version> <spring.version>4.0.0.RELEASE</spring.version> <spring-data-jpa.version>1.4.1.RELEASE</spring-data-jpa.version> <spring-security.version>3.2.0.RELEASE</spring-security.version> ...

Read More »

Project Student: JPA Criteria Queries


This is part of Project Student. Other posts are Webservice Client With Jersey, Webservice Server with Jersey, Business Layer, Persistence with Spring Data, Sharding Integration Test Data and Webservice Integration. We’ve covered basic CRUD operations but that doesn’t take us very far. Spring Data makes it easy to include basic searches but it’s important to have other standard options. One ...

Read More »

Primefaces DataTable Lazy Loading with pagination, filtering and sorting using JPA Criteria, @ViewScoped


Primefaces datatable lazy pagination works, but I was really frustrated after searching for a full example using Criteria in the web. So I’ve mixed solutions from http://stackoverflow.com/questions/13972193/how-to-query-data-for-primefaces-datatable-with-lazy-loading-and-pagination http://www.primefaces.org/showcase/ui/datatableLazy.jsf http://www.javacodegeeks.com/2012/04/lazy-jsf-primefaces-datatable.html To put all together in a complete example using:     Primefaces 4.0 TomEE 1.6.0+ Criteria JPA With: Filtering Sorting Pagination Using @ViewScoped Managed Beans So let’s go: xhtml snippet <?xml ...

Read More »
Do you want to know how to develop your skillset and become a ...

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!
Get ready to Rock!
To download the books, please verify your email address by following the instructions found on the email we just sent you.