Hibernate version:
2.0.3
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="com.aol.ic.art.data.domain.Request" table="REQUEST">
<id name="id" column="ID">
<generator class="native"/>
</id>
<property name="requestorDn">
<column name="REQUESTORDN" length="255" not-null="true"/>
</property>
<property name="customerDn">
<column name="CUSTOMERDN" length="255" not-null="true"/>
</property>
<property name="fulfillmentBuildingDn">
<column name="FULFILLMENTBUILDINGDN" length="255" not-null="true"/>
</property>
<property name="fulfillmentRoomNumber">
<column name="FULFILLMENTROOMNUMBER" length="20" not-null="true"/>
</property>
<property name="lastApproverDn">
<column name="LASTAPPROVERDN" length="255" not-null="true"/>
</property>
<property name="nextApproverRoleDn">
<column name="NEXTAPPROVERROLEDN" length="255" not-null="true"/>
</property>
<property name="ticketNumber">
<column name="TICKETNUMBER" length="30" not-null="true"/>
</property>
<property name="type">
<column name="TYPE" length="30" not-null="true"/>
</property>
<property name="comments">
<column name="COMMENTS" length="255" not-null="true"/>
</property>
<set name="products" table="REQUEST_PRODUCT_LINK" inverse="true" lazy="true">
<key column="REQUESTID"/>
<many-to-many class="com.aol.ic.art.data.domain.Product"/>
</set>
<set name="states" inverse="true" lazy="true">
<key column="REQUESTID"/>
<one-to-many class="com.aol.ic.art.data.domain.RequestStatus"/>
</set>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
public static void testCreate() throws ARTException{
Set productSet = new HashSet();
productSet.add(new Long(1));
productSet.add(new Long(2));
productSet.add(new Long(3));
Set stateSet = new HashSet();
stateSet.add(new Long(2));
productSet.add(new Long(3));
productSet.add(new Long(3));
logger.info("Before Request Creation");
// 1. Build a Request
Request r = new Request("requestorDn", "customerDn", "comments",
"lastApproverDn", "fulfillmentBuildingDn",
"200200", "nextApproverRoleDn",
"ticketNumber", stateSet, productSet,"SOFTWARE");
logger.info("After Request Creation");
Transaction tx = null;
try {
//3. Open a session
Session session = HibernateUtil.currentSession();
// 4. Save Request and close Session
tx = session.beginTransaction();
session.save(r);
logger.info("After Request Save");
tx.commit();
logger.info("After Transaction Commit");
}
catch (HibernateException he) {
if (tx!=null)
try {
logger.info("In Catch block before rollback");
tx.rollback();
logger.info("In Catch block after rollback");
} catch (HibernateException e) {
e.printStackTrace();
}
throw new ARTException(he.getMessage(), ARTError.ARTDB_ERROR);
}
finally {
logger.info("In Finally block");
try {
HibernateUtil.closeSession();
} catch (HibernateException e) {
e.printStackTrace();
}
}
Full stack trace of any exception that occurs:
Log provided below
Name and version of the database you are using:
Oracle 9.2.0
Debug level Hibernate log excerpt:
2004-08-09 10:21:20 DEBUG SessionImpl.saveWithGeneratedIdentifier(778) - generated identifier: 7
2004-08-09 10:21:20 DEBUG SessionImpl.doSave(825) - saving [com.aol.ic.art.data.domain.Request#7]
2004-08-09 10:21:20 DEBUG WrapVisitor.processArrayOrNewCollection(81) - Wrapped
collection in role: com.aol.ic.art.data.domain.Request.products
2004-08-09 10:21:20 DEBUG WrapVisitor.processArrayOrNewCollection(81) - Wrapped
collection in role: com.aol.ic.art.data.domain.Request.states
2004-08-09 10:21:20 INFO TestHibernateUtil.testCreate(?) - After Request Save
2004-08-09 10:21:20 DEBUG JDBCTransaction.commit(59) - commit
2004-08-09 10:21:20 DEBUG SessionImpl.flushEverything(2242) - flushing session
2004-08-09 10:21:20 DEBUG SessionImpl.flushEntities(2435) - Flushing entities and processing referenced collections
2004-08-09 10:21:20 DEBUG SessionImpl.updateReachableCollection(2880) - Collection found: [com.aol.ic.art.data.domain.Request.products#7], was: [<unreferenced>]
2004-08-09 10:21:20 DEBUG SessionImpl.updateReachableCollection(2880) - Collection found: [com.aol.ic.art.data.domain.Request.states#7], was: [<unreferenced>]
2004-08-09 10:21:20 DEBUG SessionImpl.flushCollections(2776) - Processing unreferenced collections
2004-08-09 10:21:20 DEBUG SessionImpl.flushCollections(2790) - Scheduling collection removes/(re)creates/updates
2004-08-09 10:21:20 DEBUG SessionImpl.flushEverything(2266) - Flushed: 1 insertions, 0 updates, 0 deletions to 1 objects
2004-08-09 10:21:20 DEBUG SessionImpl.flushEverything(2271) - Flushed: 2 (re)creations, 0 updates, 0 removals to 2 collections
2004-08-09 10:21:20 DEBUG Printer.toString(75) - listing entities:
2004-08-09 10:21:20 ERROR BasicPropertyAccessor$BasicGetter.get(106) - IllegalArgumentException in class: com.aol.ic.art.data.domain.Product, getter method of property: id
2004-08-09 10:21:20 INFO TestHibernateUtil.testCreate(?) - In Catch block before rollback
2004-08-09 10:21:20 DEBUG JDBCTransaction.rollback(82) - rollback
2004-08-09 10:21:20 DEBUG SessionImpl.afterTransactionCompletion(585) - transaction completion
2004-08-09 10:21:20 INFO TestHibernateUtil.testCreate(?) - In Catch block after rollback
2004-08-09 10:21:20 INFO TestHibernateUtil.testCreate(?) - In Finally block
2004-08-09 10:21:20 FATAL ARTInitServlet.init(?) - Init ART - In catch block: IllegalArgumentException occurred calling getter of com.aol.ic.art.data.domain.Product.id
|