Tag Archives: JDK

Hibernate Criteria Example


via Hibernate Criteria Example | Examples Java Code Geeks.

Hibernate Criteria is a very good interface offered by Hibernate that helps you write queries with comples search criteteria an keep your code readable and elegant.

So these are the tools we are going to use on a Windows 7 platform:

  • JDK 1.7
  • Maven 3.0.5
  • Hibernate 3.6.3.Final
  • MySQL JDBC driver 5.1.9
  • Eclipse 4.2 Juno

The basis of this tutorials is going to be this Eclipse project: Hibernate1to1XMLExample,zip. And it’s based in Hibernate One-to-One Relationship Example (XML Mapping and Annotation). All the code snippets displayed here reffer to App.java file of the aforementioned project. It’s also a good idea to take a look at Hibernate Query Language Example.

Hibernate Logging Configuration – SLF4J + Log4j and Logback


via Hibernate Logging Configuration – SLF4J + Log4j and Logback | Examples Java Code Geeks.

In this example we are going to see how to configure Logging in Hibernate.SLF4J (Simple Logging Facade for Java) is a very nice logging framwork that Hibernate uses, in order to output your logs using your favorite logging tool ( log4j, JCL, JDK logging, logback) to your preferd location. We are going to use SLF4J along with log4j and Logback.

So these are the tools we are going to use on a Windows 7 platform:

  • JDK 1.7
  • Maven 3.0.5
  • Hibernate 4.2.3.Final
  • MySQL JDBC driver 5.1.9
  • Eclipse 4.3 Kepler

The basis of this tutorials is going to be this Eclipse project: HibernateMySQLExample.zip

Android Hello World Example – How to develop android apps


via Android Hello World Example – How to develop android apps.

In this tutorial, we will go through the necessary steps you need to take in order to develop your first Android application in Eclipse IDE using the ADT plugin and run it with an Android Virtual Device.

The ADT plugin provides easy Android Project creation and management with rich editor features and documentation as well as Android Virtual Device (AVD) management.

The steps :

  1. Download and Install the Android SDK
  2. Download and Install the ADT Eclipse plugin
  3. Create an Android Virtual Device (AVD)
  4. Create an Android Project with Eclipse
  5. Run the Application in the Android Virtual Device

We will use the following tools in a Windows 64-bit platform:

  1. JDK 1.7
  2. Eclipse 4.2 Juno
  3. Android SKD 4.2

Hazelcast Distributed Execution with Spring


via Hazelcast Distributed Execution with Spring | Online Technology Vision.

The ExecutorService feature had come with Java 5 and is under java.util.concurrent package. It extends the Executor interface and provides a thread pool functionality to execute asynchronous short tasks. Java Executor Service Types is suggested to look over basic ExecutorService implementation.

Also ThreadPoolExecutor is a very useful implementation of ExecutorService ınterface. It extendsAbstractExecutorService providing default implementations of ExecutorService execution methods. It provides improved performance when executing large numbers of asynchronous tasks and maintains basic statistics, such as the number of completed tasks. How to develop and monitor Thread Pool Services by using Spring is also suggested to investigate how to develop and monitor Thread Pool Services.

So far, we have just talked Undistributed Executor Service implementation. Let us also investigate Distributed Executor Service.

Hazelcast Distributed Executor Service feature is a distributed implementation of java.util.concurrent.ExecutorService. It allows to execute business logic in cluster. There are four alternative ways to realize it :

1) The logic can be executed on a specific cluster member which is chosen.
2) The logic can be executed on the member owning the key which is chosen.
3) The logic can be executed on the member Hazelcast will pick.
4) The logic can be executed on all or subset of the cluster members.

This article shows how to develop Distributed Executor Service via Hazelcast and Spring.

Used Technologies :

JDK 1.7.0_09
Spring 3.1.3
Hazelcast 2.4
Maven 3.0.4

Spring AOP Example


via Spring AOP Example | Examples Java Code Geeks.

With this tutorial we shall show you how to use Aspect Oriented Programming in Spring Framework. AOP is used in the Spring Framework to provide declarative enterprise services, especially as a replacement for EJB declarative services. It is also used to allow users to implement custom aspects, complementing their use of OOP with AOP.

We will demonstrate how to create and apply some central AOP concepts. In short we will create all types of advices, we will use a pointcut and an advisor over an advice and we will check on some special features of Spring in interceptors and proxy beans.

Our preferred development environment is Eclipse. We are using Eclipse Juno (4.2) version, along with Maven Integration plugin version 3.1.0. You can download Eclipse from here and Maven Plugin for Eclipse from here. The installation of Maven plugin for Eclipse is out of the scope of this tutorial and will not be discussed. We are also using Spring version 3.2.3 and the JDK 7_u_21.

Let’s begin,

Hibernate One-to-Many Relationship Example (XML Mapping and Annotation)


via Hibernate One-to-Many Relationship Example (XML Mapping and Annotation) | Examples Java Code Geeks.

In this example we are going to see how to map classes to databases tables which have one-to-many relationships. We are going to see the mapping both with XML Mapping and with Annotations.

So these are the tools we are going to use on a Windows 7 platform:

  • JDK 1.7
  • Maven 3.0.5
  • Hibernate 3.6.3.Final
  • MySQL JDBC driver 5.1.9
  • Eclipse 4.2 Juno

Hibernate Cascade example


via Hibernate Cascade example | Examples Java Code Geeks.

In this tutorial we are going to see the use of  the cascade feature of relational databases and how it is applied in Hibernate. This tutorial is based on the previous Hibernate One-to-Many Relationship Example (XML Mapping and Annotation). You can download the Eclipse project from there.

So these are the tools we are going to use on a Windows 7 platform:

  • JDK 1.7
  • Maven 3.0.5
  • Hibernate 3.6.3.Final
  • MySQL JDBC driver 5.1.9
  • Eclipse 4.2 Juno