Matt RaibleMatt Raible is a Web Developer and Java Champion. Connect with him on LinkedIn.

The Angular Mini-Book The Angular Mini-Book is a guide to getting started with Angular. You'll learn how to develop a bare-bones application, test it, and deploy it. Then you'll move on to adding Bootstrap, Angular Material, continuous integration, and authentication.

Spring Boot is a popular framework for building REST APIs. You'll learn how to integrate Angular with Spring Boot and use security best practices like HTTPS and a content security policy.

For book updates, follow @angular_book on Twitter.

The JHipster Mini-Book The JHipster Mini-Book is a guide to getting started with hip technologies today: Angular, Bootstrap, and Spring Boot. All of these frameworks are wrapped up in an easy-to-use project called JHipster.

This book shows you how to build an app with JHipster, and guides you through the plethora of tools, techniques and options you can use. Furthermore, it explains the UI and API building blocks so you understand the underpinnings of your great application.

For book updates, follow @jhipster-book on Twitter.

10+ YEARS


Over 10 years ago, I wrote my first blog post. Since then, I've authored books, had kids, traveled the world, found Trish and blogged about it all.

Upgrading to Spring 1.2 RC1 and Hibernate 3.0

I spent an hour or so on Friday upgrading Equinox and AppFuse to use Spring 1.2 RC1 and Hibernate 3.0. The upgrade for AppFuse was relatively painless, but the upgrade for Equinox failed. Equinox uses HSQLDB version 1.7.1. The main reason I use the 1.7.1 version is to avoid the infamous "lock exception" that the new HSQL version throws in standalone mode. With version 1.7.1, it seems you could have more than one connection open to the file-based database w/ no problem. I really like this feature in 1.7.1 b/c it means you can run the app in Tomcat and browse the database at the same time.

So what's the problem? Why can't I just use Hibernate 3.0 with HSQL 1.7.1? The problem is I like using the following setting as part of my "sessionFactory" bean:

<prop key="hibernate.hbm2ddl.auto">update</prop>

This setting will update the schema when you change mapping files, but otherwise leave the data intact. Furthermore, it'll actually create the tables if they don't exist. Not so with Hibernate 3. With Hibernate 3, using "update" doesn't create the tables. Of course, upgrading to a newer version of HSQL fixes the problem, but then I get the lock problem. My eventual solution will probably be to hack Hibernate or HSQL, but for now I just won't upgrade Equinox. Another solution might be to look at some other embedded databases. Of course, I could also require users to install a database to run Equinox - but I like having the "no setup required" feature.

Regardless of the problems I experienced with HSQL and Hibernate 3, upgrading AppFuse was pretty painless. Here's the set of instructions I sent to the mailing list:

  1. Download Hibernate 3.0 and Spring 1.2 RC1.
  2. Create a lib/spring-1.2-rc1 and put the following files in it (NOTE: spring.jar now contains aopalliance.jar):
        acegi-security-0.8.1.jar
        commons-codec.jar
        ehcache-1.1.jar
        license.txt
        spring-mock.jar
        spring.jar
  3. Create a lib/hibernate-3.0 and put the following files in it:
        hibernate3.jar
        lgpl.jar
        lib/antlr-2.7.5H3.jar
            antlr.license.txt
            asm.jar
            c3p0-0.8.5.jar
            c3p0.license.txt
            cglib-2.1.jar
            dom4j-1.5.2.jar
            jta.jar
            jta.licence.txt
            oscache-2.1.jar
            swarmcache-1.0rc2.jar
  4. Change the versions for Hibernate and Spring in lib/lib.properties. Also, change the hibernate.jar property to reference hibernate3.jar instead of hibernate2.jar.
  5. In build.xml, change the "package-web" target to include all the Hibernate JARs instead of just specific ones:
    <lib dir="${hibernate.dir}/lib" includes="*.jar" excludes="jta.jar"/>
  6. Change web/common/taglibs.jsp to use uri="/oscache" for the oscache taglib.
  7. Search for "net.sf.hibernate" and replace it with "org.hibernate".
  8. Search for "orm.hibernate" and replace it with "orm.hibernate3" (for Spring).

The major difference for Hibernate is you no longer need odmg-3.0.jar, but you do need asm.jar and antlr-2.7.5H3.jar. Let me know if you find any issues with these instructions. You could also just download AppFuse from CVS.

NOTE: The CVS version of AppFuse has an XDoclet version that only supports generating Hibernate 2.x mapping files. I believe there is support for Hibernate 3 in XDoclet's CVS - but I haven't had a chance to upgrade yet.

Update: Here's more on the HSQL bug that's not really a bug (according to a comment on the post). Regardless of whether it's a bug or not, it'd be nice to have the 1.7.1 behavior as an option - it's a great feature for get-started-quick apps like Equinox.

Posted in Java at Apr 03 2005, 06:52:52 PM MDT 9 Comments