Explore the Dynamic Proxy API. With the introduction of the Dynamic Proxy API in Java 1.3, a huge and often overlooked improvement has been made to the Java platform.
The uses for dynamic proxies are sometimes hard concepts to grasp. GlassFish JDBC Security with Salted Passwords on MySQL. One of the most successful posts on this blog is my post about setting up a JDBC Security Realm with form based authentication on GlassFish.
Schema Creation Script With Hibernate 4, JPA And Maven. The scenario is trivial – you want to generate a database schema creation script while building your application (and then execute the script on the target database) This was relatively easy with Hibernate 3, as there was the hibernate3-maven-plugin, but it is not compatible with Hibernate 4.
And for every new project you should start with Hibernate 4, of course. So what to do? It’s relatively simple, but takes some time to research and test. The idea is to use the SchemaExport tool. Logback: Logging revisited. Hi, I am back again with my rant about logging as an inherent part of any application design and development.
I am a big fan of strong basics, and in my humble opinion logging is one of those often overlooked but basic critical element of any enterprise grade application. How to change logging level in runtime. Changing the log logging level in runtime is important mainly in production environment where you might want to have debug logging for limited amount of time.
Well, changing the root logger is very simple – assuming you have an input parameter with the wanted logging level simply get the root logger and set by the input logging level, such as: However – the common case is that we maintain log instance per class, for example: and setting the root logger is not enough, since the class level logger will not be affected. Java: Mergesort using Fork/Join Framework. The objective of this entry is to show a simple example of a Fork/Join RecursiveAction, not to delve too much into the possible optimizations to merge sort or the relative advantages of using Fork/Join Pool over the existing Java 6 based implementations like ExecutorService.
DAO layer – Generics to the rescue. Generics can be a powerful tool to create reusable code with the power of compile time verification (type safety..).
Unfortunately I feel the main stream developers still afraid of it. However, in analogy to Hagrid’s spiders I would say that Generics are seriously misunderstood creatures… :-) I hope the following example will demonstrate how useful they can be. The Problem - DAO (Data Access Objects) classes have common methods such as save, update, delete, loadAll.. which are required in every DAO class. Java Executor Service Types. ExecutorService feature was come with Java 5.
It extends Executor interface and provides thread pool feature to execute asynchronous short tasks. There are five ways to execute the tasks asyncronously by using ExecutorService interface provided Java 6. ExecutorService execService = Executors.newCachedThreadPool(); This method of the approach creates a thread pool that creates new threads as needed, but will reuse previously constructed threads when they are available. These pools will typically improve the performance of programs that execute many short-lived asynchronous tasks. ExecutorService execService = Executors.newFixedThreadPool(10); This method of the approach creates a thread pool that reuses a fixed number of threads.
ExecutorService execService = Executors.newSingleThreadExecutor(); Java Code Example for. Configuring Maven to use SLF4J. I mainly write articles for two reasons: to understand something that is new to me or to document something I regularly have to explain to others.
This article definitely falls in the second category: in order to celebrate the new 1.0.0 version of Logback, I’ve decided to write down once and for all how to properly use SLF4J with Maven since it seems there’s no shortage of questions about it. Basics The basis of SLF4J is to have two separate components, one API and one implementation. That means that your code should solely be dependent on the API thus the implementation can be changed at your convenience. Remember that decoupling code from implementations by introducing an interface should be your first concern: at the library level, it’s the role of an API. Java Annotations. Java annotations are used to provide meta data for your Java code.
Being meta data, the annotations do not directly affect the execution of your code, although some types of annotations can actually be used for that purpose. Java annotations were added to Java from Java 5.
Java Proxies. MySQL Stored Procedure Tutorial. Each tutorial is packed with the easy-to-understand examples with detailed explanations. If you go through all the tutorials, you can develop the simple to complex stored procedures in MySQL. Introduction to MySQL Stored Procedures This tutorial introduces to you MySQL stored procedures, their advantages and disadvantages.
Getting Started with MySQL Stored Procedures In this tutorial, we will show you step by step how to develop the first MySQL stored procedure by using the CREATE PROCEDURE statement. MySQL Stored Procedure Variables. Task management with Eclipse Mylyn. Eclipse Mylyn is a software component packaged with the Eclipse IDE. The idea of Mylyn is to integrate tasks into the Eclipse IDE and connect the current state of the Eclipse IDE, e.g. the context with such a task. Software developers perform a variety of activities. They write source code for new functionality, fix bugs, write documentation, answer questions, attend meetings and much more. Developing software in the Eclipse IDE involves writing new classes or methods and modifying existing code. For example the procedure of fixing a bug may involve writing unit tests, refactoring existing code, reading and searching involved code and finally fixing the affected code.
Patrones de diseño. Tratando de entenderlo: Manejo de ramas en Subversion desde Eclipse. En este artículo vamos a ver cómo trabajar desde Eclipse con las ramas de desarrollo de un proyecto gestionado en Subversion. Lo primero que vamos a hacer es crear una rama del proyecto, en la cual podríamos desarrollar una nueva característica del proyecto o corregir un error. Para crear esta rama hacemos clic sobre el proyecto con el botón derecho del ratón y vamos a Team -> Branch/Tag: Para Subversion es lo mismo una rama (branch) que una etiqueta (tag).
Una estiqueta es una rama sobre la que no se incluyen cambios. A continuación seleccionamos el directorio remoto donde se almacenará esta rama. Seleccionamos la revisión sobre la que se va a crear la rama. Por último podemos incluir un comentario e indicar que queremos que nuestra copia local del proyecto se cambie a esta rama para poder desarrollar sobre ella: Tras esto ya se habra creado la rama, con lo que tendremos la siguiente estructura en nuestro repositorio: Seleccionamos el tipo de merge que vamos a realizar.