Again, this is just a query. I am doing no updates here. Below is the code
snippet which generated the previous output:
Database db = ....;
OQLQuery oql;
QueryResults rs;
Company c = null;
LookupListItem lli = null;
db.begin();
oql = db.getOQLQuery(
"SELECT p FROM com.vignette.it.apps.jdo.CompanyImpl p"
);
while ( rs.hasMore() )
{
c = (Company)rs.next();
System.out.println(
"*************************************************" );
System.out.println( " Id : " + c.getId() );
System.out.println( " Name : " + c.getName() );
System.out.println( " Employees : " +
c.getEmployees().size() );
System.out.println( " Locations : " +
c.getLocations().size() );
System.out.println(
"*************************************************" );
}
/* db.commit(); */
db.rollback();
And then here are the mappings for Company, Location, and CompanyPerson
(employees):
<class name="com.vignette.it.apps.jdo.CompanyImpl" identity="id"
key-generator="SOMA_ID">
<description>Represents a Company from the COMPANY
table</description>
<map-to table="COMPANY"/>
<cache-type type="unlimited"/>
<field name="id" type="integer">
<sql name="COMP_ID" type="integer"/>
</field>
<field name="parentCompany"
type="com.vignette.it.apps.jdo.CompanyImpl">
<sql name="PRNT_COMP_ID"/>
</field>
<field name="name" type="string">
<sql name="name" type="varchar"/>
</field>
<field name="url" type="string">
<sql name="MAIN_URL" type="varchar"/>
</field>
<field name="annualRevenue.number" type="double">
<sql name="ANNUAL_REV" type="numeric"/>
</field>
<field name="annualRevenue.currency"
type="com.vignette.it.apps.jdo.CurrencyImpl">
<sql name="ANNUAL_REV_CURR_ID"/>
</field>
<field name="potentialOpportunity.number" type="double">
<sql name="POTNL_OPP" type="numeric"/>
</field>
<field name="potentialOpportunity.currency"
type="com.vignette.it.apps.jdo.CurrencyImpl">
<sql name="POTNL_OPP_CURR_ID"/>
</field>
<field name="fortuneList"
type="com.vignette.it.apps.jdo.FortuneListImpl" required="true">
<sql name="FORT_LIST_ID"/>
</field>
<field name="customerProductStatus"
type="com.vignette.it.apps.jdo.CustomerProductStatusImpl" required="true">
<sql name="CUST_PROD_STAT_ID"/>
</field>
<field name="geography"
type="com.vignette.it.apps.jdo.GeographyImpl" required="true">
<sql name="GEO_ID"/>
</field>
<field name="employees"
type="com.vignette.it.apps.jdo.CompanyPersonImpl" collection="collection">
<sql many-key="COMP_ID"/>
</field>
<field name="locations" type="com.vignette.it.apps.jdo.LocationImpl"
collection="collection">
<sql many-key="COMP_ID"/>
</field>
<field name="companyTypes"
type="com.vignette.it.apps.jdo.CompanyTypeImpl" collection="collection">
<sql many-key="COMP_ID" many-table="COMP_COMP_TYPE_JT"/>
</field>
<field name="industries"
type="com.vignette.it.apps.jdo.IndustryImpl" collection="collection">
<sql many-key="COMP_ID" many-table="COMP_IND_JT"/>
</field>
<field name="activities"
type="com.vignette.it.apps.jdo.CompanyActivityImpl" collection="collection">
<sql many-key="COMP_ID" many-table="COMP_ACTIVITY_JT"/>
</field>
<field name="activityPlans"
type="com.vignette.it.apps.jdo.CompanyActivityPlanImpl"
collection="collection">
<sql many-key="COMP_ID"
many-table="COMP_PERS_ACTIVITY_PLAN_JT"/>
</field>
<field name="active" type="boolean">
<sql name="active_flg"/>
</field>
<field name="createdDate" type="date">
<sql name="CRTD_DT" type="timestamp"/>
</field>
<field name="createdBy"
type="com.vignette.it.apps.jdo.DataPersistorImpl">
<sql name="CRTD_BY"/>
</field>
<field name="modifiedDate" type="date">
<sql name="CHGD_DT" type="timestamp"/>
</field>
<field name="modifiedBy"
type="com.vignette.it.apps.jdo.DataPersistorImpl">
<sql name="CHGD_BY"/>
</field>
</class>
<class name="com.vignette.it.apps.jdo.CompanyPersonImpl" identity="id"
key-generator="SOMA_ID">
<description>Company Person object mapping</description>
<map-to table="COMP_PERS_JT"/>
<cache-type type="unlimited"/>
<field name="id" type="integer">
<sql name="COMP_PERS_ID" type="integer"/>
</field>
<field name="company" type="com.vignette.it.apps.jdo.CompanyImpl">
<sql name="COMP_ID" />
</field>
<field name="person" type="com.vignette.it.apps.jdo.PersonImpl">
<sql name="PERS_ID"/>
</field>
<field name="manager"
type="com.vignette.it.apps.jdo.CompanyPersonImpl">
<sql name="MGR_COMP_PERS_ID"/>
</field>
<field name="title" type="string">
<sql name="TITLE_1" type="varchar"/>
</field>
<field name="title2" type="string">
<sql name="TITLE_2" type="varchar"/>
</field>
<field name="locations" type="com.vignette.it.apps.jdo.LocationImpl"
collection="collection">
<sql name="LOC_ID" many-table="COMP_PERS_LOC_JT"
many-key="COMP_PERS_ID"/>
</field>
<field name="phoneNumbers"
type="com.vignette.it.apps.jdo.PhoneNumberImpl"
collection="collection">
<sql name="PHONE_NUM_ID" many-table="COMP_PERS_PHONE_NUM_JT"
many-key="COMP_PERS_ID"/>
</field>
<field name="notes"
type="com.vignette.it.apps.jdo.CompanyPersonNoteImpl"
collection="collection">
<sql many-key="COMP_PERS_ID"/>
</field>
<field name="leadsources"
type="com.vignette.it.apps.jdo.LeadsourceImpl" collection="collection">
<sql many-key="COMP_PERS_ID" many-table="COMP_PERS_LDSRC_JT"/>
</field>
<field name="active" type="boolean">
<sql name="active_flg"/>
</field>
<field name="createdDate" type="date">
<sql name="CRTD_DT" type="timestamp"/>
</field>
<field name="createdBy"
type="com.vignette.it.apps.jdo.DataPersistorImpl">
<sql name="CRTD_BY"/>
</field>
<field name="modifiedDate" type="date">
<sql name="CHGD_DT" type="timestamp"/>
</field>
<field name="modifiedBy"
type="com.vignette.it.apps.jdo.DataPersistorImpl">
<sql name="CHGD_BY"/>
</field>
</class>
<class name="com.vignette.it.apps.jdo.LocationImpl" identity="id"
key-generator="SOMA_ID">
<description>A location object mapping</description>
<map-to table="LOCATION"/>
<cache-type type="unlimited"/>
<field name="id" type="integer">
<sql name="LOC_ID" type="integer"/>
</field>
<field name="company" type="com.vignette.it.apps.jdo.CompanyImpl">
<sql name="COMP_ID"/>
</field>
<field name="description" type="string">
<sql name="LOC_DESC" type="varchar"/>
</field>
<field name="addresses" type="com.vignette.it.apps.jdo.AddressImpl"
collection="collection">
<sql name="ADDR_ID" many-table="LOC_ADDR_JT" many-key="LOC_ID"/>
</field>
<field name="phoneNumbers"
type="com.vignette.it.apps.jdo.PhoneNumberImpl"
collection="collection">
<sql name="PHONE_NUM_ID" many-table="LOC_PHONE_NUM_JT"
many-key="LOC_ID"/>
</field>
<field name="active" type="boolean">
<sql name="active_flg"/>
</field>
<field name="createdDate" type="date">
<sql name="CRTD_DT" type="timestamp"/>
</field>
<field name="createdBy"
type="com.vignette.it.apps.jdo.DataPersistorImpl">
<sql name="CRTD_BY"/>
</field>
<field name="modifiedDate" type="date">
<sql name="CHGD_DT" type="timestamp"/>
</field>
<field name="modifiedBy"
type="com.vignette.it.apps.jdo.DataPersistorImpl">
<sql name="CHGD_BY"/>
</field>
</class>
********************************************
Steve Ebersole
IT Integration Engineer
Vignette Corporation
512.741.4195
Visit http://www.vignette.com
********************************************
-----Original Message-----
From: Bruce Snyder [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 01, 2002 10:39 PM
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] Date: Fri, 1 Mar 2002 18:54:41 -0600
This one time, at band camp, Ebersole, Steven said:
ES>The counts for company id=1 is correct (it really does have 1289
employees
ES>and 0 locations).
ES>The counts for company id=4 are incorrect (it really has 0 employees and
4
ES>locations).
ES>The counts for company id=5 are incorrect (it really has 0 employees and
1
ES>locations).
ES>The counts for company id=6 are incorrect (it really has 1 employees and
7
ES>locations).
ES>
ES>
ES>Does anyone have any idea what could be causing this? And more
importantly,
ES>how to correct?
Steve,
You stated in your previous message that you're using long transactions,
yet there are no illustration of your use of them. Also, let's see
the mapping descriptor.
Bruce
--
perl -e 'print
unpack("u30","<0G)U8V4\@4VYY9&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");'
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev