Folks,
OK, I have mapping:
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.i21.eQuote.model.ApplicantBO" table="EAPPLICANT" schema="EQTDEV">
<id name="applicantId" column="EAPPLICANT_ID">
<generator class="identity"/>
</id>
<component name="homePhone" class="com.i21.eQuote.model.PhoneNumberBO">
<property name="phoneNumber" column="HOME_PHONE_NBR"/>
</component>
<list name="viewedProducts" table="VIEWED_PRODUCT" cascade="all">
<key column="EAPPLICANT_ID"/>
<index column="VIEWED_PRODUCT_SEQ_NBR"/>
<element column="PRODUCT_ID" type="string"/>
</list>
<property name="ratePlan" column="RATE_PLAN"/>
<property name="password" column="ACCT_PASSWORD_TXT"/>
<component name="residentialAddress" class="com.i21.eQuote.model.AddressBO">
<property name="street1" column="RES_ADDR_NAME"/>
<property name="street2" column="RESIDENT_UNIT"/>
<property name="city" column="RES_CITY_NAME"/>
<property name="geoState" column="RES_STATE_NAME"/>
<property name="postal" column="RES_ZIP_CODE"/>
</component>
<component name="referrer" class="com.i21.eQuote.model.ReferrerBO">
<property name="firstName" column="REFERRAL_FIRST_NAME"/>
<property name="lastName" column="REFERRAL_LAST_NAME"/>
<property name="mi" column="REFERRAL_MIDDLE_INITIAL"/>
<property name="phoneNumber" column="REFERRAL_PHONE_NBR"/>
<property name="policyNumber" column="REFERRAL_POLICY_NBR"/>
</component>
<property name="postQuoteEmailStatusCode" column="POST_QUOTE_EMAIL_STATUS"/>
<list name="promotions" table="PROMOTION" cascade="all">
<key column="EAPPLICANT_ID"/>
<index column="PROMOTION_SEQ_NBR"/>
<one-to-many class="com.i21.eQuote.model.PromotionBO"/>
</list>
<property name="permitEmail" column="PERMIT_SPAM_FLG"/>
<property name="allowCreditReport" column="PERMIT_CREDIT_RPT_FLG"/>
<property name="referred" column="REFERRAL_FLG"/>
<component name="mailingAddress" class="com.i21.eQuote.model.AddressBO">
<property name="street1" column="MAIL_ADDR_NAME"/>
<property name="street2" column="MAILING_UNIT"/>
<property name="city" column="MAIL_CITY_NAME"/>
<property name="geoState" column="MAIL_STATE_NAME"/>
<property name="postal" column="MAIL_ZIP_CODE"/>
</component>
<property name="email" column="EMAIL_ADDRESS_TXT"/>
<list name="quotes" table="EQUOTE" cascade="all">
<key column="EAPPLICANT_ID"/>
<index column="EQUOTE_SEQ_NBR"/>
<one-to-many class="com.i21.eQuote.model.QuoteBO"/>
</list>
<set name="sourceCodes" table="SOURCE_CODE" cascade="all" sort="com.i21.eQuote.util.SourceCodeComparer">
<key column="EAPPLICANT_ID"/>
<one-to-many class="com.i21.eQuote.model.SourceCodeBO"/>
</set>
</class>
</hibernate-mapping>
And I have my AddressBO class:
Code:
public class AddressBO extends EQuoteBaseBO
{
public static final long serialVersionUID = 12345L;
private String city;
private String geoState;
private String postal;
private String street1;
private String street2;
public AddressBO()
{
}
public AddressBO(
String street1,
String street2,
String city,
String geoState,
String postal)
{
this.street1 = street1;
this.street2 = street2;
this.city = city;
this.geoState = geoState;
this.postal = postal;
}
public String getCity()
{
return city;
}
public String getGeoState()
{
return geoState;
}
public String getPostal()
{
return postal;
}
public String getStreet1()
{
String value = (null == street1) ? "" : street1;
return value;
}
public String getStreet2()
{
String value = (null == street2) ? "" : street2;
return value;
}
/**
* The leading digits of street1 or an empty string if none. Possibly empty,
* but never null.
*/
public String getStreetNumber()
{
String result = extractFromStreet1("/^([\\d]*)/");
return result;
}
/**
* The text of street1 between any leading digits and any trailing digits
* (and a possible #). Possibly empty, but never null.
*/
public String getStreetName()
{
String result = extractFromStreet1("/^[\\d]*\\s([A-Za-z\\s\\.-]*)/");
return result;
}
public void setCity(String value)
{
if (getLog().isDebugEnabled())
{
getLog().debug("value = " + value);
}
city = value;
}
public void setGeoState(String value)
{
if (getLog().isDebugEnabled())
{
getLog().debug("value = " + value);
}
geoState = value;
}
public void setPostal(String value)
{
if (getLog().isDebugEnabled())
{
getLog().debug("value = " + value);
}
postal = value;
}
public void setStreet1(String value)
{
if (getLog().isDebugEnabled())
{
getLog().debug("value = " + value);
}
street1 = value;
}
public void setStreet2(String value)
{
if (getLog().isDebugEnabled())
{
getLog().debug("value = " + value);
}
street2 = value;
}
protected String extractFromStreet1(String pattern)
{
String result = "";
String street1 = getStreet1();
Perl5Util regex = new Perl5Util();
boolean foundMatch = regex.match(pattern, street1);
if (foundMatch)
{
result = regex.group(1).trim();
}
return result;
}
}
This gets me "rethrown as net.sf.hibernate.PropertyAccessException: IllegalArgumentException occurred calling: object is not an instance of declaring class getter of com.i21.eQuote.model.AddressBO.street1"
I'm afraid I'm baffled. Any advice would be greatly appreciated.