-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 12 posts ] 
Author Message
 Post subject: How to get only super class in table-per-subclass strategy?
PostPosted: Tue Apr 18, 2006 3:29 pm 
Newbie

Joined: Tue Apr 18, 2006 2:50 pm
Posts: 10
I'm trying to get instances of the super class in a "table per subclass"
inheritance mapping strategy but have not been successful. My core
questions are:

1) Is it possible to get instances of only the super class?

2) Is it possible to tell Hibernate to not add "left outer join"s to the
super class select statements (see below)?

I've looked at the test/joinedsubclass JUnit test case and feel I have a
similar situation. Where I differ is not wanting to fetch the subclass
data unless explictly requested because the subclass contains BLOB
data. Additionally, there will always be a row in the subclass table
for each row in the super class table.

I've read Hibernate In Action, done extensive Googling and searched
the Hibernate web site, but have not found an answer. Maybe I need a
paradigm shift in my thinking/implementation.

Thanks.

-Eric Trull

Hibernate version:
3.1.3

Mapping documents:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.xxx.yyy">

  <!-- Data store document description -->
  <class name="DocumentDescription" table="DB_FILE" lazy="true">
 
    <!--Primary key-->
    <id name="primaryKey" column="DB_FILE_ID" type="long">
      <generator class="sequence">
         <param name="sequence">DB_FILE_SEQ</param>
      </generator>
    </id>

    <natural-id>
      <!-- File name -->
      <property name="name" column="NAME" type="string" length="256"
                not-null="true" update="false" />

      <!-- File content type -->
      <property name="type" column="FILE_TYPE" type="string"
                     length="50" not-null="true" update="false" />
               
      <!-- File date -->
      <property name="created" column="CREATED_DATE"
                type="com.xxx.hibernate.type.ForcedJavaUtilDateType"
                not-null="true" update="false" />
    </natural-id>

  </class>

</hibernate-mapping>

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.xxx.yyy">

  <!-- Data store document description plus compressed content -->
  <joined-subclass name="Document" extends="DocumentDescription"
                   table="DB_FILE_DATA" lazy="true">
    <!-- Foreign key column -->
    <key column="DB_FILE_ID" />
     
    <!-- Document compressed content -->
    <property name="compressedContent" column="COMPRESSED_DATA"
              type="binary" not-null="true" lazy="true" />
  </joined-subclass>

</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():
DocumentDescription is a simple POJO. Document extends
DocumentDescription and adds methods to compress/de-compress
the BLOB data. I'm using a DocumentDescriptionHome generated
by Hibernate Tools. I've removed CUD methods (leaving the R
(find) methods) from DocumentDescriptionHome and will rely on
DocumentHome for CUD.

I've tried modifying DocumentDescriptionHome to use a HQL
statement (from DocumentDescription as description where
description.primaryKey=:primaryKey) instead of the Criteria API
without success.

Code:
public class DocumentDescriptionHome {

    private Session getCurrentSession() {
        // using thread local pattern
        return HibernateUtility.getSessionFactory().getCurrentSession();
    }

    public DocumentDescription findById(Long id) {
        log.debug("getting DocumentDescription instance with id: " + id);
        try {
            DocumentDescription instance = (DocumentDescription) getCurrentSession()
                    .get(DocumentDescription.class, id);
            if (instance==null) {
                log.debug("get successful, no instance found");
            } else {
                log.debug("get successful, instance found");
            }
            return instance;
        } catch (RuntimeException re) {
            log.error("get failed", re);
            throw re;
        }
    }

    ...

    // for testing only
    public static void main(String[] args) {
        DocumentDescriptionHome home = new DocumentDescriptionHome();
        DocumentDescription description;
       
        HibernateUtility.getSessionFactory().getCurrentSession()
                .beginTransaction();
       
        description = home.findById(new Long(2668L));
        System.out.println(description);
        if (description instanceof Document) {
            try {
                System.out.println(
                    new String(((Document) description).getContent()));
            } catch (IOException exception) {
                // TODO: Handle IOException
                exception.printStackTrace();
            }
        }
       
        HibernateUtility.getSessionFactory().getCurrentSession()
                .getTransaction().rollback();
        HibernateUtility.getSessionFactory().getCurrentSession().close();
    }
}


Full stack trace of any exception that occurs:

Name and version of the database you are using:
Oracle 9

The generated SQL (show_sql=true):
    Hibernate: select documentde0_.DB_FILE_ID as DB1_0_0_, documentde0_.NAME as NAME0_0_, documentde0_.FILE_TYPE as FILE3_0_0_, documentde0_.CREATED_DATE as CREATED4_0_0_, documentde0_1_.COMPRESSED_DATA as COMPRESSED2_1_0_, case when documentde0_1_.DB_FILE_ID is not null then 1 when documentde0_.DB_FILE_ID is not null then 0 end as clazz_0_ from ASADB.DB_FILE documentde0_ left outer join ASADB.DB_FILE_DATA documentde0_1_ on documentde0_.DB_FILE_ID=documentde0_1_.DB_FILE_ID where documentde0_.DB_FILE_ID=?

