On Wednesday, Feb 19, 2003, at 12:37 US/Eastern, Jason Hale wrote:

<reference-descriptor name="person"
		class-ref="com.wingate.us.db.Person" >
      <foreignkey field-ref="personID"/>
    </reference-descriptor>
First thing I noticed is that you don't have auto-retrieve=true here. Second you're using PersistenceBroker and I'm not, I'm using ODMG.


here is my full code for the XML and the pertinent method:


<class-descriptor class="com.lawton.business.HomeBO" table="HOMES">
<field-descriptor name="homeID" column="homeID" jdbc-type="INTEGER" autoincrement="true" primarykey="true" nullable="false"/>
<field-descriptor name="status" column="status" jdbc-type="VARCHAR" nullable="false"/>
<field-descriptor name="description" column="description" jdbc-type="VARCHAR" nullable="true"/>
<field-descriptor name="createDate" column="createDate" jdbc-type="TIMESTAMP" nullable="false"/>
<field-descriptor name="updateDate" column="updateDate" jdbc-type="TIMESTAMP" nullable="false"/>
<field-descriptor name="name" column="name" jdbc-type="VARCHAR" nullable="true"/>
<field-descriptor name="title" column="title" jdbc-type="VARCHAR" nullable="true"/>
<field-descriptor name="moreInfo" column="moreInfo" jdbc-type="VARCHAR" nullable="true"/>
<field-descriptor name="price" column="price" jdbc-type="DOUBLE" nullable="true"/>
<field-descriptor name="sqFootage" column="sqFootage" jdbc-type="INTEGER" nullable="true"/>
<field-descriptor name="featured" column="isFeatured" jdbc-type="VARCHAR" nullable="true"/>
<field-descriptor name="ownerLetter" column="ownerLetter" jdbc-type="VARCHAR" nullable="true"/>
<field-descriptor name="onMarketDate" column="onMarketDate" jdbc-type="DATE" nullable="true"/>
<field-descriptor name="featuredStartDate" column="featuredStartDate" jdbc-type="DATE" nullable="true"/>
<field-descriptor name="featuredEndDate" column="featuredEndDate" jdbc-type="DATE" nullable="true"/>
<field-descriptor name="offerDate" column="offerDate" jdbc-type="DATE" nullable="true"/>
<field-descriptor name="MLS" column="mls" jdbc-type="VARCHAR" nullable="true"/>
<collection-descriptor element-class-ref="com.lawton.business.BrokersToHomesBO" name="brokerHomesColl" auto-retrieve="true">
<inverse-foreignkey field-ref="homeID"/>
</collection-descriptor>
<collection-descriptor element-class-ref="com.lawton.business.AgentsToHomesBO" name="agentHomesColl" auto-retrieve="true">
<inverse-foreignkey field-ref="homeID"/>
</collection-descriptor>
<collection-descriptor element-class-ref="com.lawton.business.AmenitiesBO" name="amenityColl" auto-retrieve="true">
<inverse-foreignkey field-ref="homeID"/>
</collection-descriptor>
<collection-descriptor element-class-ref="com.lawton.business.DisclosureBO" name="disclosureColl" auto-retrieve="true">
<inverse-foreignkey field-ref="homeID"/>
</collection-descriptor>
<collection-descriptor element-class-ref="com.lawton.business.RoomBO" name="roomColl" auto-retrieve="true">
<inverse-foreignkey field-ref="homeID"/>
</collection-descriptor>
<collection-descriptor element-class-ref="com.lawton.business.VisitScheduleBO" name="visitColl" auto-retrieve="true">
<inverse-foreignkey field-ref="homeID"/>
</collection-descriptor>
</class-descriptor>

