Articles Tagged ‘eclipselink’
Sunday, December 21st, 2014
Especially when it comes to testing, setting up a decent environment for a secured Java EE web application isn’t always an easy thing to do.
In the following tutorial I’d like to demonstrate how to create a secured web application using form-based authentication and a JDBC realm to fetch users and roles and how to run the application in an embedded container for testing and development.
Additionally I’d like to show how to write and run integration tests to verify the security setup using a setup of Maven, Embedded GlassFish, Arquillian, jUnit and rest-assured.
(more…)
Tags: arquillian, authentication, eclipselink, glassfish, h2, it, javaee, jdbc, jdbcrealm, junit, maven, rest, rest-assured, security, testing
Posted in Enterprise, Java | 1 Comment »
Monday, April 21st, 2014
Using the Java Persistence API and a decent persistence provider allows us to configure and fine-tune when and how the second level cache is used in our application.
In the following short examples, we’re going to demonstrate those features written as JUnit test cases and running on a H2 in-memory database.
(more…)
Tags: 2nd-level, cache, database, eclipselink, hibernate, jpa, level, persistence
Posted in Java | 2 Comments »
Thursday, February 13th, 2014
Querydsl is a framework that allows us to create elegant, type-safe queries for a variety of different data-sources like Java Persistence API (JPA) entities, Java Data Objects (JDO), mongoDB with Morphia, SQL, Hibernate Search up to Lucene.
In the following tutorial we’re implementing example queries for different environments – Java Persistence API compared with a JPQL and a criteria API query, mongoDB with Morphia and last but not least for Lucene.
(more…)
Tags: builder, database, eclipselink, fluent api, hibernate, hibernate search, jdo, jpa, lucene, mongodb, morphia, persistence, querydsl, sql
Posted in Java | No Comments »
Sunday, April 14th, 2013
One common question that you may encounter one day when using object-relational-mapping in your application is how to slim down data that you’re retrieving from the persistence layer down to a specific subset for your use-case in an efficient manner and without using complex additional mapping frameworks. In some situations you might declare lazy loaded fields but another approach that I’d like to share with you here are JPA2 constructor expressions.
Constructor expressions allow us to create plain old java objects from the result of an JPA query. The advantage is that we may use different projections for different scenarios and without being managed, the POJOs might help us save some resources here.
In the following tutorial, we’re going to persist 100 book entities with multiple properties to an embedded database and we’re using constructor expressions afterwards to create smaller POJOs using a subset of the information available from each persisted book.
(more…)
Tags: criteria api, criteria builder, eclipselink, Java, jpa, jpql, maven, memory, persistence, projection, xml
Posted in Java | No Comments »
Tuesday, February 8th, 2011
Java EE 6 is out and it indeed offers an interesting stack of technologies. So in today’s tutorial we are going to build a small sample web application that builds on this stack using Enterprise JavaBeans, Java Persistence API, Bean Validation, CDI and finally Java Server Faces and PrimeFaces.
The application we’re going to develop is a simple blog app that allows us to create new articles, list them and – finally delete them. We’re also covering some additional topics like JSF navigation, i18n, Ajax-enabled components and the deployment on the GlassFish application server.
(more…)
Tags: bean, bean validation, cdi, eclipselink, ejb, example, glassfish, hibernate, IoC, java ee, javaee, jee, jndi, jsf, jsr-303, jsr-316, jsr-317, jsr-318, maven, mojarra, primefaces, toplink, tutorial, validator, weld
Posted in Java | 85 Comments »
Monday, October 11th, 2010
Today we’re going to take a look at the world of object-relational Mapping and how it is done using the Java Persistence API by creating some basic examples, mapping some relations and querying objects using JPQL or the Criteria API..
(more…)
Tags: annotation, criteria api, eclipselink, example, hibernate, javadb, jee, jpa, jpa2, jpql, jsr-317, junit, mercurial, orm, persistence, toplink, tutorial
Posted in Java | 1 Comment »