background preloader

Programme Java

Facebook Twitter

Using Java DB in Desktop Applications. Articles Index Sun Microsystems recently announced that it is distributing and supporting Java DB based on the 100 percent Java technology, open-source Apache Derby database.

Using Java DB in Desktop Applications

Derby was previously available under its earlier name, Cloudscape, from its former owners: Cloudscape, Informix, and IBM. IBM donated the Derby product source code to the Apache Foundation as an open-source project. Sun, IBM, other companies, and individuals have been actively involved in development of the relational database as part of the Apache Derby community. Sun distributes Java DB in many of its products, including the Sun Java Enterprise System and the Sun Java System Application Server. Java DB is lightweight at 2 megabytes and embeddable within desktop Java technology applications. This article describes how to download, install, integrate, and deploy Java DB within desktop Java technology applications. Contents Creating the Address Book Demo AddressPanel represents an address record. Simplify your application delivery with One-JAR.

It has been noted that history repeats itself, first as tragedy and then as farce.

Simplify your application delivery with One-JAR

I recently experienced this first hand when I had to deliver a runnable Java application to a client. I've done this many times and it's always fraught with complications. There is plenty of room for error when gathering all of an application's JAR files, writing the launch scripts for DOS and Unix (and Cygwin), and making sure that the client's environment variables all point to the right place. If everything goes perfectly the application will arrive and run as it should. When things go wrong, as they usually do, many hours of client-side support are the result. After recently talking a bemused client through a host of ClassNotFound exceptions, I decided I'd had enough. Hibernate Sessions in Two Tier Rich Client Applications. One of the most populare articles in this blog so far ist the one about, well: Hibernate Sessions in Two Tier Rich Client Applications.

Hibernate Sessions in Two Tier Rich Client Applications

Although the original article is writen in german I keep refering to this article, even in english communities. Therefore I decided to break my habit of writing articles in german only and provide a english version which you are reading right now. This is NOT a direct translation so there might be some differnces in scope, focus and detail. Everybody working with Java and Databases is probably aware of Hibernate. It is a great solution for mapping a database schema to a object model.

How could such a essential problem be unsolved? We tried a lot of things, starting with the antipattern of a single session per application. No transaction control between different parts of the application. Of course if you write a really small simple application this might work, but not for us. The relevant properties of the Hibernate session are Most problems? Apache log4j 1.2 - Short introduction to log4j.

Log4j has three main components: loggers, appenders and layouts.

Apache log4j 1.2 - Short introduction to log4j

These three types of components work together to enable developers to log messages according to message type and level, and to control at runtime how these messages are formatted and where they are reported. Logger hierarchy The first and foremost advantage of any logging API over plain System.out.println resides in its ability to disable certain log statements while allowing others to print unhindered.

This capability assumes that the logging space, that is, the space of all possible logging statements, is categorized according to some developer-chosen criteria. This observation had previously led us to choose category as the central concept of the package. Loggers are named entities. For example, the logger named "" is a parent of the logger named "". The root logger resides at the top of the logger hierarchy.

It always exists, it cannot be retrieved by name. Loggers may be assigned levels. Example 1. Java - Session management using Hibernate in a Swing application. Swing + Hibernate.  Hibernate and Swing demo app. At JBoss World last week in Berlin I presented some advanced Hibernate patterns.

 Hibernate and Swing demo app

Well, I planned to talk longer about the Swing and Hibernate demo app I wrote a few days before but it turned out that although 100% of the audience was using Hibernate, only one poor soul had to work with Hibernate in a two-tier desktop application scenario. So I spent more time on the other patterns and only showed the Swing demo for about 5 minutes at the end of the presentation.

I thought more people would be interested in this, it comes up frequently on forums and the Wiki. Developers who have to access a database from a Swing application with no middle tier always have the same questions: How do I use the Session? And How do I get an updated object into a different view? The answers to these questions are very much interconnected. First, here is a screenshot of the app: On the left is a frame with a tree and a modal dialog that pops up if you create or edit one of the items in the tree. Ps_ts-6096-nimbus.pdf (application/pdf Object) Tables.