Many-To-Many mapping
Sorry for the length of this submission, but I am at my wits end trying to make this work.
I am currently attempting to evaluate Hibernate as a general solution
for my client. They have been interested in EJB/CMP for data
persistence, but the more I look at Hibernate, the more impressive it
becomes.
The problem is this: my client currently uses association tables
extensively. This means that if we use EJB/CMP we have to create a
'holder' object to hold the composite key for say Party < -- > Address, and
because now we have a collection of the key objects, rather than the collection of the referenced objects, things get messy.
However, using Hibernate:
I am attempting to map the Party<-->Address relationship using
composite identifiers according to the directions in the Hibernate
2.1.2 reference manual section 7.4 (p55). Apparently, (at least, what I can tell from the log output) the mapping documents are being compiled correctly.
If we use an association table of the form:
Code:
Party table
= = = = = = = = = = = = = = = = = =
PARTYID (BIGINT) | PARTYTYPE (INT)
Address table
= = = = = = = = = = = = = = = = = =
ADDRID (BIGINT/NOTNULL) |OTHER COLUMNS FOR ADDRESS . . .
AssocParty2Address
= = = = = = = = = = = = = = = = = =
FKPARTYID (BIGINT/FOREIGN/NOT NULL) | FKADDRID(BIGINT/FOREIGN/NOT NULL)
However, at run time, any time I attempt to add either the Set of parties or addresses,
a NullPointerException is being thrown because the field holding the set of parties or addresses
is null. I did NOT initialize the Set upon a get because the documentation specifically
states: "Furthermore, the Java type of a property must be the interface type...
This restriction exists because...Hibernate sneakily replaces of Map,Set, and
List with its own persistent implementations." (p43)
If I represent the Party <--> Address relationship above using a Party foreign key on the address table,
it (of course) works fine, except that I was getting duplicate entries into the Assoc table. (One from the
Party side, one from the Address side.)
But the client doesnt like to model relationships like this, because of (1) duplicate
rows, (2) many-to-many relationships.
Here are the mapping documents. Note that I have essentially two map documents, one for the class
and one for the interface that it represents. I want to be able to return or set an object based on the
interface and not the implementation class.
Obviously, I am missing something. If anyone could tell me where I got messed up, I would
greatly appreciate it.
Thanks in advance.
Michael
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<!--
Address is the implementation class.
$Id: Address.hbm.xml,v 1.5.2.1 2004/04/27 20:30:48 emm Exp $
-->
<hibernate-mapping>
<class
name="org.srs.domain.Address"
table="ECP.ADDRESS" >
<id
name="addressID"
type="long"
unsaved-value="any"
column="ADDR_ID">
<generator class="native" />
</id>
<set
name="parties"
table="ECP.ASSC_PTY_ADDR"
inverse="true"
lazy="true" >
<key column="ptyAddrId" />
<many-to-many
class="org.srs.db.PtyAddrComposite">
<column name="FK_PTY_ID" />
<column name="FK_ADDR_ID" />
</many-to-many>
</set>
<property
name="addrType"
column="ADDR_TYPE"
not-null="true" />
<property
name="line1"
column="STREET1"
not-null="true" />
<property
name="line2"
column="STREET2"
not-null="false" />
<property
name="city"
column="CITY"
not-null="true" />
<property
name="state"
column="STATE"
not-null="true" />
<property
name="strNum"
column="STR_NUM"
not-null="true" />
<property
name="zip1"
column="POSTAL_CODE1"
not-null="true" />
<property
name="zip2"
column="POSTAL_CODE2"
not-null="false" />
</class>
</hibernate-mapping>
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<!--
Party is the implementation class.
$Id: Party.hbm.xml,v 1.8.2.1 2004/04/27 20:30:48 emm Exp $
-->
<hibernate-mapping package="org.srs.domain" >
<class name="org.srs.domain.Party" table="ECP.PARTY" >
<id name="partyID"
type="long"
column="PARTY_ID"
unsaved-value="any" >
<generator
class="native"/>
</id>
<property
name="partyType"
type="integer"
column="PARTY_TYPE"/>
<set
name="addresses"
table="ECP.ASSC_PTY_ADDR"
inverse="true"
lazy="true" >
<key column="ptyAddrId" />
<many-to-many class="org.srs.db.PtyAddrComposite">
<column name="FK_PTY_ID" />
<column name="FK_ADDR_ID" />
</many-to-many>
</set>
<joined-subclass name="org.srs.domain.Person"
extends="org.srs.domain.Party"
table="ECP.PERSON">
<key column="ID" />
<property
name="dob"
type="date"
not-null="true"
column="DOB"/>
<property
name="name"
type="string"
not-null="true"
length="30"
column="NAME" />
<property
name="LName"
type="string"
not-null="true"
length="30"
column="LNAME" />
<property
name="sex"
type="string"
not-null="true"
length="1"
column="SEX" />
<property
name="SSN"
type="string"
not-null="true"
length="10"
column="SSN" />
</joined-subclass>
</class>
</hibernate-mapping>
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<!--
SRSAddress is the interface for the Address implementation.
$Id: SRSAddress.hbm.xml,v 1.1.2.1 2004/04/27 20:30:49 emm Exp $
-->
<hibernate-mapping>
<class
name="org.srs.domain.SRSAddress"
table="ECP.ADDRESS" >
<id
name="addressID"
type="long"
unsaved-value="any"
column="ADDR_ID">
<generator class="native" />
</id>
<set
name="parties"
table="ECP.ASSC_PTY_ADDR"
inverse="true"
lazy="true" >
<key column="ptyAddrId" />
<many-to-many
class="org.srs.db.PtyAddrComposite">
<column name="FK_PTY_ID" />
<column name="FK_ADDR_ID" />
</many-to-many>
</set>
<property
name="addrType"
column="ADDR_TYPE"
not-null="true" />
<property
name="line1"
column="STREET1"
not-null="true" />
<property
name="line2"
column="STREET2"
not-null="false" />
<property
name="city"
column="CITY"
not-null="true" />
<property
name="state"
column="STATE"
not-null="true" />
<property
name="strNum"
column="STR_NUM"
not-null="true" />
<property
name="zip1"
column="POSTAL_CODE1"
not-null="true" />
<property
name="zip2"
column="POSTAL_CODE2"
not-null="false" />
</class>
</hibernate-mapping>
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<!--
SRSParty is the interface for the Party implementation class.
$Id: SRSParty.hbm.xml,v 1.1.2.1 2004/04/27 20:30:49 emm Exp $
-->
<hibernate-mapping package="org.srs.domain" >
<class name="SRSParty" table="ECP.PARTY" >
<id name="partyID"
type="long"
column="PARTY_ID"
unsaved-value="any" >
<generator
class="native"/>
</id>
<property
name="partyType"
type="integer"
column="PARTY_TYPE"/>
<set
name="addresses"
table="ECP.ASSC_PTY_ADDR"
inverse="true"
lazy="true" >
<key column="ptyAddrId" />
<many-to-many
class="org.srs.db.PtyAddrComposite" >
<column name="FK_PTY_ID" />
<column name="FK_ADDR_ID" />
</many-to-many>
</set>
</class>
</hibernate-mapping>
------------------------
Classes follow:
------------------------
Code:
/*
* Created on Apr 27, 2004
*
*/
package org.srs.db;
/**
* The purpose of this class is to represent the <i>directional </i>
* relationship between Party and Address.
*
* @author emm
*/
public class PtyAddrComposite implements java.io.Serializable {
Long partyID = null;
Long addrID = null;
Integer addrType = null;
PtyAddrComposite ptyAddrID = null;
public PtyAddrComposite() {
}
/**
* @return Returns Long.
*/
public Long getAddrID() {
return addrID;
}
/**
* @param Long --
* Set addrID.
*/
public void setAddrID(Long addrID) {
this.addrID = addrID;
}
/**
* @return Returns Long.
*/
public Long getPartyID() {
return partyID;
}
/**
* @param Long --
* Set partyID.
*/
public void setPartyID(Long partyID) {
this.partyID = partyID;
}
/**
* @return Returns Integer.
*/
public Integer getAddrType() {
return addrType;
}
/**
* @param Integer --
* Set addrType.
*/
public void setAddrType(Integer addrType) {
this.addrType = addrType;
}
public boolean equals(Object o) {
if (o == null)
return false;
if (o instanceof PtyAddrComposite) {
PtyAddrComposite ptc = (PtyAddrComposite) o;
if ((this.getAddrID().equals(ptc.getAddrID()))
&& (this.getPartyID().equals(ptc.getPartyID())))
return true;
}
return false;
}
public int hashCode() {
if ((getPartyID() == null) || (getAddrID() == null))
return super.hashCode();
return (getAddrID().hashCode() + getPartyID().hashCode());
}
/**
* @return Returns Long.
*/
public PtyAddrComposite getPtyAddrId() {
return ptyAddrID;
}
/**
* @param Long -- Set ptyAddrID.
*/
public void setPtyAddrId(PtyAddrComposite ptyAddrID) {
this.ptyAddrID = ptyAddrID;
}
}
------------------------------------------------
package org.srs.domain;
/**
* @author emm --
*/
import java.util.Set;
public class Address extends SRSDomainObj implements SRSAddress {
private static final String CID = "DO NOT REMOVE THIS LINE -- $Id: Address.java,v 1.5 2004/04/23 20:21:21 emm Exp $";
private Long partyID;
// private Party party;
private Long addressID;
private int addrType;
private String strNum;
private String line1;
private String line2;
private String city;
private String state;
private String zip1;
private String zip2;
private Set parties;
public Address() {
addrType = SRSAddress.UNDEFINED;
}
public Address(
int aType,
String strNum,
String l1,
String city,
String state,
String zip1,
String zip2) {
setAddrType(aType);
setStrNum(strNum);
setLine1(l1);
setCity(city);
setState(state);
setZip1(zip1);
setZip2(zip2);
}
public boolean equals(Object o) {
if (o instanceof Address) {
if (o == this)
return true;
Address anAddress = (Address) o;
if (anAddress.getAddressID() == this.getAddressID())
return true;
boolean compare[] = new boolean[6];
for (int i = 0; i < 6; i++)
compare[i] = false;
if (this.getStrNum() != null) {
compare[0] = getStrNum().equalsIgnoreCase(anAddress.getStrNum());
}
if (this.getLine1() != null) {
compare[1] = getLine1().equalsIgnoreCase(anAddress.getLine1());
}
if (this.getCity() != null) {
compare[2] = getCity().equalsIgnoreCase(anAddress.getCity());
}
if (this.getState() != null) {
compare[3] = getState().equalsIgnoreCase(anAddress.getState());
}
if (this.getZip1() != null) {
compare[4] = getZip1().equalsIgnoreCase(anAddress.getZip1());
}
if (this.getZip2() != null) {
compare[5] = getZip2().equalsIgnoreCase(anAddress.getZip2());
}
for (int j = 0; j < 6; j++) {
if (!compare[j])
return false;
}
return true;
}
return false;
}
/**
* @see org.srs.domain.SRSAddress#getLine1()
*/
public String getLine1() {
return line1;
}
/**
* @see org.srs.domain.SRSAddress#getCity()
*/
public String getCity() {
return city;
}
/**
* @see org.srs.domain.SRSAddress#getState()
*/
public String getState() {
return state;
}
/**
* @see org.srs.domain.SRSAddress#setLine1(String)
*/
public void setLine1(String aLine) {
this.line1 = aLine;
}
/**
* @see org.srs.domain.SRSAddress#setState(String)
*/
public void setState(String state) {
this.state = state;
}
/**
* Returns the addrType.
*
* @return int
*/
public int getAddrType() {
return addrType;
}
/**
* Returns the strNum.
*
* @return String
*/
public String getStrNum() {
return strNum;
}
/**
* Returns the zip1.
*
* @return String
*/
public String getZip1() {
return zip1;
}
/**
* Returns the zip2.
*
* @return String
*/
public String getZip2() {
return zip2;
}
/**
* Sets the addrType.
*
* @param addrType
* The addrType to set
*/
public void setAddrType(int addrType) {
this.addrType = addrType;
}
/**
* Sets the strNum.
*
* @param strNum
* The strNum to set
*/
public void setStrNum(String strNum) {
this.strNum = strNum;
}
/**
* Sets the zip1.
*
* @param zip1
* The zip1 to set
*/
public void setZip1(String zip1) {
this.zip1 = zip1;
}
/**
* Sets the zip2.
*
* @param String
* The zip2 to set
*/
public void setZip2(String zip2) {
this.zip2 = zip2;
}
/**
* Sets the city.
*
* @param String
* The city to set
*/
public void setCity(String city) {
this.city = city;
}
/**
* Returns the addressID.
*
* @return int
*/
public Long getAddressID() {
return addressID;
}
/**
* Sets the addressID.
*
* @param addressID
* The addressID to set
*/
public void setAddressID(Long addressID) {
this.addressID = addressID;
}
/**
* @return Returns the line2.
*/
public String getLine2() {
return line2;
}
/**
* @param line2
* The line2 to set.
*/
public void setLine2(String line2) {
this.line2 = line2;
}
public String printOn(int tab, String s) {
StringBuffer sb = new StringBuffer(s);
StringBuffer sb1 = new StringBuffer();
sb.append("\n ");
for (int u = 0; u < tab; u++) {
sb1.append("\t");
}
switch (this.getAddrType()) {
case SRSAddress.HOME :
sb.append(sb1).append("HOME ADDRESS: \n");
break;
case SRSAddress.WORK :
sb.append(sb1).append("WORK ADDRESS: \n");
break;
default :
sb.append(sb1).append("Other: " + this.getAddrType()+ "\n");
break;
}
sb.append(sb1).append("Street Number: "+ this.getStrNum()+"\n");
sb.append(sb1).append(" Street: "+ this.getLine1()+"\n");
sb.append(sb1).append(" City: "+ this.getCity()+"\n");
sb.append(sb1).append(" State: "+ this.getState()+"\n");
sb.append(sb1).append(" Zip Code: "+ this.getZip1()+"-"+this.getZip2()+"\n");
return (sb.toString());
}
public boolean addParty(SRSParty p){
return (getParties().add(p));
}
public boolean removeParty(SRSParty p){
return ((parties==null)? false : parties.remove(p));
}
/**
* @return Returns a Set of SRSParty.
*/
public Set getParties() {
return parties;
}
/**
* @param Set -- the Set of SRSParty.
*/
public void setParties(Set parties) {
this.parties = parties;
}
}
/*
* Created on 2004.04.01
*/
package org.srs.domain;
/**
*
*/
import java.util.Set;
public abstract class Party extends SRSDomainObj implements SRSParty {
public static final String CID = "DO NOT REMOVE THIS LINE -- $Id: Party.java,v 1.7 2004/04/23 20:21:22 emm Exp $";
Long partyID;
Integer partyType;
Set addresses;
public Party(Integer type) {
this();
this.setPartyType(type);
}
public Party() {
this.setPartyType(new Integer(SRSParty.UNDEFINED));
partyID = null;
addresses = null;
}
/**
* @return long. Returns the partyID.
*/
public Long getPartyID() {
return partyID;
}
/**
* @param long. The partyID to Set.
*/
public void setPartyID(Long partyID) {
this.partyID = partyID;
}
/**
* @return int. Returns the partyType.
*/
public Integer getPartyType() {
return partyType;
}
/**
* @return Returns Set -- of addresses.
*/
public Set getAddresses() {
return addresses;
}
/**
* @param Set -- Set the Set of addresses.
*/
public void setAddresses(Set addresses) {
this.addresses = addresses;
}
/**
* @param int. The partyType to set.
*/
public void setPartyType(Integer partyType) {
this.partyType = partyType;
}
/**
* Add an address. current implementation is to add this to the address
* before adding it to the collection.
* @see org.srs.domain.SRSParty#addAddress(org.srs.domain.SRSAddress)
*/
public boolean addAddress(SRSAddress anAddr) {
anAddr.addParty(this);
return (getAddresses().add(anAddr));
}
/**
* Remove the specified address.
* @see org.srs.domain.SRSParty#removeAddress(org.srs.domain.SRSAddress)
*/
public boolean removeAddress(SRSAddress anAddr){
return ((addresses==null)? false : addresses.remove(anAddr));
}
}
package org.srs.domain;
/**
* @author emm
*/
import java.util.Set;
public interface SRSAddress {
//
public final static String IID = "DO NOT REMOVE THIS LINE -- $Id: SRSAddress.java,v 1.6.4.1 2004/04/27 20:29:25 emm Exp $";
public final static int HOME = 10;
public final static int WORK = 20;
public final static int CAREOF = 30;
public final static int BUSINESS_LOC = 40;
public final static int UNDEFINED = Integer.MIN_VALUE;
//
//
public Long getAddressID();
public int getAddrType();
public void setAddrType(int addressType);
public String getStrNum();
public String getLine1();
public String getLine2();
public String getCity();
public String getState();
public String getZip1();
public String getZip2();
public void setAddressID(Long anID);
public void setStrNum(String strnum);
public void setLine1(String line);
public void setLine2(String line);
public void setCity(String c);
public void setState(String st);
public void setZip1(String z1);
public void setZip2(String z2);
public boolean addParty(SRSParty p);
public boolean removeParty(SRSParty p);
public Set getParties();
public void setParties(Set parties);
}
/*
*/
package org.srs.domain;
/**
* @author E. M. McConnell, Perficient
*
* A Party is any person or organization of interest to an ECP business process
* and captured as part of that process. In other words, a Party can be a Customer,
* dependent of a customer, an employee of SRS or an SRS contractor, a vendor, or a vendor's
* employee, etc.
*/
import java.util.Set;
public interface SRSParty extends SRS
{
public static final String IID = "DO NOT REMOVE THIS LINE -- $Id: SRSParty.java,v 1.5 2004/04/23 20:21:24 emm Exp $";
public final static int UNDEFINED = Integer.MIN_VALUE;
public final static int SRS_POI = 100;
public final static int SRS_CUST = 200;
public final static int SRS_EMP = 300;
public final static int SRS_CONTRACTOR = 400;
public final static int SRS_VENDOR = 500;
public final static int KS_GOV_UNIT = 1000;
public final static int KS_GOV_SRS = 1010;
public final static int US_GOV_UNIT = 5000;
/**
*
* @return Long. Return the id of this party.
*/
public Long getPartyID();
/**
* Set the id of this party.
* @param Long.
*/
public void setPartyID(Long id);
/**
* Return the Party type (what kind of party).
* @return int
*/
public Integer getPartyType();
/**
* Set the kind of party.
* @param Integer.
*/
public void setPartyType(Integer type);
/**
*
* @return Set - a Set of addresses associated with this Party.
*/
public Set getAddresses();
/**
*
* @param Set -- Set of addresses.
*/
public void setAddresses(Set aSet);
/**
* Add an SRSAddress to this Party.
* @param SRSAddress
*/
public boolean addAddress(SRSAddress addr);
/**
*
* @param SRSAddress
* @return false if not removed.
*/
public boolean removeAddress(SRSAddress addr);
}
--------------------------------------------------
Log and stack trace follow:
Code:
11:17:51,908 INFO Binder:229 - Mapping class: org.srs.db.PtyAddrComposite -> ECP.ASSC_PTY_ADDR
2554 [main] INFO net.sf.hibernate.cfg.Binder - Mapping class: org.srs.db.PtyAddrComposite -> ECP.ASSC_PTY_ADDR
11:17:51,908 DEBUG Binder:475 - Mapped property: partyID -> FK_PTY_ID, type: long
2554 [main] DEBUG net.sf.hibernate.cfg.Binder - Mapped property: partyID -> FK_PTY_ID, type: long
11:17:51,918 DEBUG Binder:475 - Mapped property: addrID -> FK_ADDR_ID, type: long
2564 [main] DEBUG net.sf.hibernate.cfg.Binder - Mapped property: addrID -> FK_ADDR_ID, type: long
11:17:52,459 DEBUG Binder:475 - Mapped property: ptyAddrId -> FK_PTY_ID, FK_ADDR_ID, type: org.srs.db.PtyAddrComposite
3105 [main] DEBUG net.sf.hibernate.cfg.Binder - Mapped property: ptyAddrId -> FK_PTY_ID, FK_ADDR_ID, type: org.srs.db.PtyAddrComposite
11:17:52,459 INFO Configuration:615 - processing one-to-many association mappings
3105 [main] INFO net.sf.hibernate.cfg.Configuration - processing one-to-many association mappings
11:17:52,459 DEBUG Binder:1340 - Second pass for collection: org.srs.domain.SRSAddress.parties
3105 [main] DEBUG net.sf.hibernate.cfg.Binder - Second pass for collection: org.srs.domain.SRSAddress.parties
11:17:52,469 DEBUG Binder:1355 - Mapped collection key: ptyAddrId, element: FK_PTY_ID, FK_ADDR_ID, type: org.srs.db.PtyAddrComposite
3115 [main] DEBUG net.sf.hibernate.cfg.Binder - Mapped collection key: ptyAddrId, element: FK_PTY_ID, FK_ADDR_ID, type: org.srs.db.PtyAddrComposite
11:17:52,479 DEBUG Binder:1340 - Second pass for collection: org.srs.domain.SRSParty.addresses
3125 [main] DEBUG net.sf.hibernate.cfg.Binder - Second pass for collection: org.srs.domain.SRSParty.addresses
11:17:52,479 DEBUG Binder:1355 - Mapped collection key: ptyAddrId, element: FK_PTY_ID, FK_ADDR_ID, type: org.srs.db.PtyAddrComposite
3125 [main] DEBUG net.sf.hibernate.cfg.Binder - Mapped collection key: ptyAddrId, element: FK_PTY_ID, FK_ADDR_ID, type: org.srs.db.PtyAddrComposite
11:17:52,489 DEBUG Binder:1340 - Second pass for collection: org.srs.domain.Address.parties
3135 [main] DEBUG net.sf.hibernate.cfg.Binder - Second pass for collection: org.srs.domain.Address.parties
11:17:52,489 DEBUG Binder:1355 - Mapped collection key: ptyAddrId, element: FK_PTY_ID, FK_ADDR_ID, type: org.srs.db.PtyAddrComposite
3135 [main] DEBUG net.sf.hibernate.cfg.Binder - Mapped collection key: ptyAddrId, element: FK_PTY_ID, FK_ADDR_ID, type: org.srs.db.PtyAddrComposite
11:17:52,489 DEBUG Binder:1340 - Second pass for collection: org.srs.domain.Party.addresses
3135 [main] DEBUG net.sf.hibernate.cfg.Binder - Second pass for collection: org.srs.domain.Party.addresses
11:17:52,499 DEBUG Binder:1355 - Mapped collection key: ptyAddrId, element: FK_PTY_ID, FK_ADDR_ID, type: org.srs.db.PtyAddrComposite
3145 [main] DEBUG net.sf.hibernate.cfg.Binder - Mapped collection key: ptyAddrId, element: FK_PTY_ID, FK_ADDR_ID, type: org.srs.db.PtyAddrComposite
11:17:52,499 INFO Configuration:624 - processing one-to-one association property references
3145 [main] INFO net.sf.hibernate.cfg.Configuration - processing one-to-one association property references
11:17:52,499 INFO Configuration:649 - processing foreign key constraints
3145 [main] INFO net.sf.hibernate.cfg.Configuration - processing foreign key constraints
11:17:52,509 DEBUG Configuration:659 - resolving reference to class: org.srs.domain.Party
3155 [main] DEBUG net.sf.hibernate.cfg.Configuration - resolving reference to class: org.srs.domain.Party
11:17:52,559 INFO Dialect:82 - Using dialect: net.sf.hibernate.dialect.DB2Dialect
3205 [main] INFO net.sf.hibernate.dialect.Dialect - Using dialect: net.sf.hibernate.dialect.DB2Dialect
11:17:52,569 INFO SettingsFactory:58 - Maximim outer join fetch depth: 1
3215 [main] INFO net.sf.hibernate.cfg.SettingsFactory - Maximim outer join fetch depth: 1
11:17:52,569 INFO SettingsFactory:62 - Use outer join fetching: true
3215 [main] INFO net.sf.hibernate.cfg.SettingsFactory - Use outer join fetching: true
11:17:52,569 INFO DriverManagerConnectionProvider:42 - Using Hibernate built-in connection pool (not for production use!)
3215 [main] INFO net.sf.hibernate.connection.DriverManagerConnectionProvider - Using Hibernate built-in connection pool (not for production use!)
11:17:52,569 INFO DriverManagerConnectionProvider:43 - Hibernate connection pool size: 1
3215 [main] INFO net.sf.hibernate.connection.DriverManagerConnectionProvider - Hibernate connection pool size: 1
11:17:52,569 INFO DriverManagerConnectionProvider:77 - using driver: COM.ibm.db2.jdbc.app.DB2Driver at URL: jdbc:db2:ECP_DB
3215 [main] INFO net.sf.hibernate.connection.DriverManagerConnectionProvider - using driver: COM.ibm.db2.jdbc.app.DB2Driver at URL: jdbc:db2:ECP_DB
11:17:52,569 INFO DriverManagerConnectionProvider:78 - connection properties: {user=db2admin, password=db2admin}
3215 [main] INFO net.sf.hibernate.connection.DriverManagerConnectionProvider - connection properties: {user=db2admin, password=db2admin}
11:17:52,589 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
3235 [main] INFO net.sf.hibernate.transaction.TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
11:17:52,589 DEBUG DriverManagerConnectionProvider:84 - total checked-out connections: 0
3235 [main] DEBUG net.sf.hibernate.connection.DriverManagerConnectionProvider - total checked-out connections: 0
11:17:52,589 DEBUG DriverManagerConnectionProvider:100 - opening new JDBC connection
3235 [main] DEBUG net.sf.hibernate.connection.DriverManagerConnectionProvider - opening new JDBC connection
11:17:53,490 DEBUG DriverManagerConnectionProvider:106 - created connection to: jdbc:db2:ECP_DB, Isolation Level: 2
4136 [main] DEBUG net.sf.hibernate.connection.DriverManagerConnectionProvider - created connection to: jdbc:db2:ECP_DB, Isolation Level: 2
11:17:53,490 DEBUG DriverManagerConnectionProvider:120 - returning connection to pool, pool size: 1
4136 [main] DEBUG net.sf.hibernate.connection.DriverManagerConnectionProvider - returning connection to pool, pool size: 1
11:17:53,500 INFO SettingsFactory:102 - Use scrollable result sets: true
4146 [main] INFO net.sf.hibernate.cfg.SettingsFactory - Use scrollable result sets: true
11:17:53,500 INFO SettingsFactory:105 - Use JDBC3 getGeneratedKeys(): false
4146 [main] INFO net.sf.hibernate.cfg.SettingsFactory - Use JDBC3 getGeneratedKeys(): false
11:17:53,500 INFO SettingsFactory:108 - Optimize cache for minimal puts: false
4146 [main] INFO net.sf.hibernate.cfg.SettingsFactory - Optimize cache for minimal puts: false
11:17:53,500 INFO SettingsFactory:114 - echoing all SQL to stdout
4146 [main] INFO net.sf.hibernate.cfg.SettingsFactory - echoing all SQL to stdout
11:17:53,500 INFO SettingsFactory:117 - Query language substitutions: {no='N', true=1, yes='Y', false=0}
4146 [main] INFO net.sf.hibernate.cfg.SettingsFactory - Query language substitutions: {no='N', true=1, yes='Y', false=0}
11:17:53,500 INFO SettingsFactory:128 - cache provider: net.sf.hibernate.cache.HashtableCacheProvider
4146 [main] INFO net.sf.hibernate.cfg.SettingsFactory - cache provider: net.sf.hibernate.cache.HashtableCacheProvider
11:17:53,510 INFO Configuration:1095 - instantiating and configuring caches
4156 [main] INFO net.sf.hibernate.cfg.Configuration - instantiating and configuring caches
11:17:53,591 INFO SessionFactoryImpl:119 - building session factory
4237 [main] INFO net.sf.hibernate.impl.SessionFactoryImpl - building session factory
11:17:53,591 DEBUG SessionFactoryImpl:125 - instantiating session factory with properties: {java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, hibernate.connection.password=db2admin, hibernate.cache.provider_class=net.sf.hibernate.cache.HashtableCacheProvider, sun.boot.library.path=C:\Program Files\Java\j2re1.4.2_04\bin, java.vm.version=1.4.2_04-b05, hibernate.proxool.pool_alias=pool1, hibernate.connection.username=db2admin, java.vm.vendor=Sun Microsystems Inc., java.vendor.url=http://java.sun.com/, path.separator=;, hibernate.cache.use_query_cache=true, java.vm.name=Java HotSpot(TM) Client VM, file.encoding.pkg=sun.io, user.country=US, sun.os.patch.level=Service Pack 4, java.vm.specification.name=Java Virtual Machine Specification, user.dir=D:\workspace\ecp, java.runtime.version=1.4.2_04-b05, hibernate.jdbc.use_get_generated_keys=false, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, java.endorsed.dirs=C:\Program Files\Java\j2re1.4.2_04\lib\endorsed, os.arch=x86, java.io.tmpdir=C:\DOCUME~1\emm\LOCALS~1\Temp\, line.separator=
, java.vm.specification.vendor=Sun Microsystems Inc., user.variant=, os.name=Windows 2000, sun.java2d.fontpath=, java.library.path=C:\Program Files\Java\j2re1.4.2_04\bin;.;C:\WINNT\system32;C:\WINNT;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\PROGRAM FILES\THINKPAD\UTILITIES;C:\MSSQL7\BINN;c:\j2sdk1.4.2\bin;c\j2sdk1.4.2\jre\bin;d:\projects\ASF\ant-1.6.1\bin;D:\IBM\SQLLIB\BIN;D:\IBM\SQLLIB\FUNCTION;D:\IBM\SQLLIB\SAMPLES\REPL, hibernate.defaultSchema=ECP, java.specification.name=Java Platform API Specification, java.class.version=48.0, hibernate.connection.pool_size=1, java.util.prefs.PreferencesFactory=java.util.prefs.WindowsPreferencesFactory, os.version=5.0, user.home=C:\Documents and Settings\emm, user.timezone=America/Chicago, java.awt.printerjob=sun.awt.windows.WPrinterJob, file.encoding=Cp1252, java.specification.version=1.4, hibernate.connection.driver_class=COM.ibm.db2.jdbc.app.DB2Driver, java.class.path=D:\workspace\ecp\bin;D:\IBM\SQLLIB\java\db2java.zip;D:\projects\hibernate-2.1\lib\commons-collections-2.1.jar;D:\projects\hibernate-2.1\lib\commons-dbcp-1.1.jar;D:\projects\hibernate-2.1\lib\commons-lang-1.0.1.jar;D:\projects\hibernate-2.1\lib\commons-logging-1.0.3.jar;D:\projects\hibernate-2.1\lib\commons-pool-1.1.jar;D:\projects\hibernate-2.1\lib\concurrent-1.3.2.jar;D:\projects\hibernate-2.1\lib\connector.jar;D:\projects\hibernate-2.1\lib\dom4j-1.4.jar;D:\projects\hibernate-2.1\lib\ehcache-0.6.jar;D:\projects\hibernate-2.1\lib\jaas.jar;D:\projects\hibernate-2.1\lib\jboss-cache.jar;D:\projects\hibernate-2.1\lib\jboss-common.jar;D:\projects\hibernate-2.1\lib\jboss-jmx.jar;D:\projects\hibernate-2.1\lib\jboss-system.jar;D:\projects\hibernate-2.1\lib\jcs-1.0-dev.jar;D:\projects\hibernate-2.1\lib\jdbc2_0-stdext.jar;D:\projects\hibernate-2.1\lib\jgroups-2.2.jar;D:\projects\hibernate-2.1\lib\jta.jar;D:\projects\hibernate-2.1\lib\junit-3.8.1.jar;D:\projects\hibernate-2.1\lib\log4j-1.2.8.jar;D:\projects\hibernate-2.1\lib\odmg-3.0.jar;D:\projects\hibernate-2.1\lib\oscache-2.0.jar;D:\projects\hibernate-2.1\lib\proxool-0.8.3.jar;D:\projects\hibernate-2.1\lib\swarmcache-1.0rc2.jar;D:\projects\hibernate-2.1\lib\xalan-2.4.0.jar;D:\projects\hibernate-2.1\lib\xerces-2.4.0.jar;D:\projects\hibernate-2.1\lib\xml-apis.jar;D:\projects\ASF\ant-1.6.1\lib\ant.jar;D:\projects\hibernate-2.1\lib\c3p0-0.8.4.5.jar;D:\projects\hibernate-2.1\lib\cglib-full-2.0.1.jar;D:\projects\hibernate-2.1\lib\ehcache-0.7.jar;D:\projects\hibernate-2.1\lib\jgroups-2.2.1.jar, user.name=emm, hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N', hibernate.show_sql=true, java.vm.specification.version=1.0, java.home=C:\Program Files\Java\j2re1.4.2_04, sun.arch.data.model=32, hibernate.dialect=net.sf.hibernate.dialect.DB2Dialect, hibernate.connection.url=jdbc:db2:ECP_DB, user.language=en, java.specification.vendor=Sun Microsystems Inc., awt.toolkit=sun.awt.windows.WToolkit, hibernate.cglib.use_reflection_optimizer=true, java.vm.info=mixed mode, hibernate.jdbc.use_streams_for_binary=true, java.version=1.4.2_04, java.ext.dirs=C:\Program Files\Java\j2re1.4.2_04\lib\ext, sun.boot.class.path=C:\Program Files\Java\j2re1.4.2_04\lib\rt.jar;C:\Program Files\Java\j2re1.4.2_04\lib\i18n.jar;C:\Program Files\Java\j2re1.4.2_04\lib\sunrsasign.jar;C:\Program Files\Java\j2re1.4.2_04\lib\jsse.jar;C:\Program Files\Java\j2re1.4.2_04\lib\jce.jar;C:\Program Files\Java\j2re1.4.2_04\lib\charsets.jar;C:\Program Files\Java\j2re1.4.2_04\classes, java.vendor=Sun Microsystems Inc., hibernate.jdbc.batch_size=0, file.separator=\, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, sun.io.unicode.encoding=UnicodeLittle, sun.cpu.endian=little, hibernate.max_fetch_depth=1, sun.cpu.isalist=pentium i486 i386}
4237 [main] DEBUG net.sf.hibernate.impl.SessionFactoryImpl - instantiating session factory with properties: {java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, hibernate.connection.password=db2admin, hibernate.cache.provider_class=net.sf.hibernate.cache.HashtableCacheProvider, sun.boot.library.path=C:\Program Files\Java\j2re1.4.2_04\bin, java.vm.version=1.4.2_04-b05, hibernate.proxool.pool_alias=pool1, hibernate.connection.username=db2admin, java.vm.vendor=Sun Microsystems Inc., java.vendor.url=http://java.sun.com/, path.separator=;, hibernate.cache.use_query_cache=true, java.vm.name=Java HotSpot(TM) Client VM, file.encoding.pkg=sun.io, user.country=US, sun.os.patch.level=Service Pack 4, java.vm.specification.name=Java Virtual Machine Specification, user.dir=D:\workspace\ecp, java.runtime.version=1.4.2_04-b05, hibernate.jdbc.use_get_generated_keys=false, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, java.endorsed.dirs=C:\Program Files\Java\j2re1.4.2_04\lib\endorsed, os.arch=x86, java.io.tmpdir=C:\DOCUME~1\emm\LOCALS~1\Temp\, line.separator=
, java.vm.specification.vendor=Sun Microsystems Inc., user.variant=, os.name=Windows 2000, sun.java2d.fontpath=, java.library.path=C:\Program Files\Java\j2re1.4.2_04\bin;.;C:\WINNT\system32;C:\WINNT;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\PROGRAM FILES\THINKPAD\UTILITIES;C:\MSSQL7\BINN;c:\j2sdk1.4.2\bin;c\j2sdk1.4.2\jre\bin;d:\projects\ASF\ant-1.6.1\bin;D:\IBM\SQLLIB\BIN;D:\IBM\SQLLIB\FUNCTION;D:\IBM\SQLLIB\SAMPLES\REPL, hibernate.defaultSchema=ECP, java.specification.name=Java Platform API Specification, java.class.version=48.0, hibernate.connection.pool_size=1, java.util.prefs.PreferencesFactory=java.util.prefs.WindowsPreferencesFactory, os.version=5.0, user.home=C:\Documents and Settings\emm, user.timezone=America/Chicago, java.awt.printerjob=sun.awt.windows.WPrinterJob, file.encoding=Cp1252, java.specification.version=1.4, hibernate.connection.driver_class=COM.ibm.db2.jdbc.app.DB2Driver, java.class.path=D:\workspace\ecp\bin;D:\IBM\SQLLIB\java\db2java.zip;D:\projects\hibernate-2.1\lib\commons-collections-2.1.jar;D:\projects\hibernate-2.1\lib\commons-dbcp-1.1.jar;D:\projects\hibernate-2.1\lib\commons-lang-1.0.1.jar;D:\projects\hibernate-2.1\lib\commons-logging-1.0.3.jar;D:\projects\hibernate-2.1\lib\commons-pool-1.1.jar;D:\projects\hibernate-2.1\lib\concurrent-1.3.2.jar;D:\projects\hibernate-2.1\lib\connector.jar;D:\projects\hibernate-2.1\lib\dom4j-1.4.jar;D:\projects\hibernate-2.1\lib\ehcache-0.6.jar;D:\projects\hibernate-2.1\lib\jaas.jar;D:\projects\hibernate-2.1\lib\jboss-cache.jar;D:\projects\hibernate-2.1\lib\jboss-common.jar;D:\projects\hibernate-2.1\lib\jboss-jmx.jar;D:\projects\hibernate-2.1\lib\jboss-system.jar;D:\projects\hibernate-2.1\lib\jcs-1.0-dev.jar;D:\projects\hibernate-2.1\lib\jdbc2_0-stdext.jar;D:\projects\hibernate-2.1\lib\jgroups-2.2.jar;D:\projects\hibernate-2.1\lib\jta.jar;D:\projects\hibernate-2.1\lib\junit-3.8.1.jar;D:\projects\hibernate-2.1\lib\log4j-1.2.8.jar;D:\projects\hibernate-2.1\lib\odmg-3.0.jar;D:\projects\hibernate-2.1\lib\oscache-2.0.jar;D:\projects\hibernate-2.1\lib\proxool-0.8.3.jar;D:\projects\hibernate-2.1\lib\swarmcache-1.0rc2.jar;D:\projects\hibernate-2.1\lib\xalan-2.4.0.jar;D:\projects\hibernate-2.1\lib\xerces-2.4.0.jar;D:\projects\hibernate-2.1\lib\xml-apis.jar;D:\projects\ASF\ant-1.6.1\lib\ant.jar;D:\projects\hibernate-2.1\lib\c3p0-0.8.4.5.jar;D:\projects\hibernate-2.1\lib\cglib-full-2.0.1.jar;D:\projects\hibernate-2.1\lib\ehcache-0.7.jar;D:\projects\hibernate-2.1\lib\jgroups-2.2.1.jar, user.name=emm, hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N', hibernate.show_sql=true, java.vm.specification.version=1.0, java.home=C:\Program Files\Java\j2re1.4.2_04, sun.arch.data.model=32, hibernate.dialect=net.sf.hibernate.dialect.DB2Dialect, hibernate.connection.url=jdbc:db2:ECP_DB, user.language=en, java.specification.vendor=Sun Microsystems Inc., awt.toolkit=sun.awt.windows.WToolkit, hibernate.cglib.use_reflection_optimizer=true, java.vm.info=mixed mode, hibernate.jdbc.use_streams_for_binary=true, java.version=1.4.2_04, java.ext.dirs=C:\Program Files\Java\j2re1.4.2_04\lib\ext, sun.boot.class.path=C:\Program Files\Java\j2re1.4.2_04\lib\rt.jar;C:\Program Files\Java\j2re1.4.2_04\lib\i18n.jar;C:\Program Files\Java\j2re1.4.2_04\lib\sunrsasign.jar;C:\Program Files\Java\j2re1.4.2_04\lib\jsse.jar;C:\Program Files\Java\j2re1.4.2_04\lib\jce.jar;C:\Program Files\Java\j2re1.4.2_04\lib\charsets.jar;C:\Program Files\Java\j2re1.4.2_04\classes, java.vendor=Sun Microsystems Inc., hibernate.jdbc.batch_size=0, file.separator=\, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, sun.io.unicode.encoding=UnicodeLittle, sun.cpu.endian=little, hibernate.max_fetch_depth=1, sun.cpu.isalist=pentium i486 i386}
11:17:53,951 INFO ReflectHelper:176 - reflection optimizer disabled for: org.srs.domain.Party, InstantiationError: org.srs.domain.Party
4597 [main] INFO net.sf.hibernate.util.ReflectHelper - reflection optimizer disabled for: org.srs.domain.Party, InstantiationError: org.srs.domain.Party
11:17:54,452 DEBUG SessionFactoryObjectFactory:39 - initializing class SessionFactoryObjectFactory
5098 [main] DEBUG net.sf.hibernate.impl.SessionFactoryObjectFactory - initializing class SessionFactoryObjectFactory
11:17:54,462 DEBUG SessionFactoryObjectFactory:76 - registered: 2549435dfc31e86900fc31e86d0a0000 (unnamed)
5108 [main] DEBUG net.sf.hibernate.impl.SessionFactoryObjectFactory - registered: 2549435dfc31e86900fc31e86d0a0000 (unnamed)
11:17:54,462 INFO SessionFactoryObjectFactory:82 - no JNDI name configured
5108 [main] INFO net.sf.hibernate.impl.SessionFactoryObjectFactory - no JNDI name configured
11:17:54,462 DEBUG SessionFactoryImpl:196 - instantiated session factory
5108 [main] DEBUG net.sf.hibernate.impl.SessionFactoryImpl - instantiated session factory
11:17:54,472 INFO UpdateTimestampsCache:35 - starting update timestamps cache at region: net.sf.hibernate.cache.UpdateTimestampsCache
5118 [main] INFO net.sf.hibernate.cache.UpdateTimestampsCache - starting update timestamps cache at region: net.sf.hibernate.cache.UpdateTimestampsCache
11:17:54,472 INFO QueryCache:39 - starting query cache at region: net.sf.hibernate.cache.QueryCache
5118 [main] INFO net.sf.hibernate.cache.QueryCache - starting query cache at region: net.sf.hibernate.cache.QueryCache
java.lang.NullPointerException
at org.srs.domain.Address.addParty(Address.java:250)
at org.srs.domain.Party.addAddress(Party.java:72)
at org.srs.test.TestPersonWithAssignedIndices.main(TestPersonWithAssignedIndices.java:113)
11:17:54,482 INFO TestPersonWithAssignedIndices:149 - Session closed
5128 [main] INFO org.srs.test.TestPersonWithAssignedIndices - Session closed