Home » Tag Archives: JPA

Tag Archives: JPA

A Working DeltaSpike Tutorial

java-interview-questions-answers

On a recent project, I was faced with an interesting problem: take a service method that was given a single object and reuse the same code in the context of a nightly process that would run independently of the application over thousands of the same type of object. It would have been ridiculous to try to maintain an identical process ...

Read More »

Pre Java EE 7 alternative to JPA 2.1 unsynchronized persistence context

java-interview-questions-answers

Unsynchronized persistence context in Java EE 7 JPA 2.1 introduced the concept of unsynchronized persistence context which allows fine grained control over flushing of the JPA Entity Manager i.e. by explicitly calling EntityManager#joinTransaction. Previously, this was defaulted to end of JTA transaction e.g. in a typical Stateless EJB, the entity manager would flush its state to the DB at the ...

Read More »

JPA in case of asynchronous processing

java-interview-questions-answers

Few years ago in Java world it was almost obvious that every “enterprise” class project needed JPA to communicate with database. JPA is a perfect example of “leaky abstraction” described by Joel Spolsky. Great and easy at the beginning but hard to tune and limiting at the end. Hacking and working directly with caches, flushes and native queries is a daily ...

Read More »

Integrating JPA Hibernate with OptaPlanner

optaplanner-logo

We’ve been improving the integration of OptaPlanner with the rest of JEE, so it’s easier to build end user applications that just work. Let’s take a look at the improved JPA Hibernate integration. The basics Both JPA Hibernate and OptaPlanner work on POJO’s (Plain Old Java Objects), so just add some JPA annotations on your domain objects to persist them ...

Read More »

WebSocket Client API in Java EE 7

java-interview-questions-answers

In this post, let’s explore the less talked about Web Socket Client API and how to leverage it within a Java EE 7 container itself. Web Socket Server API rules The server side API of JSR 356 (Web Socket API for Java) is most commonly used for building Web Socket endpoint implementations. More often than not, from a client perspective, ...

Read More »

Using JPA And CDI Beans With Camel on WildFly

jboss-wildfly-logo

I didn’t really plan for it, but with a conference free month, I had the chance to dig around a little more and show you even more of the Camel on WildFly magic, that the WildFly-Camel subsystem provides. The Business Background The demo is derived from one on JBoss Demo-Central by Christina Lin. She demonstrates the use of File and JDBC ...

Read More »

How To Stream/Serialize JPA Result As JAX-RS Response For Large Data

java-interview-questions-answers

There are times that retrieving a large data set through JPA is necessary (e.g. more than 1,000,000 records) and having them stuffed into a single instance of java.util.List is just risky (memory barrier). So, here’s a quick solution of how a JAX-RS REST resource end-point could still give us a timely Response without breaking the memory constrain through streaming or ...

Read More »

Custom Boolean User Type with Hibernate JPA

jboss-hibernate-logo

The ANSI SQL 1999 standard introduced a BOOLEAN data type (although unfortunately only as an optional feature). But to date it still isn’t implemented by most major database systems. As a consequence boolean columns are implemented in various ways. E.g., CHAR columns containing ‘Y’ or ‘N’, or using BIT columns. Subsequently, there is no way for JPA to provide a ...

Read More »

Type Safe Queries for JPA’s Native Query API

java-interview-questions-answers

When you’re using JPA – sometimes – JPQL won’t do the trick and you’ll have to resort to native SQL. From the very beginning, ORMs like Hibernate kept an open “backdoor” for these cases and offered a similar API to Spring’s JdbcTemplate, to Apache DbUtils, or to jOOQ for plain SQL. This is useful as you can continue using your ...

Read More »

How JPA 2.1 has become the new EJB 2.0

java-interview-questions-answers

Beauty lies in the eye of the beholder. So does “ease”: Learn more about SQL Result Set Mappings and handle your native query results with ease: http://t.co/WH4BTlClIP #JPA #Java #JavaEE — Thorben Janssen (@thjanssen123) April 15, 2015 Thorben writes very good and useful articles about JPA, and he’s recently started an excellent series about JPA 2.1’s new features. Among which: ...

Read More »

Want to take your Java skills to the next level?

Grab our programming books for FREE!

Here are some of the eBooks you will get:

  • Advanced Java Guide
  • Java Design Patterns
  • JMeter Tutorial
  • Java 8 Features Tutorial
  • JUnit Tutorial
  • JSF Programming Cookbook
  • Java Concurrency Essentials