Home » Enterprise Java » Page 90

Enterprise Java

JSF Navigation Example

In this example of JSF Navigation, we will show you how to use various navigation techniques available in Java Server Faces. A set of rules for choosing the next page based on a action, for example a click of button are called navigation rules. In Java Server Faces technology, navigation consists of one or more navigation rules for an application. We ...

Read More »

TestNG beforeMethod Example

In this article, I will show you an example of TestNG @BeforeMethod. This is one of the annotations provided by TestNG that gets invoked before the execution of each test method. It is very similar to JUnit’s setUp() and is useful if you want to setup some test data before the start of the test method. But first my setup ...

Read More »

TestNG DataProvider Example

In this article, I am going to show you some examples of DataProvider. It is one of the methods used in TestNG to support data-driven testing. Before I proceed with my examples, I will brief you on data-driven testing but first let’s get started with the setup details: I am using Eclipse as the IDE, version Luna 4.4.1. I will ...

Read More »

Maven Jetty Plugin Example

In this example, we shall show you how to integrate Apache Maven with Jetty. Apache Maven is a software project management and comprehension tool. It provides powerful features like superior dependency management including automatic updating and transitive dependencies. It follows the principle of convention over configuration, due to which one can start with a minimal configuration and sensible defaults will ...

Read More »

EJB Interceptors Example

1. Introduction This is an example of how to use the javax.interceptor.* in an EJB. Interceptors are used, as the name suggests, to intercept ejb methods calls using methods annotated with interceptor annotation (@AroundInvoke , @AroundTimeout , @PostConstruct etc ). An interceptor method is called by Ejb Container before ejb method call it is intercepting. The Interceptors specification defines two ...

Read More »

TestNG beforeTest example

In this article, I will show you an example of the TestNG @beforeTest annotation. In TestNG, you can configure your tests using annotations that start with @Before or @After. TestNG defines many configuration annotations, each one belonging to a specific event in its lifecycle. @beforeTest is one such annotation. A method with @beforeTest annotation will run, before any test method ...

Read More »

Hibernate First Level Cache Example

In this post we will talk about the Hibernate First Level Cache Strategy. When an application repeatedly hits the database and executes a lot of queries, it’s important as developer to apply a cache between then. Caching recently accessed objects is a very simple way to improve the performance, avoiding having to access the database each time it is required ...

Read More »

Struts 2 and Log4J Example

In this example we will learn how to integrate Struts2 application with Log4j logging framework. Apache Struts is a free, open-source, MVC framework for creating elegant, modern Java web applications. It favors convention over configuration, is extensible using a plugin architecture, and ships with plugins to support REST, AJAX and JSON. Log4J is Apache’s popular logging framework. Tools and technologies ...

Read More »

JSF Managed Beans Example

In this example we will talk about the basics of the JSF Standard and the Managed Bean concept. With these tools we can develop and support an application’s clear architecture, and get an easily integration with java EE modern technologies. Then, we learn how to work with the backend, using JSF Managed Beans.               ...

Read More »

JPA Native SQL Queries Example

In this example, we shall see how to use native SQL queries in JPA. The Java Persistence Query Language is a powerful query language that can be used to bridge the Object Relational world. However, there are cases when the JPQL falls short for example, to execute a Stored Procedure. The JPA optimizes the query written in JPQL for the ...

Read More »