Debug level Hibernate log excerpt:
    Sanitized
    0 INFO [main] org.hibernate.cfg.Environment - Hibernate 3.1.3
    10 INFO [main] org.hibernate.cfg.Environment - loaded properties from resource hibernate.properties: {hibernate.cglib.use_reflection_optimizer=true, hibernate.jdbc.use_streams_for_binary=true}
    10 INFO [main] org.hibernate.cfg.Environment - using java.io streams to persist binary types
    10 INFO [main] org.hibernate.cfg.Environment - using CGLIB reflection optimizer
    10 INFO [main] org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
    150 INFO [main] org.hibernate.cfg.Configuration - configuring from resource: /hibernate.cfg.xml
    160 INFO [main] org.hibernate.cfg.Configuration - Configuration resource: /hibernate.cfg.xml
    701 DEBUG [main] com.xxx.hibernate.ImportFromClassPathEntityResolver - Trying to resolve system id: http://hibernate.sourceforge.net/hibern ... on-3.0.dtd
    701 DEBUG [main] org.hibernate.util.DTDEntityResolver - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd]
    701 DEBUG [main] org.hibernate.util.DTDEntityResolver - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
    711 DEBUG [main] org.hibernate.util.DTDEntityResolver - located [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd] in classpath
    811 DEBUG [main] org.hibernate.cfg.Configuration - connection.driver_class=oracle.jdbc.driver.OracleDriver
    811 DEBUG [main] org.hibernate.cfg.Configuration - default_schema=XXX
    811 DEBUG [main] org.hibernate.cfg.Configuration - dialect=org.hibernate.dialect.Oracle9Dialect
    821 DEBUG [main] org.hibernate.cfg.Configuration - connection.url=jdbc:oracle:thin:@xxx:yyy:zzz
    821 DEBUG [main] org.hibernate.cfg.Configuration - connection.username=xxx
    821 DEBUG [main] org.hibernate.cfg.Configuration - connection.password=yyy
    821 DEBUG [main] org.hibernate.cfg.Configuration - c3p0.min_size=5
    821 DEBUG [main] org.hibernate.cfg.Configuration - c3p0.max_size=20
    821 DEBUG [main] org.hibernate.cfg.Configuration - c3p0.timeout=1800
    821 DEBUG [main] org.hibernate.cfg.Configuration - c3p0.max_statements=50
    821 DEBUG [main] org.hibernate.cfg.Configuration - current_session_context_class=thread
    821 DEBUG [main] org.hibernate.cfg.Configuration - show_sql=true
    821 DEBUG [main] org.hibernate.cfg.Configuration - null<-org.dom4j.tree.DefaultAttribute@187c55c [Attribute: name resource value "com/xxx/yyy/DocumentDescription.hbm.xml"]
    821 INFO [main] org.hibernate.cfg.Configuration - Reading mappings from resource: com/xxx/yyy/DocumentDescription.hbm.xml
    821 DEBUG [main] com.xxx.hibernate.ImportFromClassPathEntityResolver - Trying to resolve system id: http://hibernate.sourceforge.net/hibern ... ng-3.0.dtd
    821 DEBUG [main] org.hibernate.util.DTDEntityResolver - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd]
    821 DEBUG [main] org.hibernate.util.DTDEntityResolver - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
    821 DEBUG [main] org.hibernate.util.DTDEntityResolver - located [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd] in classpath
    1062 INFO [main] org.hibernate.cfg.HbmBinder - Mapping class: com.xxx.yyy.DocumentDescription -> DB_FILE
    1072 DEBUG [main] org.hibernate.cfg.HbmBinder - Mapped property: primaryKey -> DB_FILE_ID
    1102 DEBUG [main] org.hibernate.cfg.HbmBinder - Mapped property: name -> NAME
    1102 DEBUG [main] org.hibernate.cfg.HbmBinder - Mapped property: type -> FILE_TYPE
    1102 DEBUG [main] org.hibernate.cfg.HbmBinder - Mapped property: created -> CREATED_DATE
    1102 DEBUG [main] org.hibernate.cfg.Configuration - null<-org.dom4j.tree.DefaultAttribute@d507e9 [Attribute: name resource value "com/xxx/yyy/Document.hbm.xml"]
    1102 INFO [main] org.hibernate.cfg.Configuration - Reading mappings from resource: com/xxx/yyy/Document.hbm.xml
    1102 DEBUG [main] com.xxx.hibernate.ImportFromClassPathEntityResolver - Trying to resolve system id: http://hibernate.sourceforge.net/hibern ... ng-3.0.dtd
    1102 DEBUG [main] org.hibernate.util.DTDEntityResolver - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd]
    1102 DEBUG [main] org.hibernate.util.DTDEntityResolver - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
    1122 DEBUG [main] org.hibernate.util.DTDEntityResolver - located [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd] in classpath
    1282 INFO [main] org.hibernate.cfg.HbmBinder - Mapping joined-subclass: com.xxx.yyy.Document -> DB_FILE_DATA
    1282 DEBUG [main] org.hibernate.cfg.HbmBinder - Mapped property: compressedContent -> COMPRESSED_DATA
    1282 INFO [main] org.hibernate.cfg.Configuration - Configured SessionFactory: null
    1282 DEBUG [main] org.hibernate.cfg.Configuration - properties: {show_sql=true, java.vendor=Sun Microsystems Inc., hibernate.connection.url=jdbc:oracle:thin:@xxx:yyy:zzz, c3p0.min_size=5, os.name=Windows XP, sun.boot.class.path=C:\Program Files\Java\j2re1.4.2_11\lib\rt.jar;C:\Program Files\Java\j2re1.4.2_11\lib\i18n.jar;C:\Program Files\Java\j2re1.4.2_11\lib\sunrsasign.jar;C:\Program Files\Java\j2re1.4.2_11\lib\jsse.jar;C:\Program Files\Java\j2re1.4.2_11\lib\jce.jar;C:\Program Files\Java\j2re1.4.2_11\lib\charsets.jar;C:\Program Files\Java\j2re1.4.2_11\classes, hibernate.current_session_context_class=thread, hibernate.c3p0.max_size=20, sun.java2d.fontpath=, java.vm.specification.vendor=Sun Microsystems Inc., c3p0.max_size=20, java.runtime.version=1.4.2_11-b06, default_schema=XXX, hibernate.c3p0.min_size=5, user.name=BAR, connection.driver_class=oracle.jdbc.driver.OracleDriver, current_session_context_class=thread, hibernate.c3p0.timeout=1800, user.language=en, sun.boot.library.path=C:\Program Files\Java\j2re1.4.2_11\bin, dialect=org.hibernate.dialect.Oracle9Dialect, java.version=1.4.2_11, user.timezone=, sun.arch.data.model=32, java.endorsed.dirs=C:\Program Files\Java\j2re1.4.2_11\lib\endorsed, sun.cpu.isalist=pentium i486 i386, file.encoding.pkg=sun.io, file.separator=\, java.specification.name=Java Platform API Specification, hibernate.cglib.use_reflection_optimizer=true, java.class.version=48.0, user.country=US, connection.url=jdbc:oracle:thin:@xxx:yyy:zzz, java.home=C:\Program Files\Java\j2re1.4.2_11, java.vm.info=mixed mode, os.version=5.1, path.separator=;, connection.password=xxx, java.vm.version=1.4.2_11-b06, java.util.prefs.PreferencesFactory=java.util.prefs.WindowsPreferencesFactory, hibernate.connection.password=xxx, user.variant=, java.awt.printerjob=sun.awt.windows.WPrinterJob, sun.io.unicode.encoding=UnicodeLittle, awt.toolkit=sun.awt.windows.WToolkit, hibernate.connection.username=asadb, user.home=C:\Documents and Settings\bar, java.specification.vendor=Sun Microsystems Inc., java.library.path=C:\Program Files\Java\j2re1.4.2_11\bin;.;C:\WINDOWS\system32;C:\WINDOWS;C:\oracle\ora81\bin;C:\Program Files\Oracle\jre\1.1.7\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\j2sdk1.4.2_11\bin, java.vendor.url=http://java.sun.com/, hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver, connection.username=asadb, java.vm.vendor=Sun Microsystems Inc., hibernate.dialect=org.hibernate.dialect.Oracle9Dialect, hibernate.jdbc.use_streams_for_binary=true, java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, java.class.path=C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\target\classes;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\activation\jars\activation-1.0.2.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\asm\jars\asm-1.5.3.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\hibernate\jars\antlr-2.7.6rc1.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\asm\jars\asm-attrs-1.5.3.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\c3p0\jars\c3p0-0.9.0.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\cglib\jars\cglib-2.1.3.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\css\jars\clsidl-20040115.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\commons-collections\jars\commons-collections-2.1.1.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\commons-logging\jars\commons-logging-1.0.4.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\commons-io\jars\commons-io-1.1.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\commons-net\jars\commons-net-1.4.0.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\commons-pool\jars\commons-pool-1.1.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\csl-security\jars\csl-security-2.2.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\csl-util\jars\csl-util-20050513.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\dom4j\jars\dom4j-1.6.1.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\ehcache\jars\ehcache-1.1.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\glue\jars\glue-all-5.0.2.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\hibernate\jars\hibernate-3.1.3.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\jdbc-stdext\jars\jdbc-stdext-2.0.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\jdic\jars\jdic-0.9.1.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\jdic\jars\jdic-windows-0.9.1.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\jnlp\jars\jnlp-1.2.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\jta\jars\jta-1.0.1b.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\log4j\jars\log4j-1.2.12.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\oracle\jars\ojdbc14.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\velocity\jars\velocity-1.4.jar, c3p0.timeout=1800, java.vm.specification.name=Java Virtual Machine Specification, java.vm.specification.version=1.0, sun.cpu.endian=little, sun.os.patch.level=Service Pack 2, java.io.tmpdir=C:\DOCUME~1\bar\LOCALS~1\Temp\, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, hibernate.default_schema=XXX, os.arch=x86, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, java.ext.dirs=C:\Program Files\Java\j2re1.4.2_11\lib\ext, user.dir=C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo, line.separator=
    , java.vm.name=Java HotSpot(TM) Client VM, file.encoding=Cp1252, java.specification.version=1.4, c3p0.max_statements=50, hibernate.show_sql=true, hibernate.c3p0.max_statements=50}
    1292 DEBUG [main] org.hibernate.cfg.Configuration - Preparing to build session factory with filters : {}
    1292 DEBUG [main] org.hibernate.cfg.Configuration - processing extends queue
    1292 DEBUG [main] org.hibernate.cfg.Configuration - processing collection mappings
    1292 DEBUG [main] org.hibernate.cfg.Configuration - processing native query and ResultSetMapping mappings
    1292 DEBUG [main] org.hibernate.cfg.Configuration - processing association property references
    1292 DEBUG [main] org.hibernate.cfg.Configuration - processing foreign key constraints
    1292 DEBUG [main] org.hibernate.cfg.Configuration - resolving reference to class: com.xxx.yyy.DocumentDescription
    1462 INFO [main] org.hibernate.connection.C3P0ConnectionProvider - C3P0 using driver: oracle.jdbc.driver.OracleDriver at URL: jdbc:oracle:thin:@xxx:yyy:zzz
    1462 INFO [main] org.hibernate.connection.C3P0ConnectionProvider - Connection properties: {user=asadb, password=****}
    1462 INFO [main] org.hibernate.connection.C3P0ConnectionProvider - autocommit mode: false
    1663 INFO [main] com.mchange.v2.log.MLog - MLog clients using log4j logging.
    1713 INFO [main] com.mchange.v2.c3p0.C3P0Registry - Initializing c3p0-0.9.0 [built 11-July-2005 00:43:29 -0400; debug? true; trace: 10]
    2093 INFO [main] com.mchange.v2.c3p0.PoolBackedDataSource - Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@1415056 [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@11c0d60 [ acquireIncrement -> 1, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 11c0d60, idleConnectionTestPeriod -> 0, initialPoolSize -> 5, maxIdleTime -> 1800, maxPoolSize -> 20, maxStatements -> 50, maxStatementsPerConnection -> 0, minPoolSize -> 5, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@1d9e282 [ description -> null, driverClass -> null, factoryClassLocation -> null, identityToken -> 1d9e282, jdbcUrl -> jdbc:oracle:thin:@xxx:yyy:zzz, properties -> {user=******, password=******} ], preferredTestQuery -> null, propertyCycle -> 300, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, usesTraditionalReflectiveProxies -> false ], factoryClassLocation -> null, identityToken -> 1415056, numHelperThreads -> 3 ]
    2153 DEBUG [main] com.mchange.v2.resourcepool.BasicResourcePool - awaitAvailable(): [unknown]
    2153 DEBUG [main] com.mchange.v2.resourcepool.BasicResourcePool - trace com.mchange.v2.resourcepool.BasicResourcePool@10c0f66 [managed: 0, unused: 0, excluded: 0]
    2824 DEBUG [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2] com.mchange.v2.resourcepool.BasicResourcePool - trace com.mchange.v2.resourcepool.BasicResourcePool@10c0f66 [managed: 1, unused: 1, excluded: 0]
    2824 DEBUG [main] com.mchange.v2.resourcepool.BasicResourcePool - resource age is okay: com.mchange.v2.c3p0.impl.NewPooledConnection@1fcf790 ---> age: 0 max: 1800000 [com.mchange.v2.resourcepool.BasicResourcePool@10c0f66]
    2834 DEBUG [main] com.mchange.v2.resourcepool.BasicResourcePool - trace com.mchange.v2.resourcepool.BasicResourcePool@10c0f66 [managed: 1, unused: 0, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@1fcf790)
    [SNIP]
    3115 DEBUG [main] org.hibernate.cfg.SettingsFactory - could not get database version from JDBC metadata
    3115 INFO [main] org.hibernate.cfg.SettingsFactory - RDBMS: Oracle, version: Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.6.0 - Production
    3115 INFO [main] org.hibernate.cfg.SettingsFactory - JDBC driver: Oracle JDBC driver, version: 9.2.0.5.0
    [SNIP]
    3165 DEBUG [main] com.mchange.v2.c3p0.stmt.GooGooStatementCache - checkinAll(): com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 0; checked out: 0; num connections: 0; num keys: 0
    3175 DEBUG [main] com.mchange.v2.resourcepool.BasicResourcePool - trace com.mchange.v2.resourcepool.BasicResourcePool@10c0f66 [managed: 1, unused: 0, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@1fcf790)
    3195 DEBUG [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1] com.mchange.v2.resourcepool.BasicResourcePool - trace com.mchange.v2.resourcepool.BasicResourcePool@10c0f66 [managed: 2, unused: 2, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@1fcf790)
    3245 INFO [main] org.hibernate.dialect.Dialect - Using dialect: org.hibernate.dialect.Oracle9Dialect
    3265 INFO [main] org.hibernate.transaction.TransactionFactoryFactory - Using default transaction strategy (direct JDBC transactions)
    3275 INFO [main] org.hibernate.transaction.TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
    3275 INFO [main] org.hibernate.cfg.SettingsFactory - Automatic flush during beforeCompletion(): disabled
    3275 INFO [main] org.hibernate.cfg.SettingsFactory - Automatic session close at end of transaction: disabled
    3275 INFO [main] org.hibernate.cfg.SettingsFactory - JDBC batch size: 15
    3275 INFO [main] org.hibernate.cfg.SettingsFactory - JDBC batch updates for versioned data: disabled
    3275 INFO [main] org.hibernate.cfg.SettingsFactory - Scrollable result sets: enabled
    3275 DEBUG [main] org.hibernate.cfg.SettingsFactory - Wrap result sets: disabled
    3275 INFO [main] org.hibernate.cfg.SettingsFactory - JDBC3 getGeneratedKeys(): disabled
    3275 INFO [main] org.hibernate.cfg.SettingsFactory - Connection release mode: auto
    3275 INFO [main] org.hibernate.cfg.SettingsFactory - Default schema: XXX
    3275 INFO [main] org.hibernate.cfg.SettingsFactory - Default batch fetch size: 1
    3275 INFO [main] org.hibernate.cfg.SettingsFactory - Generate SQL with comments: disabled
    3275 INFO [main] org.hibernate.cfg.SettingsFactory - Order SQL updates by primary key: disabled
    3275 INFO [main] org.hibernate.cfg.SettingsFactory - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
    3285 INFO [main] org.hibernate.hql.ast.ASTQueryTranslatorFactory - Using ASTQueryTranslatorFactory
    3285 INFO [main] org.hibernate.cfg.SettingsFactory - Query language substitutions: {}
    3285 INFO [main] org.hibernate.cfg.SettingsFactory - Second-level cache: enabled
    3285 INFO [main] org.hibernate.cfg.SettingsFactory - Query cache: disabled
    3285 INFO [main] org.hibernate.cfg.SettingsFactory - Cache provider: org.hibernate.cache.EhCacheProvider
    3295 INFO [main] org.hibernate.cfg.SettingsFactory - Optimize cache for minimal puts: disabled
    3295 INFO [main] org.hibernate.cfg.SettingsFactory - Structured second-level cache entries: disabled
    3295 DEBUG [main] org.hibernate.exception.SQLExceptionConverterFactory - Using dialect defined converter
    3305 INFO [main] org.hibernate.cfg.SettingsFactory - Echoing all SQL to stdout
    3305 INFO [main] org.hibernate.cfg.SettingsFactory - Statistics: disabled
    3305 INFO [main] org.hibernate.cfg.SettingsFactory - Deleted entity synthetic identifier rollback: disabled
    3305 INFO [main] org.hibernate.cfg.SettingsFactory - Default entity-mode: pojo
    3335 DEBUG [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2] com.mchange.v2.resourcepool.BasicResourcePool - trace com.mchange.v2.resourcepool.BasicResourcePool@10c0f66 [managed: 3, unused: 3, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@1fcf790)
    3365 INFO [main] org.hibernate.impl.SessionFactoryImpl - building session factory
    3365 DEBUG [main] org.hibernate.impl.SessionFactoryImpl - Session factory constructed with filter configurations : {}
    3375 DEBUG [main] org.hibernate.impl.SessionFactoryImpl - instantiating session factory with properties: {java.vendor=Sun Microsystems Inc., show_sql=true, hibernate.connection.url=jdbc:oracle:thin:@xxx:yyy:zzz, c3p0.min_size=5, os.name=Windows XP, sun.boot.class.path=C:\Program Files\Java\j2re1.4.2_11\lib\rt.jar;C:\Program Files\Java\j2re1.4.2_11\lib\i18n.jar;C:\Program Files\Java\j2re1.4.2_11\lib\sunrsasign.jar;C:\Program Files\Java\j2re1.4.2_11\lib\jsse.jar;C:\Program Files\Java\j2re1.4.2_11\lib\jce.jar;C:\Program Files\Java\j2re1.4.2_11\lib\charsets.jar;C:\Program Files\Java\j2re1.4.2_11\classes, hibernate.current_session_context_class=thread, hibernate.c3p0.max_size=20, sun.java2d.fontpath=, java.vm.specification.vendor=Sun Microsystems Inc., c3p0.max_size=20, java.runtime.version=1.4.2_11-b06, default_schema=XXX, hibernate.c3p0.min_size=5, user.name=BAR, connection.driver_class=oracle.jdbc.driver.OracleDriver, current_session_context_class=thread, hibernate.c3p0.timeout=1800, user.language=en, sun.boot.library.path=C:\Program Files\Java\j2re1.4.2_11\bin, dialect=org.hibernate.dialect.Oracle9Dialect, java.version=1.4.2_11, user.timezone=, sun.arch.data.model=32, java.endorsed.dirs=C:\Program Files\Java\j2re1.4.2_11\lib\endorsed, sun.cpu.isalist=pentium i486 i386, file.encoding.pkg=sun.io, file.separator=\, java.specification.name=Java Platform API Specification, hibernate.cglib.use_reflection_optimizer=true, java.class.version=48.0, user.country=US, connection.url=jdbc:oracle:thin:@xxx:yyy:zzz, java.home=C:\Program Files\Java\j2re1.4.2_11, java.vm.info=mixed mode, os.version=5.1, path.separator=;, connection.password=xxx, java.vm.version=1.4.2_11-b06, java.util.prefs.PreferencesFactory=java.util.prefs.WindowsPreferencesFactory, hibernate.connection.password=xxx, user.variant=, java.awt.printerjob=sun.awt.windows.WPrinterJob, sun.io.unicode.encoding=UnicodeLittle, awt.toolkit=sun.awt.windows.WToolkit, hibernate.connection.username=asadb, user.home=C:\Documents and Settings\bar, java.specification.vendor=Sun Microsystems Inc., java.library.path=C:\Program Files\Java\j2re1.4.2_11\bin;.;C:\WINDOWS\system32;C:\WINDOWS;C:\oracle\ora81\bin;C:\Program Files\Oracle\jre\1.1.7\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\j2sdk1.4.2_11\bin, java.vendor.url=http://java.sun.com/, hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver, connection.username=asadb, java.vm.vendor=Sun Microsystems Inc., hibernate.dialect=org.hibernate.dialect.Oracle9Dialect, hibernate.jdbc.use_streams_for_binary=true, java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, java.class.path=C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\target\classes;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\activation\jars\activation-1.0.2.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\asm\jars\asm-1.5.3.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\hibernate\jars\antlr-2.7.6rc1.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\asm\jars\asm-attrs-1.5.3.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\c3p0\jars\c3p0-0.9.0.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\cglib\jars\cglib-2.1.3.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\css\jars\clsidl-20040115.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\commons-collections\jars\commons-collections-2.1.1.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\commons-logging\jars\commons-logging-1.0.4.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\commons-io\jars\commons-io-1.1.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\commons-net\jars\commons-net-1.4.0.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\commons-pool\jars\commons-pool-1.1.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\csl-security\jars\csl-security-2.2.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\csl-util\jars\csl-util-20050513.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\dom4j\jars\dom4j-1.6.1.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\ehcache\jars\ehcache-1.1.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\glue\jars\glue-all-5.0.2.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\hibernate\jars\hibernate-3.1.3.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\jdbc-stdext\jars\jdbc-stdext-2.0.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\jdic\jars\jdic-0.9.1.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\jdic\jars\jdic-windows-0.9.1.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\jnlp\jars\jnlp-1.2.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\jta\jars\jta-1.0.1b.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\log4j\jars\log4j-1.2.12.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\oracle\jars\ojdbc14.jar;C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo\lib\velocity\jars\velocity-1.4.jar, c3p0.timeout=1800, java.vm.specification.name=Java Virtual Machine Specification, java.vm.specification.version=1.0, sun.cpu.endian=little, sun.os.patch.level=Service Pack 2, java.io.tmpdir=C:\DOCUME~1\bar\LOCALS~1\Temp\, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, hibernate.default_schema=XXX, os.arch=x86, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, java.ext.dirs=C:\Program Files\Java\j2re1.4.2_11\lib\ext, user.dir=C:\Documents and Settings\bar\My Documents\source\XXX\Foo_0\Foo, line.separator=
    , java.vm.name=Java HotSpot(TM) Client VM, file.encoding=Cp1252, java.specification.version=1.4, c3p0.max_statements=50, hibernate.c3p0.max_statements=50, hibernate.show_sql=true}
    3405 DEBUG [main] net.sf.ehcache.CacheManager - Creating new CacheManager with default config
    3415 DEBUG [main] net.sf.ehcache.CacheManager - Configuring ehcache from classpath.
    3435 WARN [main] net.sf.ehcache.config.Configurator - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/C:/Documents%20and%20Settings/bar/My%20Documents/source/XXX/Foo_0/Foo/lib/ehcache/jars/ehcache-1.1.jar!/ehcache-failsafe.xml
    3485 DEBUG [main] net.sf.ehcache.config.Configuration$DiskStore - Disk Store Path: C:\DOCUME~1\bar\LOCALS~1\Temp\
    3616 DEBUG [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2] com.mchange.v2.resourcepool.BasicResourcePool - trace com.mchange.v2.resourcepool.BasicResourcePool@10c0f66 [managed: 4, unused: 4, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@1fcf790)
    4136 DEBUG [main] org.hibernate.persister.entity.AbstractEntityPersister - Static SQL for entity: com.xxx.yyy.Document
    4136 DEBUG [main] org.hibernate.persister.entity.AbstractEntityPersister - Version select: select DB_FILE_ID from XXX.DB_FILE where DB_FILE_ID =?
    4136 DEBUG [main] org.hibernate.persister.entity.AbstractEntityPersister - Snapshot select: select document_.DB_FILE_ID, document_.COMPRESSED_DATA as COMPRESSED2_1_ from XXX.DB_FILE_DATA document_ inner join XXX.DB_FILE document_1_ on document_.DB_FILE_ID=document_1_.DB_FILE_ID where document_.DB_FILE_ID=?
    4136 DEBUG [main] org.hibernate.persister.entity.AbstractEntityPersister - Insert 0: insert into XXX.DB_FILE (NAME, FILE_TYPE, CREATED_DATE, DB_FILE_ID) values (?, ?, ?, ?)
    4136 DEBUG [main] org.hibernate.persister.entity.AbstractEntityPersister - Update 0: null
    4136 DEBUG [main] org.hibernate.persister.entity.AbstractEntityPersister - Delete 0: delete from XXX.DB_FILE where DB_FILE_ID=?
    4136 DEBUG [main] org.hibernate.persister.entity.AbstractEntityPersister - Insert 1: insert into XXX.DB_FILE_DATA (COMPRESSED_DATA, DB_FILE_ID) values (?, ?)
    4136 DEBUG [main] org.hibernate.persister.entity.AbstractEntityPersister - Update 1: update XXX.DB_FILE_DATA set COMPRESSED_DATA=? where DB_FILE_ID=?
    4136 DEBUG [main] org.hibernate.persister.entity.AbstractEntityPersister - Delete 1: delete from XXX.DB_FILE_DATA where DB_FILE_ID=?
    4166 DEBUG [main] org.hibernate.persister.entity.AbstractEntityPersister - Static SQL for entity: com.xxx.yyy.DocumentDescription
    4166 DEBUG [main] org.hibernate.persister.entity.AbstractEntityPersister - Version select: select DB_FILE_ID from XXX.DB_FILE where DB_FILE_ID =?
    4166 DEBUG [main] org.hibernate.persister.entity.AbstractEntityPersister - Snapshot select: select documentde_.DB_FILE_ID from XXX.DB_FILE documentde_ where documentde_.DB_FILE_ID=?
    4166 DEBUG [main] org.hibernate.persister.entity.AbstractEntityPersister - Insert 0: insert into XXX.DB_FILE (NAME, FILE_TYPE, CREATED_DATE, DB_FILE_ID) values (?, ?, ?, ?)
    4166 DEBUG [main] org.hibernate.persister.entity.AbstractEntityPersister - Update 0: null
    4166 DEBUG [main] org.hibernate.persister.entity.AbstractEntityPersister - Delete 0: delete from XXX.DB_FILE where DB_FILE_ID=?
    4216 DEBUG [main] org.hibernate.loader.entity.EntityLoader - Static select for entity com.xxx.yyy.Document: select document0_.DB_FILE_ID as DB1_0_0_, document0_1_.NAME as NAME0_0_, document0_1_.FILE_TYPE as FILE3_0_0_, document0_1_.CREATED_DATE as CREATED4_0_0_, document0_.COMPRESSED_DATA as COMPRESSED2_1_0_ from XXX.DB_FILE_DATA document0_ inner join XXX.DB_FILE document0_1_ on document0_.DB_FILE_ID=document0_1_.DB_FILE_ID where document0_.DB_FILE_ID=?
    4216 DEBUG [main] org.hibernate.loader.entity.EntityLoader - Static select for entity com.xxx.yyy.Document: select document0_.DB_FILE_ID as DB1_0_0_, document0_1_.NAME as NAME0_0_, document0_1_.FILE_TYPE as FILE3_0_0_, document0_1_.CREATED_DATE as CREATED4_0_0_, document0_.COMPRESSED_DATA as COMPRESSED2_1_0_ from XXX.DB_FILE_DATA document0_ inner join XXX.DB_FILE document0_1_ on document0_.DB_FILE_ID=document0_1_.DB_FILE_ID where document0_.DB_FILE_ID=?
    4216 DEBUG [main] org.hibernate.loader.entity.EntityLoader - Static select for entity com.xxx.yyy.Document: select document0_.DB_FILE_ID as DB1_0_0_, document0_1_.NAME as NAME0_0_, document0_1_.FILE_TYPE as FILE3_0_0_, document0_1_.CREATED_DATE as CREATED4_0_0_, document0_.COMPRESSED_DATA as COMPRESSED2_1_0_ from XXX.DB_FILE_DATA document0_ inner join XXX.DB_FILE document0_1_ on document0_.DB_FILE_ID=document0_1_.DB_FILE_ID where document0_.DB_FILE_ID=? for update
    4216 DEBUG [main] org.hibernate.loader.entity.EntityLoader - Static select for entity com.xxx.yyy.Document: select document0_.DB_FILE_ID as DB1_0_0_, document0_1_.NAME as NAME0_0_, document0_1_.FILE_TYPE as FILE3_0_0_, document0_1_.CREATED_DATE as CREATED4_0_0_, document0_.COMPRESSED_DATA as COMPRESSED2_1_0_ from XXX.DB_FILE_DATA document0_ inner join XXX.DB_FILE document0_1_ on document0_.DB_FILE_ID=document0_1_.DB_FILE_ID where document0_.DB_FILE_ID=? for update nowait
    4247 DEBUG [main] org.hibernate.loader.entity.EntityLoader - Static select for action ACTION_MERGE on entity com.xxx.yyy.Document: select document0_.DB_FILE_ID as DB1_0_0_, document0_1_.NAME as NAME0_0_, document0_1_.FILE_TYPE as FILE3_0_0_, document0_1_.CREATED_DATE as CREATED4_0_0_, document0_.COMPRESSED_DATA as COMPRESSED2_1_0_ from XXX.DB_FILE_DATA document0_ inner join XXX.DB_FILE document0_1_ on document0_.DB_FILE_ID=document0_1_.DB_FILE_ID where document0_.DB_FILE_ID=?
    4247 DEBUG [main] org.hibernate.loader.entity.EntityLoader - Static select for action ACTION_REFRESH on entity com.xxx.yyy.Document: select document0_.DB_FILE_ID as DB1_0_0_, document0_1_.NAME as NAME0_0_, document0_1_.FILE_TYPE as FILE3_0_0_, document0_1_.CREATED_DATE as CREATED4_0_0_, document0_.COMPRESSED_DATA as COMPRESSED2_1_0_ from XXX.DB_FILE_DATA document0_ inner join XXX.DB_FILE document0_1_ on document0_.DB_FILE_ID=document0_1_.DB_FILE_ID where document0_.DB_FILE_ID=?
    4247 DEBUG [main] org.hibernate.loader.entity.EntityLoader - Static select for entity com.xxx.yyy.DocumentDescription: select documentde0_.DB_FILE_ID as DB1_0_0_, documentde0_.NAME as NAME0_0_, documentde0_.FILE_TYPE as FILE3_0_0_, documentde0_.CREATED_DATE as CREATED4_0_0_, documentde0_1_.COMPRESSED_DATA as COMPRESSED2_1_0_, case when documentde0_1_.DB_FILE_ID is not null then 1 when documentde0_.DB_FILE_ID is not null then 0 end as clazz_0_ from XXX.DB_FILE documentde0_ left outer join XXX.DB_FILE_DATA documentde0_1_ on documentde0_.DB_FILE_ID=documentde0_1_.DB_FILE_ID where documentde0_.DB_FILE_ID=?
    4257 DEBUG [main] org.hibernate.loader.entity.EntityLoader - Static select for entity com.xxx.yyy.DocumentDescription: select documentde0_.DB_FILE_ID as DB1_0_0_, documentde0_.NAME as NAME0_0_, documentde0_.FILE_TYPE as FILE3_0_0_, documentde0_.CREATED_DATE as CREATED4_0_0_, documentde0_1_.COMPRESSED_DATA as COMPRESSED2_1_0_, case when documentde0_1_.DB_FILE_ID is not null then 1 when documentde0_.DB_FILE_ID is not null then 0 end as clazz_0_ from XXX.DB_FILE documentde0_ left outer join XXX.DB_FILE_DATA documentde0_1_ on documentde0_.DB_FILE_ID=documentde0_1_.DB_FILE_ID where documentde0_.DB_FILE_ID=?
    4257 DEBUG [main] org.hibernate.loader.entity.EntityLoader - Static select for entity com.xxx.yyy.DocumentDescription: select documentde0_.DB_FILE_ID as DB1_0_0_, documentde0_.NAME as NAME0_0_, documentde0_.FILE_TYPE as FILE3_0_0_, documentde0_.CREATED_DATE as CREATED4_0_0_, documentde0_1_.COMPRESSED_DATA as COMPRESSED2_1_0_, case when documentde0_1_.DB_FILE_ID is not null then 1 when documentde0_.DB_FILE_ID is not null then 0 end as clazz_0_ from XXX.DB_FILE documentde0_ left outer join XXX.DB_FILE_DATA documentde0_1_ on documentde0_.DB_FILE_ID=documentde0_1_.DB_FILE_ID where documentde0_.DB_FILE_ID=? for update
    4257 DEBUG [main] org.hibernate.loader.entity.EntityLoader - Static select for entity com.xxx.yyy.DocumentDescription: select documentde0_.DB_FILE_ID as DB1_0_0_, documentde0_.NAME as NAME0_0_, documentde0_.FILE_TYPE as FILE3_0_0_, documentde0_.CREATED_DATE as CREATED4_0_0_, documentde0_1_.COMPRESSED_DATA as COMPRESSED2_1_0_, case when documentde0_1_.DB_FILE_ID is not null then 1 when documentde0_.DB_FILE_ID is not null then 0 end as clazz_0_ from XXX.DB_FILE documentde0_ left outer join XXX.DB_FILE_DATA documentde0_1_ on documentde0_.DB_FILE_ID=documentde0_1_.DB_FILE_ID where documentde0_.DB_FILE_ID=? for update nowait
    4257 DEBUG [main] org.hibernate.loader.entity.EntityLoader - Static select for action ACTION_MERGE on entity com.xxx.yyy.DocumentDescription: select documentde0_.DB_FILE_ID as DB1_0_0_, documentde0_.NAME as NAME0_0_, documentde0_.FILE_TYPE as FILE3_0_0_, documentde0_.CREATED_DATE as CREATED4_0_0_, documentde0_1_.COMPRESSED_DATA as COMPRESSED2_1_0_, case when documentde0_1_.DB_FILE_ID is not null then 1 when documentde0_.DB_FILE_ID is not null then 0 end as clazz_0_ from XXX.DB_FILE documentde0_ left outer join XXX.DB_FILE_DATA documentde0_1_ on documentde0_.DB_FILE_ID=documentde0_1_.DB_FILE_ID where documentde0_.DB_FILE_ID=?
    4267 DEBUG [main] org.hibernate.loader.entity.EntityLoader - Static select for action ACTION_REFRESH on entity com.xxx.yyy.DocumentDescription: select documentde0_.DB_FILE_ID as DB1_0_0_, documentde0_.NAME as NAME0_0_, documentde0_.FILE_TYPE as FILE3_0_0_, documentde0_.CREATED_DATE as CREATED4_0_0_, documentde0_1_.COMPRESSED_DATA as COMPRESSED2_1_0_, case when documentde0_1_.DB_FILE_ID is not null then 1 when documentde0_.DB_FILE_ID is not null then 0 end as clazz_0_ from XXX.DB_FILE documentde0_ left outer join XXX.DB_FILE_DATA documentde0_1_ on documentde0_.DB_FILE_ID=documentde0_1_.DB_FILE_ID where documentde0_.DB_FILE_ID=?
    4267 DEBUG [main] org.hibernate.impl.SessionFactoryObjectFactory - initializing class SessionFactoryObjectFactory
    4277 DEBUG [main] org.hibernate.impl.SessionFactoryObjectFactory - registered: 8a0fc46d0aae6081010aae60859e0000 (unnamed)
    4277 INFO [main] org.hibernate.impl.SessionFactoryObjectFactory - Not binding factory to JNDI, no JNDI name configured
    4277 DEBUG [main] org.hibernate.impl.SessionFactoryImpl - instantiated session factory
    4287 DEBUG [main] org.hibernate.impl.SessionFactoryImpl - Checking 0 named HQL queries
    4287 DEBUG [main] org.hibernate.impl.SessionFactoryImpl - Checking 0 named SQL queries
    4297 DEBUG [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2] com.mchange.v2.resourcepool.BasicResourcePool - trace com.mchange.v2.resourcepool.BasicResourcePool@10c0f66 [managed: 5, unused: 5, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@1fcf790)
    4387 DEBUG [main] org.hibernate.impl.SessionImpl - opened session at timestamp: 4691504587046912
    4497 DEBUG [main] org.hibernate.context.ThreadLocalSessionContext - allowing method [beginTransaction] in non-transacted context
    4497 DEBUG [main] org.hibernate.context.ThreadLocalSessionContext - allowing proxied method [beginTransaction] to proceed to real session
    4497 DEBUG [main] org.hibernate.transaction.JDBCTransaction - begin
    4497 DEBUG [main] org.hibernate.jdbc.ConnectionManager - opening JDBC connection
    4497 DEBUG [main] com.mchange.v2.resourcepool.BasicResourcePool - resource age is okay: com.mchange.v2.c3p0.impl.NewPooledConnection@1fcf790 ---> age: 1312 max: 1800000 [com.mchange.v2.resourcepool.BasicResourcePool@10c0f66]
    4497 DEBUG [main] com.mchange.v2.resourcepool.BasicResourcePool - trace com.mchange.v2.resourcepool.BasicResourcePool@10c0f66 [managed: 5, unused: 4, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@1fcf790)
    4507 DEBUG [main] org.hibernate.transaction.JDBCTransaction - current autocommit status: false
    4507 DEBUG [main] org.hibernate.jdbc.JDBCContext - after transaction begin
    4507 DEBUG [main] com.xxx.yyy.hibernate.DocumentDescriptionHome - getting DocumentDescription instance with id: 2668
    4507 DEBUG [main] org.hibernate.context.ThreadLocalSessionContext - allowing proxied method [get] to proceed to real session
    4507 DEBUG [main] org.hibernate.event.def.DefaultLoadEventListener - loading entity: [com.xxx.yyy.DocumentDescription#2668]
    4507 DEBUG [main] org.hibernate.event.def.DefaultLoadEventListener - attempting to resolve: [com.xxx.yyy.DocumentDescription#2668]
    4507 DEBUG [main] org.hibernate.event.def.DefaultLoadEventListener - object not resolved in any cache: [com.xxx.yyy.DocumentDescription#2668]
    4507 DEBUG [main] org.hibernate.persister.entity.AbstractEntityPersister - Fetching entity: [com.xxx.yyy.DocumentDescription#2668]
    4507 DEBUG [main] org.hibernate.loader.Loader - loading entity: [com.xxx.yyy.DocumentDescription#2668]
    4507 DEBUG [main] org.hibernate.jdbc.AbstractBatcher - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
    4507 DEBUG [main] org.hibernate.SQL - select documentde0_.DB_FILE_ID as DB1_0_0_, documentde0_.NAME as NAME0_0_, documentde0_.FILE_TYPE as FILE3_0_0_, documentde0_.CREATED_DATE as CREATED4_0_0_, documentde0_1_.COMPRESSED_DATA as COMPRESSED2_1_0_, case when documentde0_1_.DB_FILE_ID is not null then 1 when documentde0_.DB_FILE_ID is not null then 0 end as clazz_0_ from XXX.DB_FILE documentde0_ left outer join XXX.DB_FILE_DATA documentde0_1_ on documentde0_.DB_FILE_ID=documentde0_1_.DB_FILE_ID where documentde0_.DB_FILE_ID=?
    Hibernate: select documentde0_.DB_FILE_ID as DB1_0_0_, documentde0_.NAME as NAME0_0_, documentde0_.FILE_TYPE as FILE3_0_0_, documentde0_.CREATED_DATE as CREATED4_0_0_, documentde0_1_.COMPRESSED_DATA as COMPRESSED2_1_0_, case when documentde0_1_.DB_FILE_ID is not null then 1 when documentde0_.DB_FILE_ID is not null then 0 end as clazz_0_ from XXX.DB_FILE documentde0_ left outer join XXX.DB_FILE_DATA documentde0_1_ on documentde0_.DB_FILE_ID=documentde0_1_.DB_FILE_ID where documentde0_.DB_FILE_ID=?
    4507 DEBUG [main] org.hibernate.jdbc.AbstractBatcher - preparing statement
    4527 DEBUG [main] com.mchange.v2.c3p0.stmt.GooGooStatementCache - cxnStmtMgr.statementSet( oracle.jdbc.driver.OracleConnection@cec78d ).size(): 1
    4527 DEBUG [main] com.mchange.v2.c3p0.stmt.GooGooStatementCache - checkoutStatement: com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 1; checked out: 1; num connections: 1; num keys: 1
    4537 DEBUG [main] org.hibernate.type.LongType - binding '2668' to parameter: 1
    4617 DEBUG [main] org.hibernate.jdbc.AbstractBatcher - about to open ResultSet (open ResultSets: 0, globally: 0)
    4617 DEBUG [main] org.hibernate.loader.Loader - processing result set
    4617 DEBUG [main] org.hibernate.loader.Loader - result set row: 0
    4617 DEBUG [main] org.hibernate.loader.Loader - result row: EntityKey[com.xxx.yyy.DocumentDescription#2668]
    4617 DEBUG [main] org.hibernate.type.IntegerType - returning '1' as column: clazz_0_
    4617 DEBUG [main] org.hibernate.loader.Loader - Initializing object from ResultSet: [com.xxx.yyy.Document#2668]
    4627 DEBUG [main] org.hibernate.persister.entity.AbstractEntityPersister - Hydrating entity: [com.xxx.yyy.Document#2668]
    4627 DEBUG [main] org.hibernate.type.StringType - returning 'XXX.xxx' as column: NAME0_0_
    4627 DEBUG [main] org.hibernate.type.StringType - returning 'xxx/xxx' as column: FILE3_0_0_
    4637 DEBUG [main] com.xxx.hibernate.type.ForcedJavaUtilDateType - returning '2000-01-01 00:00:00' as column: CREATED4_0_0_
    4667 DEBUG [main] org.hibernate.type.BinaryType - returning 'xxx' as column: COMPRESSED2_1_0_
    4677 DEBUG [main] org.hibernate.loader.Loader - done processing result set (1 rows)
    4677 DEBUG [main] org.hibernate.jdbc.AbstractBatcher - about to close ResultSet (open ResultSets: 1, globally: 1)
    4677 DEBUG [main] org.hibernate.jdbc.AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
    4677 DEBUG [main] org.hibernate.jdbc.AbstractBatcher - closing statement
    4677 DEBUG [main] com.mchange.v2.c3p0.stmt.GooGooStatementCache - checkinStatement(): com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 1; checked out: 0; num connections: 1; num keys: 1
    4677 DEBUG [main] org.hibernate.loader.Loader - total objects hydrated: 1
    4677 DEBUG [main] org.hibernate.engine.TwoPhaseLoad - resolving associations for [com.xxx.yyy.Document#2668]
    4687 DEBUG [main] org.hibernate.engine.TwoPhaseLoad - done materializing entity [com.xxx.yyy.Document#2668]
    4687 DEBUG [main] org.hibernate.engine.StatefulPersistenceContext - initializing non-lazy collections
    4687 DEBUG [main] org.hibernate.loader.Loader - done entity load
    4687 DEBUG [main] com.xxx.yyy.hibernate.DocumentDescriptionHome - get successful, instance found
    XXX.xxx
    YYY
    4697 DEBUG [main] org.hibernate.context.ThreadLocalSessionContext - allowing proxied method [getTransaction] to proceed to real session
    4697 DEBUG [main] org.hibernate.transaction.JDBCTransaction - rollback
    4697 DEBUG [main] org.hibernate.transaction.JDBCTransaction - rolled back JDBC Connection
    4697 DEBUG [main] org.hibernate.jdbc.JDBCContext - after transaction completion
    4697 DEBUG [main] org.hibernate.jdbc.ConnectionManager - aggressively releasing JDBC connection
    4697 DEBUG [main] org.hibernate.jdbc.ConnectionManager - releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
    4697 DEBUG [main] com.mchange.v2.c3p0.stmt.GooGooStatementCache - checkinAll(): com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 1; checked out: 0; num connections: 1; num keys: 1
    4707 DEBUG [main] com.mchange.v2.resourcepool.BasicResourcePool - trace com.mchange.v2.resourcepool.BasicResourcePool@10c0f66 [managed: 5, unused: 4, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@1fcf790)
    4707 DEBUG [main] org.hibernate.impl.SessionImpl - after transaction completion
    4707 DEBUG [main] org.hibernate.impl.SessionImpl - automatically closing session
    4707 DEBUG [main] org.hibernate.impl.SessionImpl - closing session
    4707 DEBUG [main] org.hibernate.jdbc.ConnectionManager - connection already null in cleanup : no action
    4707 DEBUG [main] org.hibernate.impl.SessionImpl - opened session at timestamp: 4691504588480512
    4707 DEBUG [main] org.hibernate.context.ThreadLocalSessionContext - allowing proxied method [close] to proceed to real session
    4707 DEBUG [main] org.hibernate.impl.SessionImpl - closing session
    4707 DEBUG [main] org.hibernate.jdbc.ConnectionManager - connection already null in cleanup : no action


Last edited by wetrull on Wed Apr 19, 2006 5:29 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 19, 2006 7:45 am 
Regular
Regular

Joined: Wed Aug 25, 2004 6:23 am
Posts: 91
Yes - just enable explicit polymorphism for your classes:

http://www.hibernate.org/hib_docs/v3/re ... tion-class


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 19, 2006 5:27 pm 
Newbie

Joined: Tue Apr 18, 2006 2:50 pm
Posts: 10
Thanks for the reply r1ch. It does not appear that setting polymorphism to explicit in the base class mapping works. I've found other postings asking the same sort of question with regards to joined-subclass (table-per-subclass strategy) without any resolution.

I've tried both

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.xxx.yyy">

  <!-- Data store document description -->
  <class name="DocumentDescription" table="DB_FILE" polymorphism="explicit">
 
    <!--Primary key-->
    <id name="primaryKey" column="DB_FILE_ID" type="long">
      <generator class="sequence">
         <param name="sequence">DB_FILE_SEQ</param>
      </generator>
    </id>

    <natural-id>
      <!-- File name -->
      <property name="name" column="NAME" type="string" length="256"
                not-null="true" update="false" />

      <!-- File content type -->
      <property name="type" column="FILE_TYPE" type="string" length="50"
                not-null="true" update="false" />
               
      <!-- File date -->
      <property name="created" column="CREATED_DATE"
                type="com.xxx.hibernate.type.ForcedJavaUtilDateType"
                not-null="true" update="false" />
    </natural-id>

  </class>

</hibernate-mapping>

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.xxx.yyy">

  <!-- Data store document description plus compressed content -->
  <joined-subclass name="Document" extends="DocumentDescription"
                   table="DB_FILE_DATA">
    <!-- Foreign key column -->
    <key column="DB_FILE_ID" />
     
    <!-- Document compressed content -->
    <property name="compressedContent" column="COMPRESSED_DATA"
              type="binary" not-null="true" />
  </joined-subclass>

</hibernate-mapping>


-- and --

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.xxx.yyy">

  <!-- Data store document description -->
  <class name="DocumentDescription" table="DB_FILE" polymorphism="explicit">
 
    <!--Primary key-->
    <id name="primaryKey" column="DB_FILE_ID" type="long">
      <generator class="sequence">
         <param name="sequence">DB_FILE_SEQ</param>
      </generator>
    </id>

    <natural-id>
      <!-- File name -->
      <property name="name" column="NAME" type="string" length="256"
                not-null="true" update="false" />

      <!-- File content type -->
      <property name="type" column="FILE_TYPE" type="string" length="50"
                not-null="true" update="false" />
               
      <!-- File date -->
      <property name="created" column="CREATED_DATE"
                type="com.xxx.hibernate.type.ForcedJavaUtilDateType"
                not-null="true" update="false" />
    </natural-id>

    <!-- Data store document description plus compressed content -->
    <joined-subclass name="Document" table="DB_FILE_DATA">
      <!-- Foreign key column -->
      <key column="DB_FILE_ID" />
     
      <!-- Document compressed content -->
      <property name="compressedContent" column="COMPRESSED_DATA"
                type="binary" not-null="true" />
    </joined-subclass>

  </class>

</hibernate-mapping>


I've also looked at the Lightweight pattern (http://www.hibernate.org/41.html), but that does not use the joined-subclass specifier.

Can anybody confirm that polymorphism="explicit" works with joined-subclass?

Thanks.

-Eric Trull


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 19, 2006 5:41 pm 
Regular
Regular

Joined: Wed Aug 25, 2004 6:23 am
Posts: 91
Hi Eric - I'm fairly sure that our app used to count on this functionality (we use joined-subclass too).

In what way isn't it working - are you getting an error or anything?

Note that Hibernate's first level cache means that you can't have two instances of the same object in the same session, so you if you load a Document with a given id first then loading a DocumentDescription with the same id will give you the original Document back and vice-versa. In a clean session you should be able to load the object as either.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 19, 2006 6:05 pm 
Newbie

Joined: Tue Apr 18, 2006 2:50 pm
Posts: 10
R1ch,

No, I'm not getting any exceptions or errors. What I mean by it not working is that when I execute DocumentDescriptionHome.main (see original post) I get back an instance of Document (with the fetched BLOB data) instead of an instance of DocumentDescription. I'm confirming this in my debugger as well as the fact that the BLOB contents are printed out. I know that a Document has not already been loaded because the only code being executed is in main.

If you have the time and ability I'd appreciate it if you could look at your app's mapping files and compare them to the ones I've posted.

BTW, here are the un-resolved posts I was refering to: http://forum.hibernate.org/viewtopic.php?t=926622), and http://forum.hibernate.org/viewtopic.php?t=927708.

Thanks!

-Eric Trull


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 19, 2006 7:37 pm 
Beginner
Beginner

Joined: Mon Nov 29, 2004 2:26 pm
Posts: 28
The way it works is that you don't map Document as a subclass, just a separate class that happens to point to the same table. So instead of using extends="DocumentDescription", just map it using polymorphism="explicit" and the same table:

Code:
  <!-- Data store document description -->
  <class name="DocumentDescription" table="DB_FILE">

    <!--Primary key-->
    <id name="primaryKey" column="DB_FILE_ID" type="long">
      <generator class="sequence">
         <param name="sequence">DB_FILE_SEQ</param>
      </generator>
    </id>
   
    <natural-id>
      <!-- File name -->
      <property name="name" column="NAME" type="string" length="256"
                not-null="true" update="false" />

      <!-- File content type -->
      <property name="type" column="FILE_TYPE" type="string" length="50"
                not-null="true" update="false" />
               
      <!-- File date -->
      <property name="created" column="CREATED_DATE"
                type="com.xxx.hibernate.type.ForcedJavaUtilDateType"
                not-null="true" update="false" />
    </natural-id>

    </class>

and

Code:
<!-- Data store document description plus compressed content -->
    <class name="Document" table="DB_FILE" polymorphism="explicit">
      <!-- Foreign key column -->
      <key column="DB_FILE_ID" />


    <!--Primary key-->
    <id name="primaryKey" column="DB_FILE_ID" type="long">
      <generator class="sequence">
         <param name="sequence">DB_FILE_SEQ</param>
      </generator>
    </id>
   
    <natural-id>
      <!-- File name -->
      <property name="name" column="NAME" type="string" length="256"
                not-null="true" update="false" />

      <!-- File content type -->
      <property name="type" column="FILE_TYPE" type="string" length="50"
                not-null="true" update="false" />
               
      <!-- File date -->
      <property name="created" column="CREATED_DATE"
                type="com.xxx.hibernate.type.ForcedJavaUtilDateType"
                not-null="true" update="false" />
    </natural-id>

      <!-- Document compressed content -->
      <property name="compressedContent" column="COMPRESSED_DATA"
                type="binary" not-null="true" />
    </joined-subclass>

  </class>


By the way, Hibernate 3 supports lazy loading of individual properties, which would be more transparent to use.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 19, 2006 8:27 pm 
Newbie

Joined: Tue Apr 18, 2006 2:50 pm
Posts: 10
Thanks for the reply Imiranda. What you have shown is what is basically described in the Lightweight pattern (http://www.hibernate.org/41.html). If push comes to shove, I will switch to that approach.

However, I've avoided that approch because, IMO, it begins to smell of duplicate maintence in the mapping file. My object extends the super class, so "in my little world" the subclass mapping file should "extend" the super class mapping file (by using joined-subclass). What would really make me happy (I think) is to have joined-subclass have the polymorphic attribute.

Supposing that polymorphic was available for joined-sublcass, what would be the significant disadvantage(s) of this approach over using the Lightweight pattern (two class mapping files)?

Thanks.

-Eric Trull


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 20, 2006 6:15 am 
Beginner
Beginner

Joined: Mon Nov 29, 2004 2:26 pm
Posts: 28
wetrull wrote:
However, I've avoided that approch because, IMO, it begins to smell of duplicate maintence in the mapping file. My object extends the super class, so "in my little world" the subclass mapping file should "extend" the super class mapping file (by using joined-subclass). What would really make me happy (I think) is to have joined-subclass have the polymorphic attribute.


I agree, I don't like it either. If I were you I would:
- factor the BLOB out into a separate entity, and use a lazily-loaded association, or
- look into lazy loading of properties (Hibernate 3)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 20, 2006 11:42 am 
Newbie

Joined: Tue Apr 18, 2006 2:50 pm
Posts: 10
lmiranda wrote:
If I were you I would:
- factor the BLOB out into a separate entity, and use a lazily-loaded association, or
- look into lazy loading of properties (Hibernate 3)


More great solutions Imiranda, thanks. Your first solution is similar to what I'm trying to do by using joined-subclass.

In both solutions, however, these objects are vended by a web service (SOAP over HTTP) using a session-per-request pattern. Thus, by the time the objects are serialized into XML for the response all the lazy loaded associations and properties get loaded.

I think by using the joined-subclass I'm trying to allow programatic loading of a lazily initialized bit of data. When the code asks for DocumentDescription, the BLOB shouldn't be loaded. When the code asks for a Document I explicitly want the BLOB loaded.

Anybody see a reason that polymorphic="explicit" should not be allowed on joined-subclass?

Thanks.

-Eric Trull


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 20, 2006 12:54 pm 
Beginner
Beginner

Joined: Mon Nov 29, 2004 2:26 pm
Posts: 28
wetrull wrote:
In both solutions, however, these objects are vended by a web service (SOAP over HTTP) using a session-per-request pattern. Thus, by the time the objects are serialized into XML for the response all the lazy loaded associations and properties get loaded.


That's not strictly true--serialization alone of a Hibernate proxy does not initialise the proxy. Hence the dreaded LazyInitializationException.

Only if you access any of the entitie's fields will it be initialised. See http://www.hibernate.org/hib_docs/v3/re ... ng-proxies


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 20, 2006 1:40 pm 
Newbie

Joined: Tue Apr 18, 2006 2:50 pm
Posts: 10
lmiranda wrote:
That's not strictly true--serialization alone of a Hibernate proxy does not initialise the proxy. Hence the dreaded LazyInitializationException.

Only if you access any of the entitie's fields will it be initialised. See http://www.hibernate.org/hib_docs/v3/re ... ng-proxies


Yes, you are correct, *Java* serialization will not initialize the proxy. However, the SOAP framework's serialization (over used term here) of the proxy into XML will and does initialize the proxy.

Remember that in a session-per-request pattern a session is opened for each request, the Hibernate unit-of-work is performed, a response created, and then the session is closed right before the response is sent. In this case, the SOAP framework "serializes" the Hibernate object(s) into an XML document which is placed in the SOAP message. In doing so, the SOAP framework calls all the get methods on the Hibernate proxy object resulting in a full initialization of the proxy. Specifying lazy in the mapping file does not help because the SOAP framework ends up loading everything.

To add in another tanget, there is certainly room for debate about the web service granularity and whether the POJOs should be passed back or some other object. This is an ongoing debate but for the moment we have found a happy place.

Thanks.

-Eric Trull


Top
 Profile  
 
 Post subject: org.hibernate.MappingException: UniqueKey _UniqueKey alread
PostPosted: Thu Apr 27, 2006 1:07 pm 
Newbie

Joined: Tue Apr 18, 2006 2:50 pm
Posts: 10
Based on suggestions here, I switched to the Lightweight pattern. My mapping files now look like:

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.xxx.yyy">

  <!-- Data store document description -->
  <class name="DocumentDescription" table="DB_FILE" polymorphism="explicit"
         proxy="DocumentDescription">
 
    <!--Primary key-->
    <id name="primaryKey" column="DB_FILE_ID" type="long">
      <generator class="sequence">
         <param name="sequence">DB_FILE_SEQ</param>
      </generator>
    </id>

    <natural-id>
      <!-- File name -->
      <property name="name" column="NAME" type="string" length="256"
                not-null="true" update="false" />

      <!-- File content type -->
      <property name="type" column="FILE_TYPE" type="string" length="50"
                not-null="true" update="false" />
               
      <!-- File date -->
      <property name="created" column="CREATED_DATE"
                type="com.xxx.hibernate.type.ForcedJavaUtilDateType"
                not-null="true" update="false" />
    </natural-id>

  </class>

</hibernate-mapping>

and
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.xxx.yyy">

  <!-- Data store document, including content -->
  <class name="Document" table="DB_FILE" polymorphism="explicit"
         proxy="Document">
 
    <!--Primary key-->
    <id name="primaryKey" column="DB_FILE_ID" type="long">
      <generator class="sequence">
         <param name="sequence">DB_FILE_SEQ</param>
      </generator>
    </id>

    <natural-id>
      <!-- File name -->
      <property name="name" column="NAME" type="string" length="256"
                not-null="true" update="false" />

      <!-- File content type -->
      <property name="type" column="FILE_TYPE" type="string" length="50"
                not-null="true" update="false" />
               
      <!-- File date -->
      <property name="created" column="CREATED_DATE"
                type="com.xxx.hibernate.type.ForcedJavaUtilDateType"
                not-null="true" update="false" />
    </natural-id>

    <join table="DB_FILE_DATA">
      <!-- Foreign key column -->
      <key column="DB_FILE_ID" />
     
      <!-- Document compressed content -->
      <property name="compressedContent" column="COMPRESSED_DATA" type="binary"
                not-null="true" />
    </join>
   
  </class>

</hibernate-mapping>


However, I now get a org.hibernate.MappingException, claiming that "UniqueKey _UniqueKey already exists!". If I remove the <natural-id> declaration from DocumentDescription (but leave the properties) the exception goes away. This seems like a bug to me. Does anybody disagree?

    17726 ERROR [ThreadPoolWorker: Thread-3] com.xxx.hibernate.HibernateUtility - Building SessionFactory failed.
    org.hibernate.MappingException: Could not read mappings from resource: com/xxx/yyy/Document.hbm.xml
    at org.hibernate.cfg.Configuration.addResource(Configuration.java:485)
    at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1465)
    at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1433)
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1414)
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1390)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1310)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1296)
    at com.xxx.hibernate.HibernateUtility.<clinit>(HibernateUtility.java:78)
    at com.xxx.hibernate.glue.SessionPerRequestInboundInterceptor.getSessionFactory(SessionPerRequestInboundInterceptor.java:48)
    at com.xxx.hibernate.glue.SessionPerRequestInboundInterceptor.intercept(SessionPerRequestInboundInterceptor.java:60)
    at electric.soap.util.SOAPInterceptors.callInterceptors(Unknown Source)
    at electric.soap.handlers.interceptor.SOAPInterceptorHandler.handle(Unknown Source)
    at electric.soap.routing.RoutingHandler.handle(Unknown Source)
    at electric.soap.handlers.logging.SOAPLoggingHandler.handle(Unknown Source)
    at electric.soap.handlers.setup.SetupHandler.handle(Unknown Source)
    at electric.soap.http.handler.HTTPToSOAP.service(Unknown Source)
    at electric.server.http.ServletServer.service(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at electric.servlet.Config.service(Unknown Source)
    at electric.servlet.HTTPContext.service(Unknown Source)
    at electric.servlet.ServletEngine.service(Unknown Source)
    at electric.webserver.WebServer.service(Unknown Source)
    at electric.net.socket.SocketServer.run(Unknown Source)
    at electric.net.socket.SocketRequest.run(Unknown Source)
    at electric.util.thread.ThreadPool.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Caused by: org.hibernate.MappingException: UniqueKey _UniqueKey already exists!
    at org.hibernate.mapping.Table.addUniqueKey(Table.java:473)
    at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2102)
    at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2005)
    at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:368)
    at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:282)
    at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:153)
    at org.hibernate.cfg.Configuration.add(Configuration.java:386)
    at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:427)
    at org.hibernate.cfg.Configuration.addResource(Configuration.java:482)
    ... 25 more


Thanks.

-Eric Trull


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 12 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.