Repository creating tables automatically

Recently we noticed while running some ATG unit tests that tables were being created by the ATG repository if they had not already been created by our SQL scripts.  This was a functionality that I was unaware of but apparently it is not unique, Hibernate does this too.  I could not find any documentation about this nor could I determine how to turn it off.

The ATG repository creates these tables using the repository definition and the defaults for column width and data type.  It does not seem to warn that it is creating these tables.

HibernateException: Found two representations of same collection

Sometimes you might stumble upon this confusing exception.

org.hibernate.HibernateException: Found two representations of same collection: com.betweengo.Foos

This could have happened because after clearing a Hibernate session (session.clear()) you updated a property that contains a collection. I found just making sure to clear the session once seemed to fix the problem but that may not be a suitable solution in more complex situations.

More information about this problem can be found at

Catching Oracle exceptions

Oracle SQL queries can throw exceptions. For example in this query f there is no data then Oracle will throw a NO_DATA_FOUND exception.

SELECT status_date INTO v_status_date FROM member WHERE member_id = p_member_id_in;

ORA-01403: no data found

If this query is part of a stored procedure and is called from Hibernate you will get this uninformative exception.

org.hibernate.exception.DataException: could not execute query

Oracle SQL, like many languages, has a try catch construct. In this example you could do the following.

  SELECT status_date INTO v_status_date FROM member WHERE member_id = p_member_id_in;
    v_status_date := NULL;

How to Log SQL on JBoss

Edit the log4j.xml in the conf directory as shown below to turn on SQL debugging of the JDBC CMP plugin.

/apps/jboss/server/default/conf :->diff -c log4j.xml~ log4j.xml
*** log4j.xml~  Mon Sep 30 18:09:27 2002
--- log4j.xml   Tue Apr  4 20:41:18 2006
*** 61,73 ****




--- 61,79 ----




If you want to log Hibernate SQL statements:


If you want to log everything Hibernate’s doing, including SQL statements, schema export, transactions, etc.: