Hibernate with JPA

To use Hibernate as a persistence provider for the Java Persistence API (JPA) you must include the following jar files into your classpath:

  • From Hibernate Entity Manager
    • hibernate-entitymanager.jar
    • lib/hibernate-annotations.jar
    • lib/hibernate-commons-annotations.jar
    • lib/jboss-archive-browsing.jar
  • From Hibernate Core
    • hibernate3.jar
    • lib/antlr-2.7.6.jar
    • lib/asm-attrs.jar
    • lib/asm.jar
    • lib/c3p0-0.9.1.jar
    • lib/cglib-2.1.3.jar
    • lib/commons-collections-2.1.1.jar
    • lib/commons-logging-1.0.4.jar
    • lib/concurrent-1.3.2.jar
    • lib/dom4j-1.6.1.jar
    • lib/ehcache-1.2.3.jar
    • lib/javassist.jar
    • lib/log4j-1.2.11.jar

If you use a Java SE project you must also include the javaee.jar file from the Java EE 5 SDK.

Here is a sample persistence.xml file:




  
    org.hibernate.ejb.HibernatePersistence
    jdbc/webstore
    
      
      
    
  

Firebird connection pool with SJSAS

To use a connection pool datasource with the Sun Java System Application server you must copy the Firebird JDBC driver “Jaybird” in the directory ${com.sun.aas.instanceRoot}/lib/ext of your application server. The variable ${com.sun.aas.instanceRoot} stands for the application server instance directory, e.g. c:\sun\appserver\domains\domain1 for the default instance under windows environment.

The jaybird driver includes the following special classes for sun application servers:

org.firebirdsql.pool.sun.AppServerDataSource
org.firebirdsql.pool.sun.AppServerConnectionPoolDataSource
org.firebirdsql.pool.sun.AppServerXADataSource

Use the following properties to configure the datasource:

userName      FireBird username
password      FireBird password
databaseName  FireBird database URL (host:)
encoding      Database charset
loginTimeout  Login timeout (seconds)

PostgreSQL backup

PostgreSQL databases are dumped with the pg_dump command. A simple shell script to do the backup job could be as follows:

#!/bin/sh
pg_dump -h  -U  -f  -Z 9 

Passwords cannot be transfered to the pg_dump as a parameter, you must create a file .pgpass in the home directory of the calling user with the following content:

::::

Make bootable USB stick for Linux installation

You need a Linux installation image, e.g. SUSE-Linux-10.1-Remastered-i386-mini.iso. You can download this from a openSuSE mirror server.

The package syslinux must be installed to make a bootable USB stick. So if you haven’t it installed you must do so now.

Asume your USB stick is accessed with device name /dev/sda1, you can use the following commands to write the image to the stick and make it bootable:

umount /dev/sda1
mount -o loop SUSE-Linux-10.1-Remastered-i386-mini.iso /mnt
/mnt/boot/i386/mkbootdisk --32 --partition /dev/sda1 /mnt