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. Overview of One-JAR Before I describe the details of One-JAR, let me first discuss the goals I had in building it. Back to top Problems and solutions Load classes/resources that appear at the root of a JAR file.

Did this work? 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? 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. Java - Session management using Hibernate in a Swing application. Single session.

java - Session management using Hibernate in a Swing application

Start transaction when you need to do a set of operations (like update data after dialog box OK button), commit the tx at the end. The connection though is constantly open (since it's the same session), and thus all opportunities for caching can be used by both Hib and RDBMS. It may also be a good idea to implement a transparent session re-open in case the connection went dead -- users tend to leave applications open for extended periods of time, and it should continue to work Monday even if DB server was rebooted on weekend.

Update Jens Schauder provided a reason to use multiple sessions: partial (unwanted) updates to the session. 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? Ps_ts-6096-nimbus.pdf (application/pdf Object) Tables.