werner,

thanks, it is really very odd. my note the the list was a last ditch effort to solve the problem, but i had to just go back to the drawing board and do this differently to keep my project going forward.

when i finish my current project (in about a month), i will get back to this again, try the key gen change, and find a way for you to reproduce the issue. one additional note, this has happened once before, but just on one field in one class; an integer where if the value is set to "0", it will write a null to the database.
right now i am wondering if this might be a driver issue.

quick question, is there a simple way to use the public castor api to output the mapping descriptors for a particular
object, or would i have to get into the internals?

thanks
-peter

Werner Guttmann wrote:
Out of the blue, what happens if you drop the key generator from the class mapping. Other than that, can you provide me with some sort of application that I can use to *reproduce* the problem ? In other words, where I can see and feel myself what you are trying to describe ?

All in all, this sounds completely odd to me, especially as everything seems to work with all other objects/classes.

Regards
Werner

peter c wrote:
I have an object ContactInfo which i am unable to get to accurately
persist via Castor JDO or accurately marshal into xml.

When I create a new ContactInfo object, populate the fields and
either create in the database, or marshal to xml, all the fields except
the "id" field--which is generated by a key-generator--are empty in
the db or non-existent in the xml. (see below for code/mapping/etc)

for example, db:
select * from contactinfo where contactid = 12345;
contactid|donorid|organization|phone|address1|address2|city|state|zip|country
12345|||||||||

xml:
<contact-info>
   <id>12345</id>
</contact-info>

strangely, when i don't populate a field in the object, it will accurately
appear as empty:

<contact-info>
   <id>12345</id>
   <organization></organization>
   <phone></phone>
   <address2></address2>
</contact-info>

i have tried this in castor1.0M, and now updated to 1.2 and the same
problem exists. below is all the relevant mapping, code and database
information. i am using postgres 8.1.10

i don't have this problem with any other objects in my Mapping/DB.
i am at a total loss. any help would be much appreciated, even if it
is just a pointer to other debug output to look into for more information.

thanks, and see below for all mapping.code/etc,
-peter

here is the class mapping:
------------------
 <key-generator name="SEQUENCE" alias="CONTACTSEQ">
   <param name="sequence" value="contactinfo_contactid_seq"/>
 </key-generator>

<class name="org.justgive.model.ContactInfo" identity="id" key-generator="CONTACTSEQ">
     <map-to table="contactinfo" xml="contact-info" />
     <cache-type type="unlimited"/>
     <field name="id" type="integer" >
         <sql name="contactid" type="integer"/>
         <bind-xml name="id" node="element"/>
     </field>
     <field name="organization" type="string" >
         <sql name="organization" type="varchar"/>
         <bind-xml name="organization" node="element"/>
     </field>
     <field name="phone" type="string" >
         <sql name="phone" type="varchar"/>
         <bind-xml name="phone" node="element"/>
     </field>
     <field name="address1" type="string" >
         <sql name="address1" type="varchar"/>
         <bind-xml name="address1" node="element"/>
     </field>
     <field name="address2" type="string" >
         <sql name="address2" type="varchar"/>
         <bind-xml name="address2" node="element"/>
     </field>
     <field name="city" type="string" >
         <sql name="city" type="varchar"/>
         <bind-xml name="city" node="element"/>
     </field>
     <field name="state" type="string" >
         <sql name="state" type="varchar"/>
         <bind-xml name="state" node="element"/>
     </field>
     <field name="zip" type="string" >
         <sql name="zip" type="varchar"/>
         <bind-xml name="zip" node="element"/>
     </field>
     <field name="country" type="string" >
         <sql name="country" type="varchar"/>
         <bind-xml name="country" node="element"/>
     </field>
 </class>
----------------------

Here is the database table:

Table contactinfo
Column : Type
contactid : serial
organization : varchar
phone : varchar
address1 : varchar
address2 : varchar
city : varchar
state : varchar
zip : varchar
country : varchar

Here is the class:
----------------------
public class ContactInfo
{
   private Integer id;
   private String organization;
   private String phone;
   private String address1;
   private String address2;
   private String city;
   private String state;
   private String zip;
   private String country;

   public ContactInfo(){}

   public Integer getId()
   {
       return id;
   }

   public void setId(Integer id)
   {
       this.id = id;
   }

   public String getOrganization()
   {
       return organization;
   }

   public void setOrganization(String organization)
   {
       this.organization = organization;
   }

   public String getPhone()
   {
       return phone;
   }

   public void setPhone(String phone)
   {
       this.phone = phone;
   }

   public String getAddress1()
   {
       return address1;
   }

   public void setAddress1(String address1)
   {
       this.address1 = address1;
   }

   public String getAddress2()
   {
       return address2;
   }

   public void setAddress2(String address2)
   {
       this.address2 = address2;
   }

   public String getCity()
   {
       return city;
   }

   public void setCity(String city)
   {
       this.city = city;
   }

   public String getState()
   {
       return state;
   }

   public void setState(String state)
   {
       this.state = state;
   }

   public String getZip()
   {
       return zip;
   }

   public void setZip(String zip)
   {
       this.zip = zip;
   }

   public String getCountry()
   {
       return country;
   }

