Hi,
I have been researching a problem with Hibernate for a few days now that I just can't seem to figure out. I have two mappings classes that are attempting to persist user data to an Oracle Database. One class works fine, the other fails. I am new to Hibernate and am upgrading the version of Hibernate currently used to
Hibernate 2.1.2. The code fails when invoking the method
Quote:
session.saveOrUpdate(object);
in my
Persister class in the method
persist.
Thanks very much in advance for any help you might offer. I hope not too much information has been included here.
JD
The Database is Oracle version 8.1.7.2
Here are my mappings documents and classes:
Document
Code:
<?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.sas.mis.qs.data.UserSession" table="QS_User_Session">
<id name="primaryKey" type="long" column="primary_Key" unsaved-value="0">
<generator class="sequence">
<param name="sequence">QS_User_Session_S</param>
</generator>
</id>
<property name="fourByteCode" column="four_byte_code" type="string" length="10"/>
<property name="operatingSystem" column="operating_System" type="string" length="10"/>
<property name="siteNumber" column="site_Number" type="string" length="10"/>
<property name="machineCategory" column="machine_category" length="2"/>
<property name="lastModificationTime" column="last_Modification_Time" type="long"/>
<property name="machineVendor" column="machine_Vendor" type="string" length="100"/>
<property name="userId" column="userId" type="string"/>
<property name="machineClass" column="machine_Class" type="string" length="2"/>
<list name="user" lazy="false" cascade="all">
<key column="User_Session_pk"/>
<index column="i"/>
<one-to-many class="com.sas.mis.qs.data.Item" />
</list>
<property name="threeByteCode" column="three_Byte_Code" type="string" length="10"/>
<property name="machineModel" column="machine_Model" type="string" length="100"/>
<property name="userName" column="userName" type="string"/>
<property name="createTime" column="create_Time" type="long"/>
<property name="companyName" column="company_Name" type="string" length="100"/>
</class>
</hibernate-mapping>
Class FileCode:
package com.sas.mis.qs.data;
import java.util.List;
import java.util.Hashtable;
public class UserSession implements Persistable {
public static final String QUOTEID = "primary_Key";
public static final String USERID = "userid";
public static final String USERNAME = "username";
public static final String COMPANY = "company_Name";
public static final String SITE = "site_Number";
/** The primary key into the database */
private long primaryKey;
/** The user's SAS employee id */
private String userId;
/** The user's SAS known-as name */
private String userName;
/** The time of creation */
private long createTime;
/** When this object was last modified */
private long lastModificationTime;
/** The company name */
private String companyName;
/** The site number */
private String siteNumber;
/** The category of machine at this site *//* used for quantype determination */
private String machineCategory;
/** The vendor of the machine at this site */
private String machineVendor;
/** The model of the machine at this site */
private String machineModel;
/** The class of the machine at this site */
private String machineClass;
/** The operating system at this site */
private String operatingSystem;
/** The operating system (three-byte) at this site */
private String threeByteCode;
/** The items associated with this session */
private List items;
/** The four-byte representation of the operating system at this site */
private String fourByteCode;
// required for hibernate
private UserSession() {}
public UserSession(String userName, String userId, String company, String site) {
this.createTime = System.currentTimeMillis();
this.userName = userName;
this.userId = userId;
this.companyName = company;
this.siteNumber = site;
}
public long getPrimaryKey() {
return primaryKey;
}
public void setPrimaryKey(long primaryKey) {
this.primaryKey = primaryKey;
}
public String getUserId() {
return userId;
}
public String getUser() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public void setUser(String userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public long getCreateTime() {
return createTime;
}
private void setCreateTime(long createTime) {
this.createTime = createTime;
}
public long getLastModificationTime() {
return lastModificationTime;
}
private void setLastModificationTime(long lastModificationTime) {
this.lastModificationTime = lastModificationTime;
}
public String getCompanyName() {
return companyName;
}
public void setCompanyName(String companyName) {
this.companyName = companyName;
}
public String getSiteNumber() {
return siteNumber;
}
public void setSiteNumber(String siteNumber) {
this.siteNumber = siteNumber;
}
public String getMachineCategory() {
return machineCategory;
}
public void setMachineCategory(String machineCategory) {
this.machineCategory = machineCategory;
}
public String getMachineVendor() {
return machineVendor;
}
public void setMachineVendor(String machineVendor) {
this.machineVendor = machineVendor;
}
public String getMachineModel() {
return machineModel;
}
public void setMachineModel(String machineModel) {
this.machineModel = machineModel;
}
public String getMachineClass() {
return machineClass;
}
public void setMachineClass(String machineClass) {
this.machineClass = machineClass;
}
public String getOperatingSystem() {
return operatingSystem;
}
public void setOperatingSystem(String operatingSystem) {
this.operatingSystem = operatingSystem;
}
public String getThreeByteCode() {
return threeByteCode;
}
public void setThreeByteCode(String threeByteCode) {
this.threeByteCode = threeByteCode;
}
public List getItems() {
return items;
}
public void setItems(List items) {
this.items = items;
}
public String getFourByteCode() {
return fourByteCode;
}
public void setFourByteCode(String fourByteCode) {
this.fourByteCode = fourByteCode;
}
/**
* Returns a hash code value for the object. This method is
* supported for the benefit of hashtables such as those provided by
* <code>java.util.Hashtable</code>.
* <p>
* The general contract of <code>hashCode</code> is:
* <ul>
* <li>Whenever it is invoked on the same object more than once during
* an execution of a Java application, the <tt>hashCode</tt> method
* must consistently return the same integer, provided no information
* used in <tt>equals</tt> comparisons on the object is modified.
* This integer need not remain consistent from one execution of an
* application to another execution of the same application.
* <li>If two objects are equal according to the <tt>equals(Object)</tt>
* method, then calling the <code>hashCode</code> method on each of
* the two objects must produce the same integer result.
* <li>It is <em>not</em> required that if two objects are unequal
* according to the {@link Object#equals(Object)}
* method, then calling the <tt>hashCode</tt> method on each of the
* two objects must produce distinct integer results. However, the
* programmer should be aware that producing distinct integer results
* for unequal objects may improve the performance of hashtables.
* </ul>
* <p>
* As much as is reasonably practical, the hashCode method defined by
* class <tt>Object</tt> does return distinct integers for distinct
* objects. (This is typically implemented by converting the internal
* address of the object into an integer, but this implementation
* technique is not required by the
* Java<font size="-2"><sup>TM</sup></font> programming language.)
*
* @return a hash code value for this object.
* @see Object#equals(Object)
* @see Hashtable
*/
public int hashCode() {
return (int)(this.getCompanyName().hashCode() +
this.getCreateTime() +
this.getLastModificationTime() +
this.getMachineClass().hashCode() +
this.getMachineModel().hashCode() +
this.getMachineVendor().hashCode() +
this.getOperatingSystem().hashCode() +
this.getSiteNumber().hashCode() +
this.getThreeByteCode().hashCode() +
this.getUserId().hashCode() +
this.getUserName().hashCode());
}
/**
* Indicates whether some other object is "equal to" this one.
* <p>
* The <code>equals</code> method implements an equivalence relation:
* <ul>
* <li>It is <i>reflexive</i>: for any reference value <code>x</code>,
* <code>x.equals(x)</code> should return <code>true</code>.
* <li>It is <i>symmetric</i>: for any reference values <code>x</code> and
* <code>y</code>, <code>x.equals(y)</code> should return
* <code>true</code> if and only if <code>y.equals(x)</code> returns
* <code>true</code>.
* <li>It is <i>transitive</i>: for any reference values <code>x</code>,
* <code>y</code>, and <code>z</code>, if <code>x.equals(y)</code>
* returns <code>true</code> and <code>y.equals(z)</code> returns
* <code>true</code>, then <code>x.equals(z)</code> should return
* <code>true</code>.
* <li>It is <i>consistent</i>: for any reference values <code>x</code>
* and <code>y</code>, multiple invocations of <tt>x.equals(y)</tt>
* consistently return <code>true</code> or consistently return
* <code>false</code>, provided no information used in
* <code>equals</code> comparisons on the object is modified.
* <li>For any non-null reference value <code>x</code>,
* <code>x.equals(null)</code> should return <code>false</code>.
* </ul>
* <p>
* The <tt>equals</tt> method for class <code>Object</code> implements
* the most discriminating possible equivalence relation on objects;
* that is, for any reference values <code>x</code> and <code>y</code>,
* this method returns <code>true</code> if and only if <code>x</code> and
* <code>y</code> refer to the same object (<code>x==y</code> has the
* value <code>true</code>).
* <p>
* Note that it is generally necessary to override the <tt>hashCode</tt>
* method whenever this method is overridden, so as to maintain the
* general contract for the <tt>hashCode</tt> method, which states
* that equal objects must have equal hash codes.
*
* @param obj the reference object with which to compare.
* @return <code>true</code> if this object is the same as the obj
* argument; <code>false</code> otherwise.
* @see #hashCode()
* @see Hashtable
*/
public boolean equals(Object obj) {
UserSession us = null;
try {
us = (UserSession)obj;
} catch(Exception e) {
return false;
}
return this.getCompanyName().equals(us.getCompanyName()) &&
this.getCreateTime() == us.getCreateTime() &&
this.getLastModificationTime() == us.getLastModificationTime() &&
this.getMachineClass().equals(us.getMachineClass()) &&
this.getMachineModel().equals(us.getMachineModel()) &&
this.getMachineVendor().equals(us.getMachineVendor()) &&
this.getOperatingSystem().equals(us.getOperatingSystem()) &&
this.getSiteNumber().equals(us.getSiteNumber()) &&
this.getThreeByteCode().equals(us.getThreeByteCode()) &&
this.getUserId().equals(us.getUserId()) &&
this.getUserName().equals(us.getUserName());
}
public String toString() {
return "UserSession:(pk=" + primaryKey + ")(id=" + userId + ")(name=" + userName + ")(company=" + companyName +
")(site=" + siteNumber + ")";
}
}
My Actual Persistence Class:Code:
package com.sas.mis.qs.data;
import java.sql.SQLException;
import java.util.Hashtable;
import java.util.List;
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.MappingException;
import net.sf.hibernate.Session;
import net.sf.hibernate.SessionFactory;
import net.sf.hibernate.cfg.Configuration;
import net.sf.hibernate.persister.ClassPersister;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class Persister {
/** The logger */
private static Log log = LogFactory.getLog(Persister.class);
/** The <tt>UserSession</tt> class */
private static String userSessionClass = "com.sas.mis.qs.data.UserSession";
/** The identifying key corresponding to this object -- Not used anymore */
private String userId = "anybody";
/** The Hibernate datastore */
private Configuration configuration;
/** The Hibernate session factory */
private SessionFactory sessionFactory;
//todo: When the getInstance(String) method is retired so too can this reference
private static Hashtable persisters = new Hashtable();
/** A singleton reference to an object of this class */
private static Persister persister;
static {
try {
persister = new Persister();
} catch (HibernateException e) {
log.error("Unable to create a Persister object.");
}
}
/**
* Create an instance of this object
* @throws HibernateException
*/
private Persister() throws HibernateException {
init();
}
//todo: Should we fine tune exception that is thrown?
/**
* Create an instance of this object for the given userid.<br>
* Note: This constructor is deprecated. Please use the {@link #Persister()}
* variant instead.
* @param userId
* @throws MappingException
* @throws HibernateException
*/
/*private Persister(String userId)
throws MappingException, HibernateException {
super();
this.userId = userId;
} */
/**
* Initialize this object by creating the datastore and a session factory
* @throws MappingException
* @throws HibernateException
*/
private void init() throws MappingException, HibernateException {
try{
loadClassesToStore();
sessionFactory = configuration.buildSessionFactory();
}
catch(Exception e){
log.trace("Persister init exception.");
e.printStackTrace();
}
}
// todo: Move the list of classes to load to a properties' file
/**
* Build the Hibernate datastore
* @throws MappingException
*/
private void loadClassesToStore() throws MappingException {
log.trace("Creating the datastore");
configuration = new Configuration();
configuration.addClass(com.sas.mis.qs.data.UserSession.class);
configuration.addClass(com.sas.mis.qs.data.Item.class);
}
/**
* Provides the userid corresponding to this object<br>
* This method has no value. Refrain from using it.
* @return A userid
* @deprecated
*/
public String getUserId() {
return userId;
}
/**
* Provides an instance of this object
* @return A <tt>Persister</tt> object
*/
public static Persister getInstance() {
return persister;
}
/**
* Provides an instance of this object.<br>
* Note: This method has been deprecated. Please use the {@link #getInstance()}
* variant instead.
* @param userId Not used anymore
* @return A persister object
* @throws PersisterException
* @deprecated
*/
public static Persister getInstance(String userId)
throws PersisterException {
log.debug("Perister for id='" + userId + "'");
return Persister.getInstance();
}
/**
* Provides a new Hibernate <tt>Session</tt>
* @return A <tt>Session</tt> object
* @throws SQLException
* @see cirrus.hibernate.Session
*/
private Session getSession() throws SQLException, HibernateException {
return sessionFactory.openSession();
}
/**
* Persists the given object to the store associated with this class.
* @param object The object to be persisted
* @throws PersisterException If an error is encountered
*/
public void persist(Object object) throws PersisterException {
Session session = null;
try {
session = getSession();
if(session == null){
log.debug("The session is null");
}
} catch (SQLException e) {
log.warn(
"Unable to open a Hibernate session due to SQL Exception.",
e);
throw new PersisterException(e.getMessage());
} catch (HibernateException e) {
log.warn("Unable to open a Hibernate session.", e);
e.printStackTrace();
}
try {
session.saveOrUpdate(object);
session.flush();
session.connection().commit();
} catch (Exception e) { // SQLException & HibernateException
log.warn("Failed to insert/update.", e);
throw new PersisterException(e.getMessage());
} finally {
try {
session.close();
} catch (Exception e) {
log.warn("Error while closing Hibernate session.", e);
}
}
}
/**
* Inserts the given object to the store associated with thsi class.
* This is a convenient interface to the {@link #persist method}
* @param p The object to be persisted
* @throws PersisterException
* @see com.sas.mis.qs.data.Persistable
*/
public void insert(Persistable p) throws PersisterException {
persist(p);
}
/**
* Updates the given object to the store associated with thsi class.
* This is a convenient interface to the {@link #persist method}
* @param p The object to be persisted
* @throws PersisterException
* @see com.sas.mis.qs.data.Persistable
*/
public void update(Persistable p) throws PersisterException {
persist(p);
}
/**
* Retrieves (from the database) the state of the object of the given class with
* the stated primary key
* @param type The class of object to be retrieved
* @param key The primary key of the object
* @return Reference to the object retrieved from the database
* @throws Exception
*/
public Persistable retrieve(Class type, long key) throws Exception {
// Make sure that the type being retreived is persistable
Class[] interfaces = type.getInterfaces();
// Helper
Class currentInterfaceClass = null;
boolean isPersistable = false;
for (int i = 0, imax = interfaces.length; i < imax; i++) {
currentInterfaceClass = interfaces[i];
if (Persistable.class.equals(currentInterfaceClass)) {
isPersistable = true;
break;
}
}
if (!isPersistable) {
throw new Exception(
"Cannot retreive non-peristable type"
+ type.getClass().getName());
}
Session session = getSession();
Persistable retval = null;
try {
retval = (Persistable) session.load(type, new Long(key));
// todo: improve the exception handling
} catch (HibernateException e) {
e.printStackTrace();
throw new Exception(e.getMessage());
} finally {
session.close();
}
return retval;
}
/**
* Provides a <tt>List</tt> of <tt>UserSession</tt> objects corresponding to the given key field
* information.
* @param keyType The field name of the key
* @param keyValue The value of the key
* @return A <tt>List</tt> of <tt>Userssion</tt>s
* @throws Exception If there an error during the fetch.
* @see java.util.List
* @see com.sas.mis.qs.data.UserSession
*/
public List getUserSessions(String keyType, String keyValue)
throws Exception {
// Build the Hibernate query
String hql = "from aSession in class " + userSessionClass;
// The where clause is predicated by the name of the field by which the user
// wishes to filter the data
if (UserSession.QUOTEID.equals(keyType)
|| UserSession.SITE.equals(keyType)) {
hql += " where " + keyType + "='" + keyValue + "'";
} else if (
UserSession.COMPANY.equals(keyType)
|| UserSession.USERNAME.equals(keyType)) {
hql += " where upper("
+ keyType
+ ") like '"
+ keyValue.toUpperCase()
+ "%'";
} else {
log.error(
"Given key ("
+ keyType
+ "). Only recognized values are "
+ UserSession.QUOTEID
+ " and "
+ UserSession.SITE
+ ".");
throw new Exception(
"Key type (" + keyType + ") is not recognized.");
}
log.debug("Getting user sessions with hql (" + hql + ")");
Session session = getSession();
List userSessions = null;
try {
userSessions = session.find(hql);
} catch (HibernateException e) {
log.error(
"HibernateException while executing Hibernate sql ("
+ hql
+ ")");
return null;
} finally {
try {
session.close();
} catch (HibernateException e) {
log.warn(
"Unable to close Hibernate session due to HibernateException");
}
}
return userSessions;
}
}
Here is the log trace from my Junit test at the debug level. The error corresponds directly with the error I am receiving in my Tomcat development instance on a Unix server.
2004-04-14 10:45:20,355 Persister - Creating the datastore
2004-04-14 10:45:20,387 Environment - Hibernate 2.1.2
2004-04-14 10:45:20,402 Environment - loaded properties from resource hibernate.properties: {hibernate.connection.password=sasqs12, @local.username@hibernate.connection.username=sasqs, hibernate.use_batch_updates=false, hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N', hibernate.show_sql=true, hibernate.proxool.pool_alias=pool1, @test.connection@hibernate.connection.url=jdbc:oracle:thin:@ORAP1TE.UNX.SAS.COM:6619:QSD, hibernate.jdbc.batch_size=0, @dev.password@hibernate.connection.password=sasqs12, hibernate.cache.use_query_cache=true, @test.password@hibernate.connection.password=sasqst12, hibernate.max_fetch_depth=1, hibernate.jdbc.use_streams_for_binary=true, @prod.password@hibernate.connection.password=sasqs12, hibernate.connection.pool_size=2, hibernate.connection.username=sasqs, @dev.username@hibernate.connection.username=sasqs, @test.username@hibernate.connection.username=sasqst, hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver, @dev.connection@hibernate.connection.url=jdbc:oracle:thin:@ORAP1TE.UNX.SAS.COM:6619:QSD, hibernate.cache.provider_class=net.sf.hibernate.cache.HashtableCacheProvider, @prod.username@hibernate.connection.username=sasqs, @local.password@hibernate.connection.password=sasqs12, hibernate.cglib.use_reflection_optimizer=true, @prod.connection@hibernate.connection.url=jdbc:oracle:thin:@ordbpds.unx.sas.com:6620:QSP, hibernate.dialect=net.sf.hibernate.dialect.OracleDialect, hibernate.connection.url=jdbc:oracle:thin:@ORAP1TE.UNX.SAS.COM:6619:QSD, @local.connection@hibernate.connection.url=jdbc:oracle:thin:@ORAP1TE.UNX.SAS.COM:6619:QSD}
2004-04-14 10:45:20,402 Environment - using java.io streams to persist binary types
2004-04-14 10:45:20,418 Environment - using CGLIB reflection optimizer
2004-04-14 10:45:20,449 Configuration - Mapping resource: com/sas/mis/qs/data/UserSession.hbm.xml
2004-04-14 10:45:20,558 DTDEntityResolver - trying to locate
http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath under net/sf/hibernate/
2004-04-14 10:45:20,558 DTDEntityResolver - found
http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath
2004-04-14 10:45:20,746 Binder - Mapping class: com.sas.mis.qs.data.UserSession -> QS_User_Session
2004-04-14 10:45:20,840 Binder - Mapped property: primaryKey -> primary_Key, type: long
2004-04-14 10:45:20,855 Binder - Mapped property: fourByteCode -> four_byte_code, type: string
2004-04-14 10:45:20,855 Binder - Mapped property: operatingSystem -> operating_System, type: string
2004-04-14 10:45:20,855 Binder - Mapped property: siteNumber -> site_Number, type: string
2004-04-14 10:45:20,871 Binder - Mapped property: machineCategory -> machine_category, type: string
2004-04-14 10:45:20,871 Binder - Mapped property: lastModificationTime -> last_Modification_Time, type: long
2004-04-14 10:45:20,871 Binder - Mapped property: machineVendor -> machine_Vendor, type: string
2004-04-14 10:45:20,871 Binder - Mapped property: userId -> userId, type: string
2004-04-14 10:45:20,871 Binder - Mapped property: machineClass -> machine_Class, type: string
2004-04-14 10:45:20,887 Binder - Mapped property: user, type: java.util.List
2004-04-14 10:45:20,887 Binder - Mapped property: threeByteCode -> three_Byte_Code, type: string
2004-04-14 10:45:20,902 Binder - Mapped property: machineModel -> machine_Model, type: string
2004-04-14 10:45:20,902 Binder - Mapped property: userName -> userName, type: string
2004-04-14 10:45:20,902 Binder - Mapped property: createTime -> create_Time, type: long
2004-04-14 10:45:20,902 Binder - Mapped property: companyName -> company_Name, type: string
2004-04-14 10:45:20,902 Configuration - Mapping resource: com/sas/mis/qs/data/Item.hbm.xml
2004-04-14 10:45:20,902 DTDEntityResolver - trying to locate
http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath under net/sf/hibernate/
2004-04-14 10:45:20,902 DTDEntityResolver - found
http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath
2004-04-14 10:45:20,949 Binder - Mapping class: com.sas.mis.qs.data.Item -> QS_Item
2004-04-14 10:45:20,949 Binder - Mapped property: primaryKey -> primary_Key, type: long
2004-04-14 10:45:20,949 Binder - Mapped property: installed -> installed, type: boolean
2004-04-14 10:45:20,949 Binder - Mapped property: standalone -> standalone, type: boolean
2004-04-14 10:45:20,949 Binder - Mapped property: renewalFee -> renewal_Fee, type: integer
2004-04-14 10:45:20,949 Binder - Mapped property: quantity -> quantity, type: integer
2004-04-14 10:45:20,949 Binder - Mapped property: firstYearFee -> first_Year_Fee, type: integer
2004-04-14 10:45:20,949 Binder - Mapped property: fullSasRelease -> full_Sas_Release, type: string
2004-04-14 10:45:20,949 Binder - Mapped property: priceBasis -> price_Basis, type: string
2004-04-14 10:45:20,949 Binder - Mapped property: twelveByteCode -> twelve_Byte_Code, type: string
2004-04-14 10:45:20,949 Binder - Mapped property: productName -> product_Name, type: string
2004-04-14 10:45:20,949 Binder - Mapped property: productCode -> product_Code, type: string
2004-04-14 10:45:20,949 Binder - Mapped property: sasRelease -> sas_Release, type: string
2004-04-14 10:45:20,949 Configuration - processing one-to-many association mappings
2004-04-14 10:45:20,949 Binder - Second pass for collection: com.sas.mis.qs.data.UserSession.user
2004-04-14 10:45:20,949 Binder - Mapping collection: com.sas.mis.qs.data.UserSession.user -> QS_Item
2004-04-14 10:45:20,949 Binder - Mapped collection key: User_Session_pk, index: i, one-to-many: com.sas.mis.qs.data.Item
2004-04-14 10:45:20,949 Configuration - processing one-to-one association property references
2004-04-14 10:45:20,949 Configuration - processing foreign key constraints
2004-04-14 10:45:20,949 Configuration - resolving reference to class: com.sas.mis.qs.data.UserSession
2004-04-14 10:45:21,012 Dialect - Using dialect: net.sf.hibernate.dialect.OracleDialect
2004-04-14 10:45:21,027 SettingsFactory - Maximim outer join fetch depth: 1
2004-04-14 10:45:21,027 SettingsFactory - Use outer join fetching: true
2004-04-14 10:45:21,027 DriverManagerConnectionProvider - Using Hibernate built-in connection pool (not for production use!)
2004-04-14 10:45:21,027 DriverManagerConnectionProvider - Hibernate connection pool size: 2
2004-04-14 10:45:21,027 DriverManagerConnectionProvider - using driver: oracle.jdbc.driver.OracleDriver at URL: jdbc:oracle:thin:@ORAP1TE.UNX.SAS.COM:6619:QSD
2004-04-14 10:45:21,027 DriverManagerConnectionProvider - connection properties: {nate.connection.password=sasqs12, ate.connection.username=sasqs, rnate.connection.url=jdbc:oracle:thin:@ORAP1TE.UNX.SAS.COM:6619:QSD, nate.connection.url=jdbc:oracle:thin:@ORAP1TE.UNX.SAS.COM:6619:QSD, user=sasqs, ate.connection.password=sasqs12, ernate.connection.url=jdbc:oracle:thin:@ORAP1TE.UNX.SAS.COM:6619:QSD, nate.connection.username=sasqs, te.connection.username=sasqs, password=sasqs12, te.connection.password=sasqs12}
2004-04-14 10:45:21,043 TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
2004-04-14 10:45:21,043 DriverManagerConnectionProvider - total checked-out connections: 0
2004-04-14 10:45:21,043 DriverManagerConnectionProvider - opening new JDBC connection
2004-04-14 10:45:21,496 DriverManagerConnectionProvider - created connection to: jdbc:oracle:thin:@ORAP1TE.UNX.SAS.COM:6619:QSD, Isolation Level: 2
2004-04-14 10:45:21,512 DriverManagerConnectionProvider - returning connection to pool, pool size: 1
2004-04-14 10:45:21,512 SettingsFactory - Use scrollable result sets: true
2004-04-14 10:45:21,512 SettingsFactory - Use JDBC3 getGeneratedKeys(): false
2004-04-14 10:45:21,512 SettingsFactory - Optimize cache for minimal puts: false
2004-04-14 10:45:21,512 SettingsFactory - echoing all SQL to stdout
2004-04-14 10:45:21,512 SettingsFactory - Query language substitutions: {no='N', true=1, yes='Y', false=0}
2004-04-14 10:45:21,512 SettingsFactory - cache provider: net.sf.hibernate.cache.HashtableCacheProvider
2004-04-14 10:45:21,512 Configuration - instantiating and configuring caches
2004-04-14 10:45:21,699 SessionFactoryImpl - building session factory
2004-04-14 10:45:21,699 SessionFactoryImpl - instantiating session factory with properties: {java.vendor=Sun Microsystems Inc., @local.password@hibernate.connection.password=sasqs12, @dev.username@hibernate.connection.username=sasqs, hibernate.connection.url=jdbc:oracle:thin:@ORAP1TE.UNX.SAS.COM:6619:QSD, @test.password@hibernate.connection.password=sasqst12, @prod.connection@hibernate.connection.url=jdbc:oracle:thin:@ordbpds.unx.sas.com:6620:QSP, os.name=Windows XP, sun.boot.class.path=C:\Jakarta\J2SDK\j2sdk1.4.1_01\jre\lib\rt.jar;C:\Jakarta\J2SDK\j2sdk1.4.1_01\jre\lib\i18n.jar;C:\Jakarta\J2SDK\j2sdk1.4.1_01\jre\lib\sunrsasign.jar;C:\Jakarta\J2SDK\j2sdk1.4.1_01\jre\lib\jsse.jar;C:\Jakarta\J2SDK\j2sdk1.4.1_01\jre\lib\jce.jar;C:\Jakarta\J2SDK\j2sdk1.4.1_01\jre\lib\charsets.jar;C:\Jakarta\J2SDK\j2sdk1.4.1_01\jre\classes, sun.java2d.fontpath=, java.vm.specification.vendor=Sun Microsystems Inc., java.runtime.version=1.4.1_01-b01, hibernate.cache.provider_class=net.sf.hibernate.cache.HashtableCacheProvider, @prod.password@hibernate.connection.password=sasqs12, user.name=jodalt, user.language=en, sun.boot.library.path=C:\Jakarta\J2SDK\j2sdk1.4.1_01\jre\bin, java.version=1.4.1_01, user.timezone=America/New_York, sun.arch.data.model=32, java.endorsed.dirs=C:\Jakarta\J2SDK\j2sdk1.4.1_01\jre\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, @dev.password@hibernate.connection.password=sasqs12, user.country=US, java.home=C:\Jakarta\J2SDK\j2sdk1.4.1_01\jre, java.vm.info=mixed mode, os.version=5.1, path.separator=;, java.vm.version=1.4.1_01-b01, hibernate.max_fetch_depth=1, java.util.prefs.PreferencesFactory=java.util.prefs.WindowsPreferencesFactory, hibernate.connection.password=sasqs12, user.variant=, hibernate.jdbc.batch_size=0, java.awt.printerjob=sun.awt.windows.WPrinterJob, sun.io.unicode.encoding=UnicodeLittle, awt.toolkit=sun.awt.windows.WToolkit, hibernate.connection.username=sasqs, user.home=C:\Documents and Settings\jodalt, hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N', java.specification.vendor=Sun Microsystems Inc., java.library.path=C:\Jakarta\J2SDK\j2sdk1.4.1_01\bin;.;C:\WINNT\System32;C:\WINNT;C:\Program Files\BMC Software\SQL_Explorer_6.2\bin;C:\oracle\ora81\bin;C:\Program Files\Oracle\jre\1.1.7\bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\Program Files\Hummingbird\Connectivity\7.10\Accessories\;C:\Program Files\PRISM;C:\Program Files\Resource Pro Kit\;C:\Jakarta\J2SDK\j2sdk1.4.1_01\bin;C:\Jakarta\Ant\jakarta-ant-1.5.1\bin;C:\MAVEN_INSTALL_DIR\maven-1.0-rc1\bin;c:\vslick\win, java.vendor.url=http://java.sun.com/, hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver, hibernate.proxool.pool_alias=pool1, java.vm.vendor=Sun Microsystems Inc., hibernate.dialect=net.sf.hibernate.dialect.OracleDialect, hibernate.jdbc.use_streams_for_binary=true, java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, java.class.path=C:/eclipse/plugins/org.eclipse.jdt.junit_2.1.1/junitsupport.jar;C:\Projects\QS\build\test-classes;C:\Projects\QS\build\classes;C:\Documents and Settings\jodalt\.maven\repository\junit\jars\junit-3.8.1.jar;C:\Documents and Settings\jodalt\.maven\repository\servletapi\jars\servletapi-2.3.jar;C:\Documents and Settings\jodalt\.maven\repository\struts\jars\km-nested-2.03.jar;C:\Documents and Settings\jodalt\.maven\repository\commons-logging\jars\commons-logging-1.0.3.jar;C:\Documents and Settings\jodalt\.maven\repository\log4j\jars\log4j-1.2.7.jar;C:\Documents and Settings\jodalt\.maven\repository\struts\jars\struts-1.1.jar;C:\Documents and Settings\jodalt\.maven\repository\commons-lang\jars\commons-lang-2.0.jar;C:\Documents and Settings\jodalt\.maven\repository\km-nested\jars\km-nested-2.03.jar;C:\Documents and Settings\jodalt\.maven\repository\commons-beanutils\jars\commons-beanutils-1.6.1.jar;C:\Documents and Settings\jodalt\.maven\repository\sas-remobj\jars\sas-remobj-1.0.jar;C:\Documents and Settings\jodalt\.maven\repository\sas-webaf\jars\sas-webaf-1.0.jar;C:\Documents and Settings\jodalt\.maven\repository\sas-connect\jars\sas-connect-1.0.jar;C:\Documents and Settings\jodalt\.maven\repository\sas-netutil\jars\sas-netutil-1.0.jar;C:\Documents and Settings\jodalt\.maven\repository\sas-brgorb\jars\sas-brgorb-1.0.jar;C:\Documents and Settings\jodalt\.maven\repository\sas-iomprx\jars\sas-iomprx-1.0.jar;C:\Documents and Settings\jodalt\.maven\repository\sas-iomdriver\jars\sas-iomdriver-1.0.jar;C:\Documents and Settings\jodalt\.maven\repository\sas-getrate\jars\sas-getrate-1.0.jar;C:\Documents and Settings\jodalt\.maven\repository\mis-watTools\jars\mis-watTools-1.1.jar;C:\Documents and Settings\jodalt\.maven\repository\oracle\jars\oracle-12.jar;C:\Documents and Settings\jodalt\.maven\repository\commons-validator\jars\commons-validator-1.0.jar;C:\Documents and Settings\jodalt\.maven\repository\soap\jars\soap-1.0.jar;C:\Documents and Settings\jodalt\.maven\repository\commons-jxpath\jars\commons-jxpath-1.0.jar;C:\Documents and Settings\jodalt\.maven\repository\commons-collections\jars\commons-collections-3.0.jar;C:\Documents and Settings\jodalt\.maven\repository\xdoclet\jars\xdoclet-1.2b4.jar;C:\Documents and Settings\jodalt\.maven\repository\xdoclet\jars\xdoclet-web-module-1.2b4.jar;C:\Documents and Settings\jodalt\.maven\repository\hibernate\jars\hibernate-2.1.2.jar;C:\Documents and Settings\jodalt\.maven\repository\dom4j\jars\dom4j-1.4.jar;C:\Documents and Settings\jodalt\.maven\repository\c3p0\jars\c3p0-1.0.jar;C:\Documents and Settings\jodalt\.maven\repository\cglib\jars\cglib-full-2.0-RC2.jar;C:\Documents and Settings\jodalt\.maven\repository\odmg\jars\odmg-3.0.jar;C:\Documents and Settings\jodalt\.maven\repository\j2ee\jars\j2ee-1.3.1.jar, @local.username@hibernate.connection.username=sasqs, @dev.connection@hibernate.connection.url=jdbc:oracle:thin:@ORAP1TE.UNX.SAS.COM:6619:QSD, @test.username@hibernate.connection.username=sasqst, java.vm.specification.name=Java Virtual Machine Specification, java.vm.specification.version=1.0, sun.cpu.endian=little, sun.os.patch.level=Service Pack 1, hibernate.cache.use_query_cache=true, java.io.tmpdir=C:\DOCUME~1\jodalt\LOCALS~1\Temp\, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, hibernate.use_batch_updates=false, os.arch=x86, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, java.ext.dirs=C:\Jakarta\J2SDK\j2sdk1.4.1_01\jre\lib\ext, @prod.username@hibernate.connection.username=sasqs, user.dir=C:\Projects\QS, @test.connection@hibernate.connection.url=jdbc:oracle:thin:@ORAP1TE.UNX.SAS.COM:6619:QSD, line.separator=
, java.vm.name=Java HotSpot(TM) Client VM, file.encoding=Cp1252, java.specification.version=1.4, @local.connection@hibernate.connection.url=jdbc:oracle:thin:@ORAP1TE.UNX.SAS.COM:6619:QSD, hibernate.connection.pool_size=2, hibernate.show_sql=true}
2004-04-14 10:45:21,871 ReflectHelper - reflection optimizer disabled for: com.sas.mis.qs.data.UserSession, BulkBeanException: Property is private (property setLastModificationTime)
2004-04-14 10:45:22,183 SessionFactoryObjectFactory - initializing class SessionFactoryObjectFactory
2004-04-14 10:45:22,183 SessionFactoryObjectFactory - registered: 8a868b2efbe97aaa00fbe97aac870000 (unnamed)
2004-04-14 10:45:22,183 SessionFactoryObjectFactory - no JNDI name configured
2004-04-14 10:45:22,183 SessionFactoryImpl - instantiated session factory
2004-04-14 10:45:22,199 UpdateTimestampsCache - starting update timestamps cache at region: net.sf.hibernate.cache.UpdateTimestampsCache
2004-04-14 10:45:22,199 QueryCache - starting query cache at region: net.sf.hibernate.cache.QueryCache
2004-04-14 10:45:22,199 Persister - Perister for id='123'
2004-04-14 10:45:22,199 TestUserSession - The values are being set
2004-04-14 10:45:22,293 SessionImpl - opened session
2004-04-14 10:45:22,293 Cascades - id unsaved-value: 0
2004-04-14 10:45:22,293 SessionImpl - saveOrUpdate() unsaved instance
2004-04-14 10:45:22,293 BatcherImpl - about to open: 0 open PreparedStatements, 0 open ResultSets
2004-04-14 10:45:22,293 DriverManagerConnectionProvider - total checked-out connections: 0
2004-04-14 10:45:22,293 DriverManagerConnectionProvider - using pooled JDBC connection, pool size: 0
2004-04-14 10:45:22,293 SQL - select QS_User_Session_S.nextval from dual
Hibernate: select QS_User_Session_S.nextval from dual
2004-04-14 10:45:22,308 BatcherImpl - preparing statement
2004-04-14 10:45:22,355 SequenceGenerator - Sequence identifier generated: 84
2004-04-14 10:45:22,355 BatcherImpl - done closing: 0 open PreparedStatements, 0 open ResultSets
2004-04-14 10:45:22,355 BatcherImpl - closing statement
2004-04-14 10:45:22,355 SessionImpl - generated identifier: 84
2004-04-14 10:45:22,355 SessionImpl - saving [com.sas.mis.qs.data.UserSession#84]
2004-04-14 10:45:22,355 Cascades - processing cascades for: com.sas.mis.qs.data.UserSession
2004-04-14 10:45:22,355 Cascades - done processing cascades for: com.sas.mis.qs.data.UserSession
2004-04-14 10:45:22,371 Cascades - processing cascades for: com.sas.mis.qs.data.UserSession
2004-04-14 10:45:22,371 Cascades - cascading to collection: com.sas.mis.qs.data.UserSession.user
2004-04-14 10:45:22,371 Persister - Failed to insert/update.
java.lang.ClassCastException
at net.sf.hibernate.type.PersistentCollectionType.getElementsIterator(PersistentCollectionType.java:103)
at net.sf.hibernate.engine.Cascades.getLoadedElementsIterator(Cascades.java:557)
at net.sf.hibernate.engine.Cascades.access$200(Cascades.java:28)
at net.sf.hibernate.engine.Cascades$4.getCascadableChildrenIterator(Cascades.java:118)
at net.sf.hibernate.engine.Cascades.cascadeCollection(Cascades.java:525)
at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:452)
at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:503)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:925)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:839)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:761)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:720)
at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1359)
at com.sas.mis.qs.data.Persister.persist(Persister.java:168)
at com.sas.mis.qs.data.Persister.insert(Persister.java:191)
at com.sas.mis.qs.test.TestUserSession.testInsertUserSession(TestUserSession.java:53)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:392)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:276)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:167)
2004-04-14 10:45:22,371 SessionImpl - closing session
2004-04-14 10:45:22,387 SessionImpl - disconnecting session
2004-04-14 10:45:22,387 DriverManagerConnectionProvider - returning connection to pool, pool size: 1
2004-04-14 10:45:22,387 SessionImpl - transaction completion