Home » Tag Archives: JPA (page 6)

Tag Archives: JPA

Bidirectional @OneToOne primary key association

jboss-hibernate-logo

It’s time to continue articles about Hibernate. The last one was dedicated to unidirectional @OneToOne association. So today I will show you how to obtain bidirectional @OneTonOne primary key association. An example from this tutorial based on previous article. Let’s get started. I will work with the same tables which I have created previously. In order to setup a bidirectional ...

Read More »

EasyCriteria 2.0 – JPA Criteria should be easy

java-interview-questions-answers

In the post today we will see about the new version of the framework named EasyCriteria. At the end of this post we will see what is to come here in the blog. Unfortunately the JPA criteria has a huge problem that is its verbosity. Why not make easier? Thinking like this that EasyCriteria framework were born and now it ...

Read More »

Spring Data JPA and pagination

spring-interview-questions-answers

Let us start with the classic JPA way to support pagination. Consider a simple domain class – A ‘Member’ with attributes first name, last name. To support pagination on a list of members, the JPA way is to support a finder which takes in the offset of the first result(firstResult) and the size of the result(maxResults) to retrieve, this way: ...

Read More »

Database Encryption Using JPA Listeners

java-interview-questions-answers

I recently had to add database encryption to a few fields and discovered a lot of bad advice out there. Architectural Issues The biggest problem is architectural. If your persistence manager quietly handles your encryption then, by definition, your architecture demands a tight and unnecessary binding between your persistence and security designs. You can’t touch one without also touching the ...

Read More »

JPA/Hibernate: Version-Based Optimistic Concurrency Control

jboss-hibernate-logo

This article is an introduction to version-based optimistic concurrency control in Hibernate and JPA. The concept is fairly old and much has been written on it, but anyway I have seen it reinvented, misunderstood and misused. I’m writing it just to spread knowledge and hopefully spark interest in the subject of concurrency control and locking. Use Cases Let’s say we ...

Read More »

Grails: Autodiscovery of JPA-annotated domain classes

groovy-logo

There are some issues to be fixed with the support for adding JPA annotations (for example @Entity) to Groovy classes in grails-app/domain in 2.0. This is due to the changes made to adding most GORM methods to the domain class bytecode with AST transformations instead of adding them to the metaclass at runtime with metaprogramming. There is a workaround – ...

Read More »

Batoo JPA – 15x Faster Than The Leading JPA Provider

batoo-logo

Introduction I loved the JPA 1.0 back in early 2000s. I started using it together with EJB 3.0 even before the stable releases. I loved it so much that I contributed bits and parts for JBoss 3.x implementations. Those were the days our company was considerably still small in size. Creating new features and applications were more priority than the ...

Read More »

Schema Creation Script With Hibernate 4, JPA And Maven

apache-maven-logo

The scenario is trivial – you want to generate a database schema creation script while building your application (and then execute the script on the target database) This was relatively easy with Hibernate 3, as there was the hibernate3-maven-plugin, but it is not compatible with Hibernate 4. And for every new project you should start with Hibernate 4, of course. ...

Read More »

EasyCriteria – An easy way to use the JPA Criteria

java-interview-questions-answers

Today we will see about this tool that make easier to use the JPA Criteria. The application that uses this library will be cleaner, easier to use and portable across the JPA implementations. At the end of this post you will find the source code to download. What is Criteria? Currently is the best solution to create dynamic queries. Imagine ...

Read More »

Ultimate JPA Queries and Tips List – Part 3

java-interview-questions-answers

Before you read the third part , remember the first and second part of the series JPA: Creating a object from a query The JPA allow us to create objects inside a query, just with the values that we need:               package com.model; public class PersonDogAmountReport { private int dogAmount; private Person person; public ...

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.

THANK YOU!

Close