cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peter karich <peat...@yahoo.de>
Subject Re: cayenne INSERTs NULL values instead of strings
Date Thu, 03 Aug 2006 16:20:50 GMT
Thank you for your fast reply (wow!! :-)

Yes the things are very basic and may be I am too
stupid (hopefully not, so that I will not waste your
time ...)
Mike Kienenberger, I tried it with 
SimplePerson p =
(SimplePerson)context.createAndRegisterNewObject(SimplePerson.class);

and have the same problem...

Now, I will start a new SimplePerson "project" from
the scratch to figure out where the problem
comes from. Which database do you use?

Here is the generated source:
_SimplePerson.java
package test;
import org.objectstyle.cayenne.CayenneDataObject;
/**
 * A generated persistent class mapped as
"SimplePerson" Cayenne entity. It is a good idea to
 * avoid changing this class manually, since it will
be overwritten next time code is
 * regenerated. If you need to make any
customizations, put them in a subclass.
 */
public class _SimplePerson extends CayenneDataObject {
    public static final String MYINT_PROPERTY =
"myint";
    public static final String NAME_PROPERTY = "name";
    protected Integer myint;
    protected String name;

    public Integer getMyint() {
        if(objectContext != null) {
            objectContext.prepareForAccess(this,
"myint");
        }
        
        return myint;
    }
    public void setMyint(Integer myint) {
        if(objectContext != null) {
            objectContext.prepareForAccess(this,
"myint");
        }
        
        Object oldValue = this.myint;
        this.myint = myint;
        
        // notify objectContext about simple property
change
        if(objectContext != null) {
            objectContext.propertyChanged(this,
"myint", oldValue, myint);
        }
    }    
    
    public String getName() {
        if(objectContext != null) {
            objectContext.prepareForAccess(this,
"name");
        }
        
        return name;
    }
    public void setName(String name) {
        if(objectContext != null) {
            objectContext.prepareForAccess(this,
"name");
        }
        
        Object oldValue = this.name;
        this.name = name;
        
        // notify objectContext about simple property
change
        if(objectContext != null) {
            objectContext.propertyChanged(this,
"name", oldValue, name);
        }
    }
}

SimplePerson.java:
package test;
/**A persistent class mapped as "SimplePerson" Cayenne
entity. */
public class SimplePerson extends _SimplePerson {
}


Bye, Peter.





PS: Another problem occured if I choose "generator
version = 1.1" in the class generator 
dialog _SimplePerson.java will be:
${importUtils.setPackage($entityUtils.superPackageName)}${importUtils.addReservedType("${$entityUtils.superPackageName}.${entityUtils.superClassName}")}${importUtils.addType("${entityUtils.basePackageName}.${entityUtils.baseClassName}")}${importUtils.generate()}
/**
 * A generated persistent class mapped as
"${objEntity.name}" Cayenne entity. It is a good idea
to
 * avoid changing this class manually, since it will
be overwritten next time code is
 * regenerated. If you need to make any
customizations, put them in a subclass.
 */
public class ${entityUtils.superClassName} extends
${entityUtils.baseClassName} {
}


	

	
		
___________________________________________________________ 
Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de

Mime
View raw message