Blogs : Latest entries
|
|
| < Previous page |
|
The Open Session in View pattern is very popular when Hibernate is used in a web application. This allows you to safely use managed entities when your view is being rendered. At Terracotta, we're currently researching what other patterns are popular for Hibernate and how people apply them. One that I'm in particular looking into is the Extended Session pattern for long running conversations. This allows you to disconnect a Hibernate session in between requests and to store it in the HTTP session in the meantime. I'd like to know who's using the extended session pattern and what you use it for. To understand more about this, I developed a small example application to get a feel for the advantages, the benefits, the gotchas and the surprises. The application can be found below, it is inspired by snippets from Hibernate tutorials and example applications: http://svn.terracotta.org/svn/forge/projects/hibernate-disconnected/trunk/ The example uses only servlets, filters and Hibernate. It is a webapp that allows you to create events and add people to it over different requests. When an event has been created with all the relevant people, it can be committed in one step. The intermediate state is kept within the managed entities and the Hibernate session until it's flushed. This is what I found worth mentioning:
Totally unrelated but cool, you can use an |
|
I just finished my talk at JavaZone 2008 about bytecode manipulation. You can download the presentation's PDF file from: http://uwyn.com/download/bytecode_real_world.pdf This is the abstract: Bytecode Manipulation in the Real World Bytecode manipulation has become increasingly popular over the last years. It is used by JPA implementations, application servers, AOP libraries, web frameworks, monitoring systems, profilers, clustering solutions, scripting languages, workflow engines, and much more. In fact, most of today's applications will most probably rely on byte code manipulation, often even without realizing. Application developers however seem to be overly careful and often frown upon bytecode manipulation as an arcane art that is risky and difficult to understand. This presentation will show you that it's easier than you think. We'll go over concise examples that illustrate the concepts. Distinct patterns, coming from different domains, will give you ideas about adopting byte code manipulation for your own products. You'll learn arguments to reassure skeptics and see how the manipulation can plugged into your tool chain. We'll finish off with tips and tricks to write maintainable code with the ASM library. After this session you'll see byte code manipulation as another tool in your arsenal and you'll have a good picture of how to start using it yourself. Outline:
|
|
Next month I'll be speaking at TheServerSide.com Java Symposium. The topics I will cover are: I've done both sessions before and they're pretty solid now. The 'Boldly go...' one has been a huge success at JavaOne as it was booked completely full and I did a repeat session on Friday that still had quite good attendance. See you in Prague! |
|
It's been a while since I wrote some raw JDBC code. I didn't remember that it was so tedious to manually close a series of Note that the ARM blocks or BGGA closures proposals don't make this easier since this cleanup should be done after the prepared statements have been used for a while in various other methods, it doesn't automatically have to be done at the end of a lexical scope. This is what I came up with. Of course, you could write an alternative implementation that creates some kind of repository for the prepared statements in a map and then provide a method that closes them all by going over the entries of the map while preserving the exceptions in a similar manner. Any other suggestions or comments for this to be done better?
private PreparedStatement psStmt1;
private PreparedStatement psStmt2;
private PreparedStatement psStmt3;
public void cleanup() throws SQLException {
SQLException exception = null;
if (psStmt1 != null) {
try {
psStmt1.close();
} catch (SQLException e) {
exception = e;
} finally {
psStmt1 = null;
}
}
if (psStmt2 != null) {
try {
psStmt2.close();
} catch (SQLException e) {
if (exception != null) e.setNextException(exception);
exception = e;
} finally {
psStmt2 = null;
}
}
if (psStmt3 != null) {
try {
psStmt3.close();
} catch (SQLException e) {
if (exception != null) e.setNextException(exception);
exception = e;
} finally {
psStmt3 = null;
}
}
if (exception != null) {
throw exception;
}
} |
|
At JavaPolis 2007, Aaron Houston the coordinator of the Sun Java Champions program, recorded a whole collection of short interviews with the Java Champions that were present at the conference (2-8 mins). If you're wondering what the Java Champions are up to, or even who or what they are, this is a easy and quick way to find out. The interviews can be found on the Java Champions homepage and will eventually move to the library section. You can listen to my interview directly here (6 min 12 MB): https://java-champions.dev.java.net/mp3/JP07-geert-bevin.mp3 |
| < Previous page |



