Hibernate version:
2.1.6
Mapping documents:
<hibernate-mapping>
<!-- com.gfs.corp.component.uoc.dto.OrderDTO root -->
<class name="com.gfs.corp.component.uoc.dto.OrderDTO" table="GFS.ORDERS">
<id name="orderId" type="long" column="orderId">
<generator class="sequence">
<param name="sequence">GFS_SEQ</param>
</generator>
</id>
<property name="verificationNumber" column="verificationNumber" type="long"/>
<property name="customerId" column="customerId" type="long"/>
<class name="com.gfs.corp.component.uoc.dto.OrderDTO" table="OrderDTO">
<id name="orderId" type="long" column="orderId">
<generator class="native"/>
</id>
<property name="verificationNumber" column="verificationNumber" type="long"/>
<list name="orderLines" lazy="false" table="GFS.ORDER_LINES">
<key column="orderId"/>
<index column="lineNumber"/>
<one-to-many class="com.gfs.corp.component.uoc.dto.OrderLineDTO"/>
</list>
</class>
<!-- com.gfs.corp.component.uoc.dto.OrderLineDTO root -->
<class name="com.gfs.corp.component.uoc.dto.OrderLineDTO" table="GFS.ORDER_LINES">
<id name="lineId" type="long" column="lineId">
<generator class="sequence">
<param name="sequence">GFS_SEQ</param>
</generator>
</id>
<property name="lineNumber" column="lineNumber" type="long"/>
<property name="orderQuantity" column="orderQuantity" type="double"/>
<property name="itemId" column="itemId" type="long"/>
<many-to-one name="order" column="orderId" class="com.gfs.corp.component.uoc.dto.OrderDTO"/>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using:
Oracle 9i
The generated SQL (show_sql=true):
insert into GFS.ORDERS (verificationNumber, customerId, orderId) values (?, ?, ?)
Debug level Hibernate log excerpt:
[INFO] Environment - Hibernate 2.1.6
[INFO] Environment - hibernate.properties not found
[INFO] Environment - using CGLIB reflection optimizer
[INFO] Environment - JVM does not support Statement.getGeneratedKeys()
[INFO] Environment - JVM does not support LinkedHasMap, LinkedHashSet - ordered maps and sets disabled
[INFO] Environment - using workaround for JVM bug in java.sql.Timestamp
[INFO] Configuration - configuring from resource: /hibernate.cfg.xml
[INFO] Configuration - Configuration resource: /hibernate.cfg.xml
[INFO] Configuration - Mapping resource: uoc.hbm.xml
[INFO] Binder - Mapping class: com.gfs.corp.component.uoc.dto.OrderDTO -> GFS.ORDERS
[INFO] Binder - Mapping class: com.gfs.corp.component.uoc.dto.OrderLineDTO -> GFS.ORDER_LINES
[INFO] Configuration - Configured SessionFactory: HibernateSessionFactory
[INFO] Configuration - processing one-to-many association mappings
[INFO] Binder - Mapping collection: com.gfs.corp.component.uoc.dto.OrderDTO.orderLines -> GFS.ORDER_LINES
[INFO] Configuration - processing one-to-one association property references
[INFO] Configuration - processing foreign key constraints
[INFO] Dialect - Using dialect: net.sf.hibernate.dialect.Oracle9Dialect
[INFO] SettingsFactory - Use outer join fetching: true
[INFO] NamingHelper - JNDI InitialContext properties:{}
[INFO] DatasourceConnectionProvider - Using datasource: DefaultDS
[INFO] TransactionFactoryFactory - Transaction strategy: net.sf.hibernate.transaction.JTATransactionFactory
[INFO] NamingHelper - JNDI InitialContext properties:{}
[INFO] TransactionManagerLookupFactory - instantiating TransactionManagerLookup: net.sf.hibernate.transaction.WeblogicTransactionManagerLookup
[INFO] TransactionManagerLookupFactory - instantiated TransactionManagerLookup
[INFO] NamingHelper - JNDI InitialContext properties:{}
[INFO] TransactionManagerLookupFactory - instantiating TransactionManagerLookup: net.sf.hibernate.transaction.WeblogicTransactionManagerLookup
[INFO] TransactionManagerLookupFactory - instantiated TransactionManagerLookup
[INFO] SettingsFactory - Use scrollable result sets: true
[INFO] SettingsFactory - Use JDBC3 getGeneratedKeys(): false
[INFO] SettingsFactory - Optimize cache for minimal puts: false
[INFO] SettingsFactory - echoing all SQL to stdout
[INFO] SettingsFactory - Query language substitutions: {}
[INFO] SettingsFactory - cache provider: net.sf.hibernate.cache.EhCacheProvider
[INFO] Configuration - instantiating and configuring caches
[INFO] SessionFactoryImpl - building session factory
[INFO] SessionFactoryObjectFactory - Factory name: HibernateSessionFactory
[INFO] NamingHelper - JNDI InitialContext properties:{}
[INFO] SessionFactoryObjectFactory - Bound factory to JNDI name: HibernateSessionFactory
[WARN] SessionFactoryObjectFactory - InitialContext did not implement EventContext
[INFO] NamingHelper - JNDI InitialContext properties:{}
For some reason my parent object (OrderDTO) is being persisted correctly, however my child objects (OrderLineDTO) are not being persisted at all.
Can anyone point to anything in my mapping descriptor that may be causing this very simple case to fail?
Thanks in advance,
Steve...
|