• Hibernate in a Layered Architecture

    Hibernate in a Layered ArchitectureThis page is used to centralize the issues developers have with a layered architecture and Hibernate as the persistence layer. Usually, you have some kind of service layer on top of ...
    Profile Photo
    last modified by sebersole
  • Distributed Objects With Hibernate

    Problem:You are building a three tier distributed system and you are passing persistent objects between tiers. When you send the objects back to the server, you want to save the only the changes. Solutions:1)Hiberna...
    Profile Photo
    last modified by sebersole
  • A case for insensitiveness

    Compatible with Hibernate 2.1.8, easily adaptable to 3. Written on June, 2005, by Pietro Polsinelli. Consider this requirement: on a case sensitive db, say named "Elcaro", have case in-sensitive queries. So if I searc...
    Profile Photo
    last modified by sebersole
  • Best Practices for Thick-Client Applications (i.e., non-web apps.)

    Christian: I have now written a proof of concept that shows how to work with Hibernate in a two-tiered thick client scenario. Please read my weblog entry. This should answer most questions on this page. Started by Gun...
    Profile Photo
    last modified by sebersole
  • Remote Lazy Loading

    This code demonstrates custom collection type and custom tuplizer (since Hibernat 3.1).Tuplizer registers custom proxy factory to return proxies using custom serialization.Proxy is desirialized on client with callback...
    Profile Photo
    last modified by sebersole
  • Managing multiple databases transparently

    The ideas here meet the problems of a single application that reads and persists entities on multiple databases, even not of the same type, e.g. one is an Oracle instance, the other a MySQL one. In our case, we have a...
    Profile Photo
    last modified by sebersole
  • Page View and User Tracking via Interceptors

    This article discusses using interceptors to provide transparent (to the coder) support for page view and user tracking via the Interceptor mechanism. If you use JAAS authentication (e.g., Tomcat form-based authentica...
    Profile Photo
    last modified by sebersole
  • Audit Logging

    It appears to be a common request for users of Hibernate to want to log changes to data in an Audit History table. I'm yet to see any solution that works in the forums, mainly due to problems with getting pre-update v...
    Profile Photo
    last modified by sebersole
  • UserType for persisting a Typesafe Enumeration with a VARCHAR column

    Use this Typesafe Enumeration class in your domain model as a simple property type (e.g. of the Comment class in a forum): public class Rating implements Serializable {     private String name;  ...
    Profile Photo
    last modified by sebersole
  • UserType for non-default TimeZone

    Hibernate's built-in date, time and timestamp types assume that dates in the database are in Java's default time zone, implicitly. If this assumption is false (and you can't make it true by calling java.util.TimeZone....
    Profile Photo
    last modified by sebersole
  • UserVersionType for non-default TimeZone

    This is a variation on UserType for non-default TimeZone with the column being a UserVersionType.  While the changes to the code there are not major, adding the code there would (IMHO) clutter that page too much....
    Profile Photo
    last modified by sebersole
  • UserType for dealing with fixed length CHAR fields

    This usertype can be used to cope with databases that store strings as fixed length CHAR fields. When it loads up a CHAR, it will trim trailing blanks, so that for instance if you are storing a surname as "JONES " in ...
    Profile Photo
    last modified by sebersole
  • Security: JAAS LoginModule

    The Java Authentication and Authorization API (JAAS) provides a standard way for applications to handle user identification and permission issues. Many people compare JAAS to PAM modules on Unix/Linux systems.   ...
    Profile Photo
    last modified by sebersole
  • Security: Declarative permissions using JAAS and Interceptors

    Disclaimer: this code compiles but has not yet been tested because I wish to use a hibernate-based Policy instead of the standard text-based one.  Use with caution. In Security: JAAS LoginModule I mentioned that ...
    Profile Photo
    last modified by sebersole
  • Security: adding message digests via interceptors

    This article discusses using an Interceptor to automatically generate MAC digests for saved and updated records. This provides a mechanism to identify database records created or modified by unauthorized and presumabl...
    Profile Photo
    last modified by sebersole
  • Security: Transparent encryption of persisted data (with Jasypt UserTypes)

    This article discusses the setup needed to store sensitive data with hibernate in an encrypted manner. For this purpose, the open source library Jasypt (Java Simplified Encryption) is used. Jasypt can be found at: htt...
    Profile Photo
    last modified by sebersole
  • QueryCache

    Hibernate version 2.1.4 introduced the concept of a pluggable QueryCache by making net.sf.hibernate.cache.QueryCache an interface as opposed to a concrete class. The standard implementation (net.sf.hibernate.cache.Sta...
    Profile Photo
    last modified by sebersole
  • Performance: Hibernate3 startup time

    I'm having sucess with the following methodology in hibernate3 and Tomcat 5.5.x to speed up the Hibernate SessionFactory building by making use of the Configuration().addCacheableFile API call.   This is only rec...
    Profile Photo
    last modified by sebersole
  • Pagination

    Compatible with Hibernate 3.2.4 SP1. Last rewritten on July, 2007, by Pietro Polsinelli. In the last update (for version 3.2.4), the code has been simplified.   I propose here a pagination solution, which took ...
    Profile Photo
    last modified by sebersole
  • Statistics Interpreter

    I wrote this small web interface to dynamically communicate with Hibernate Statistics implementation (in case you don't have JMX :-). It uses BeanShell (www.beanshell.org) to interpret [Interpreter API] our commands f...
    Profile Photo
    last modified by sebersole