Home » Tag Archives: JPA (page 3)

Tag Archives: JPA

JPA Hibernate Alternatives. What can I use if JPA or Hibernate is not good enough for my project?

java-interview-questions-answers

Hello, how are you? Today we will talk about situations that the use of the JPA/Hibernate is not recommended. Which alternatives do we have outside the JPA world? What we will talk about:             JPA/Hibernate problems Solutions to some of the JPA/Hibernate problems Criteria for choosing the frameworks described here Spring JDBC Template MyBatis Sormula ...

Read More »

JPA Tutorial – Setting Up JPA in a Java SE Environment

java-interview-questions-answers

JPA stands for Java Persistence API, which basically is a specification that describes a way to persist data into a persistent storage, usually a database. We can think of it as something similar to ORM tools like Hibernate, except that it is an official part of the Java EE specification (and it’s also supported on Java SE). There are many reasons to learn an ...

Read More »

Compile-time checking JPA queries

java-interview-questions-answers

JPA provides several alternatives for querying data. Such alternatives may be classified attending to a variety of criteria, eg, language used (SQL vs JPQL) or whether queries are static (compilation time) or dynamic (execution time). Static queries are defined using annotations @NamedQuery (javax.persistence.NamedQuery) and @NamedQueries (javax.persistence.NamedQueries) in the @Entity class definition itself:         @NamedQuery( name="findAllCustomersWithName", query="SELECT c ...

Read More »

A beginner’s guide to JPA/Hibernate flush strategies

jboss-hibernate-logo

Introduction In my previous post I introduced the entity state transitions Object-relational mapping paradigm. All managed entity state transitions are translated to associated database statements when the current Persistence Context gets flushed. Hibernate’s flush behavior is not always as obvious as one might think.       Write-behind Hibernate tries to defer the Persistence Context flushing up until the last ...

Read More »

From JPA to Hibernate’s legacy and enhanced identifier generators

jboss-hibernate-logo

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

java-interview-questions-answers

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

java-interview-questions-answers

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 »
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