Home » Tag Archives: JPA (page 7)

Tag Archives: JPA

Ultimate JPA Queries and Tips List – Part 2

java-interview-questions-answers

This part continues from the first part of the series. JPA: NamedQuery, querying with dates, warnings about the getSingleResult method To avoid the repetition of queries codes, upgrade the performance and make easier to maintain the queries we can use the NamedQueries. A NamedQuery uses JPQL as syntax and it is declared in the entity class. It is easier to ...

Read More »

Ultimate JPA Queries and Tips List – Part 1

java-interview-questions-answers

There are several JPAs “how to” that we can find on the internet, here in this blog, that teaches how to do several tasks with JPA. Usually I see some people asking questions about Queries with JPA; usually to answer this kind of questions several links are provided trying to find a solution to the question. Until today I could ...

Read More »

Four solutions to the LazyInitializationException – Part 2

jsf-logo

This article continues from part 1 of the tutorial. Load collection by Stateful EJB with PersistenceContextType.EXTENDED This approach can be applied only to applications that works with Full JEE environments: to use a EJB with PersistenceContextType.EXTENDED. Check the code below how the DAO would look like: package com.ejb; import javax.ejb.Stateful; import javax.persistence.*; import com.model.Person; @Stateful public class SystemDAOStateful { @PersistenceContext(unitName ...

Read More »

Four solutions to the LazyInitializationException – Part 1

jsf-logo

In the post today we will talk about the common LazyInitializationException error. We will see four ways to avoid this error, the advantage and disadvantage of each approach and in the end of this post, we will talk about how the EclipseLink handles this exception. To see the LazyInitializationException error and to handle it, we will use an application JSF ...

Read More »

Test JPQL / HQL without a deploy

jboss-hibernate-logo

Have you ever wanted to test your JPQL / HQL without doing a full deploy of your application? What we will see here today is simple solution that works for any JPA implementation: Hibernate, OpenJPA, EclipseLink and others. The base source code found in this post came from this book: “Pro JPA 2: Mastering the Java™ Persistence API – Mike ...

Read More »

Full Web Application Tomcat JSF Primefaces JPA Hibernate – Part 3

primefaces-logo

Primefaces AutoComplete, JSF Converter This post continues from part 1 and part 2. The JSF has the Converter tool that helps us get some data from the user view and transform into an object loaded from the database or a cache.           In the “com.converter” package create the following class: package com.converter; import javax.faces.application.FacesMessage; import javax.faces.component.UIComponent; ...

Read More »

Full Web Application Tomcat JSF Primefaces JPA Hibernate – Part 2

primefaces-logo

ManagedBeans This post continues from part 1 of this tutorial. In the “com.mb” package you will need to create the classes bellow:             package com.mb; import org.primefaces.context.RequestContext; import com.util.JSFMessageUtil; public class AbstractMB { private static final String KEEP_DIALOG_OPENED = 'KEEP_DIALOG_OPENED'; public AbstractMB() { super(); } protected void displayErrorMessageToUser(String message) { JSFMessageUtil messageUtil = new JSFMessageUtil(); messageUtil.sendErrorMessageToUser(message); ...

Read More »

Full WebApplication JSF EJB JPA JAAS – Part 2

jsf-logo

View – Creation and JSF set up This tutorial continues from part 1. Let us create a new Dynamic Web Project. Create it like the image bellow: Pay attention: in some moment the Eclipse will ask you if you want to add the JSF Capabilities (auto complete), enable it. Like the screens bellow: After the project creation, let us edit ...

Read More »

Full WebApplication JSF EJB JPA JAAS – Part 1

jsf-logo

This post will be the biggest so far in my blog! We will see a full web application. It will be done will the newest technologies (until today), but I will give some hints to show how to adapt this post to older technologies. In the end of this post you will find the source code to download. You can ...

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