   public void setCountry(String country)
   {
       this.country = country;
   }

}
------------------

Here is the create command:

try
{
   db.begin();

   ContactInfo info = new ContactInfo();

   info.setOrganization("organization");
   info.setPhone("phone");
   info.setAddress1("address1");
   info.setAddress2("address2");
   info.setCity("city");
   info.setState("state");
   info.setZip("zip");
   info.setCountry("country");

   db.create(info);
   db.commit();
   db.close();
}
catch (Exception e)
{
   out(e);
}
------------------------

Here is the debug output:
-----------------------
org.castor.jdo.engine.DatabaseRegistry : DEBUG - Fetching ConnectionFactory: jg_peter
org.exolab.castor.jdo.engine.LocalDatabaseImpl  : DEBUG - Beginning tx
- TRACE: org.justgive.model.ContactInfo: Organization: organization
- TRACE: org.justgive.model.ContactInfo: Phone: phone
- TRACE: org.justgive.model.ContactInfo: Address1: address1
- TRACE: org.justgive.model.ContactInfo: Address2: address2
- TRACE: org.justgive.model.ContactInfo: City: city
- TRACE: org.justgive.model.ContactInfo: State: state
- TRACE: org.justgive.model.ContactInfo: Zip: zip
- TRACE: org.justgive.model.ContactInfo: Country: country
- TRACE: org.justgive.model.AbstractDatabaseItem: deserializing class org.justgive.model.ContactInfo org.exolab.castor.xml.Marshaller : DEBUG - Marshalling org.justgive.model.ContactInfo - TRACE: org.justgive.actions.basket.EditAccount: <?xml version="1.0" encoding="UTF-8"?>
<contact-info/>

org.exolab.castor.persist.LockEngine : DEBUG - Creating class: org.justgive.model.ContactInfo with id: null org.castor.cache.DebuggingCacheProxy : DEBUG - unlimited.remove(org.justgive.model.ContactInfo/<new>) [org.justgive.model.ContactInfo] org.exolab.castor.jdo.keygen.SequenceKeyGenerator : DEBUG - JDBC query returned value 162041 from column nextval/-5 org.exolab.castor.jdo.keygen.SequenceKeyGenerator : DEBUG - Returning value 162041 of type java.lang.Integer as key. org.exolab.castor.jdo.engine.SQLStatementCreate : DEBUG - Creating class: org.justgive.model.ContactInfo using SQL: Pooled statement wrapping physical statement INSERT INTO "contactinfo" ("contactid","organization","phone","address1","address2","city","state","zip","country") VALUES (?,?,?,?,?,?,?,?,?) org.exolab.castor.jdo.engine.SQLStatementCreate : DEBUG - Creating class: org.justgive.model.ContactInfo using SQL: Pooled statement wrapping physical statement INSERT INTO "contactinfo" ("contactid","organization","phone","address1","address2","city","state","zip","country") VALUES (162041,?,?,?,?,?,?,?,?) org.exolab.castor.jdo.engine.SQLStatementCreate : DEBUG - Creating class: org.justgive.model.ContactInfo using SQL: Pooled statement wrapping physical statement INSERT INTO "contactinfo" ("contactid","organization","phone","address1","address2","city","state","zip","country") VALUES (162041,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL) org.exolab.castor.jdo.engine.SQLStatementCreate : DEBUG - Creating class: org.justgive.model.ContactInfo using SQL: Pooled statement wrapping physical statement INSERT INTO "contactinfo" ("contactid","organization","phone","address1","address2","city","state","zip","country") VALUES (162041,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)
org.exolab.castor.jdo.engine.LocalDatabaseImpl  : DEBUG - Committing tx
org.exolab.castor.persist.ObjectLock : DEBUG - Release org.justgive.model.ContactInfo/<162041(162041)>/36 -/W by [EMAIL PROTECTED] org.castor.cache.DebuggingCacheProxy : DEBUG - unlimited.put(org.justgive.model.ContactInfo/<162041(162041)>, [EMAIL PROTECTED]) [org.justgive.model.ContactInfo] - DEBUG: org.justgive.actions.basket.EditAccount: ContactInfo (162041) sdded to Donor (162208) - [EMAIL PROTECTED]
- TRACE: org.justgive.model.ContactInfo: Organization: organization
- TRACE: org.justgive.model.ContactInfo: Phone: phone
- TRACE: org.justgive.model.ContactInfo: Address1: address1
- TRACE: org.justgive.model.ContactInfo: Address2: address2
- TRACE: org.justgive.model.ContactInfo: City: city
- TRACE: org.justgive.model.ContactInfo: State: state
- TRACE: org.justgive.model.ContactInfo: Zip: zip
- TRACE: org.justgive.model.ContactInfo: Country: country
- TRACE: org.justgive.model.AbstractDatabaseItem: deserializing class org.justgive.model.ContactInfo org.exolab.castor.xml.Marshaller : DEBUG - Marshalling org.justgive.model.ContactInfo - TRACE: org.justgive.actions.basket.EditAccount: <?xml version="1.0" encoding="UTF-8"?>
<contact-info>
   <id>162041</id>
</contact-info>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to