<class-descriptor class="com.lawton.business.BrokersToHomesBO" table="BROKERS_TO_HOMES">
<field-descriptor name="recordID" column="recordID" jdbc-type="INTEGER" primarykey="true" autoincrement="true"/>
<field-descriptor name="brokerID" column="brokerID" jdbc-type="INTEGER" nullable="false"/>
<field-descriptor name="homeID" column="homeID" jdbc-type="INTEGER" nullable="false"/>
<reference-descriptor name="brokerBO" class-ref="com.lawton.business.BrokerBO" auto-retrieve="true">
<foreignkey field-ref="brokerID"/>
</reference-descriptor>
<reference-descriptor name="homeBO" class-ref="com.lawton.business.HomeBO" auto-retrieve="true">
<foreignkey field-ref="homeID"/>
</reference-descriptor>
</class-descriptor>

<class-descriptor class="com.lawton.business.AgentsToHomesBO" table="AGENTS_TO_HOMES">
<field-descriptor name="recordID" column="recordID" jdbc-type="INTEGER" primarykey="true" autoincrement="true"/>
<field-descriptor name="agentID" column="agentID" jdbc-type="INTEGER" nullable="false"/>
<field-descriptor name="homeID" column="homeID" jdbc-type="INTEGER" nullable="false"/>
<reference-descriptor name="agentBO" class-ref="com.lawton.business.AgentBO" auto-retrieve="true">
<foreignkey field-ref="agentID"/>
</reference-descriptor>
<reference-descriptor name="homeBO" class-ref="com.lawton.business.HomeBO" auto-retrieve="true">
<foreignkey field-ref="homeID"/>
</reference-descriptor>
</class-descriptor>

public HomeDetailView selectHomeDetail( Integer homeID ) throws DataAccessException
{
List results = null;
HomeBO home = null;
HomeDetailView homeDet = null;
Transaction tx = null;
try
{
tx = odmg.newTransaction();
tx.begin();
OQLQuery query = odmg.newOQLQuery();
String sql = "select homeDetail from " + HomeBO.class.getName();
sql += " where homeID = $1";
query.create( sql );
query.bind( homeID );
results = ( List ) query.execute();
tx.commit();
home = ( HomeBO ) results.get( 0 );
homeDet = new HomeDetailView();
homeDet.setBrokerHomesColl( home.getBrokerHomesColl() ); //Returns one BrokerHomesColl object filled with BrokerBO objects
homeDet.setVisitColl( home.getVisitColl() );
homeDet.setDisclosureColl( home.getDisclosureColl() );
homeDet.setRoomColl( home.getRoomColl() );
homeDet.setAmenityColl( home.getAmenityColl() );
homeDet.setAgentColl( home.getAgentHomesColl() );
homeDet.setDescription( home.getDescription() );
homeDet.setFileLoc( home.getFileLoc() );
homeDet.setFileName( home.getFileName() );
homeDet.setId( home.getHomeID() );
homeDet.setMLS( home.getMLS() );
homeDet.setName( home.getName() );
homeDet.setMoreInfo( home.getMoreInfo() );
homeDet.setOfferDate( DateUtilities.formatSQLDate( home.getOfferDate() , DateFormat.SHORT ) );
homeDet.setOnMarketDate( DateUtilities.formatSQLDate( home.getOnMarketDate() , DateFormat.SHORT ) );
homeDet.setOwnerLetter( home.getOwnerLetter() );
homeDet.setPrice( home.getPrice() );
homeDet.setSqFootage( home.getSqFootage() );
homeDet.setStatus( home.getStatus() );
homeDet.setTitle( home.getTitle() );
homeDet.setFeaturedStartDate( DateUtilities.formatSQLDate( home.getFeaturedStartDate() , DateFormat.SHORT ) );
homeDet.setFeaturedEndDate( DateUtilities.formatSQLDate( home.getFeaturedEndDate() , DateFormat.SHORT ) );
homeDet.setFeatured( home.getFeatured() );
}
catch( Exception e )
{
if( log.isFatalEnabled() )
log.fatal( "An exception occured during database processing" , e );
throw DataAccessException.datastoreError( e );
}
return homeDet;
}


R

--
Robert S. Sfeir
Senior Java Engineer
National Institutes of Health
Center for Information Technology
Department of Enterprise Custom Applications
[EMAIL PROTECTED]


Reply via email to