Home » Tag Archives: JPA

Tag Archives: JPA

OpenLiberty: Error on Injection, works on TomEE and Wildfly

While I was working on this blog, I encountered this error: [INFO ] DSRA8203I: Database product name : MySQL [INFO ] DSRA8204I: Database product version : 8.0.11 [INFO ] DSRA8205I: JDBC driver name : MySQL Connector/J [INFO ] DSRA8206I: JDBC driver version : mysql-connector-java-8.0.11 (Revision: 6d4eaa273bc181b4cf1c8ad0821a2227f116fedf) [INFO ] CWWJP9990I: test/wsjpa:wsjar:file:/home/dwuysan/dev/appservers/wlp/usr/servers/test/apps/expanded/test.war/WEB-INF/lib/d9f2b261-b3c6-4001-8a61-0aaebe46aa99.jar!/_testPU login successful [INFO ] WELD-000900: 2.4.5 (Final) [INFO ] FFDC1015I: ...

Read More »

Exact Matching of a String Containing a Wild Card in QueryDSL

On one of our recent projects, our client asked for a single search field that would be able to search on first name, last name and email address, with the only wildcard being an asterix ‘*’ for partial matches. Sounds simple, but it threw us for a little loop. In our project, we used QueryDSL in combination with JPA and ...

Read More »

Spring Data JPA Tutorial

java-interview-questions-answers

Managing data between java classes or objects and the relational database is a very cumbersome and tricky task. The DAO layer usually contains a lot of boilerplate code that should be simplified in order to reduce the number of lines of code and make the code reusable. In this tutorial, we will discuss spring data’s implementation of JPA. 1. Introduction ...

Read More »

Automatic save of managed JPA entities outside of transaction

java-interview-questions-answers

Repositories and transactions in Spring go hand in hand. All database access in Spring should be run inside a transaction, and you typically have @Transactional somewhere to enforce this. However, this is not always necessary. For example, when using Spring Data your repositories use SimpleJPARepository for CRUD functionality. The SimpleJPARepository uses @Transactional so when you perform CRUD operations, transactions are ...

Read More »

JPA Tips: Avoiding the N + 1 select problem

java-interview-questions-answers

Introduction ORM frameworks like JPA simplifies our development process by helping us to avoid lots of boilerplate code during the object <-> relational data mapping. However, they also bring some additional problems to the table, and N + 1 is one of them. In this article we will take a short look at the problem along with some ways to ...

Read More »

Spring Boot & JPA & Hibernate & Oracle

java-interview-questions-answers

In this tutorial we show how to create a Spring Boot application that communicates with an Oracle data source through Hibernate. Prerequisites: Eclipse IDE (neon release) Maven 4 Java 1.8 1- Create maven project Open eclipse, then create a new maven project and name it as SpringBootHibernate. At the end of this tutorial, we’ll get the following project structure: 2- ...

Read More »

Spring Data JPA Example with Spring Boot

java-interview-questions-answers

1. Introduction In this post, we shall demonstrate how to leverage the powerful Spring Data JPA APIs to interact with the database, in-memory H2 database for this lesson. Spring Data JPA offers a set of very powerful and highly-abstracted interfaces which are used to interact with any underlying database. Databases can be MySQL, MongoDB, Elasticsearch or any other supported database. ...

Read More »