cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Meyer - KMZ" <ke...@kmz.co.za>
Subject Re: Is it possible/easy to integrate cayenne with other frameworks?
Date Mon, 12 Dec 2011 07:50:50 GMT
Hmm.. curiouser and curiouser:
I'm reorganising the entity setup, and now I get:

org.apache.cayenne.CayenneRuntimeException: [v.3.1M4-SNAPSHOT Dec 11 2011 10:30:28] ObjAttribute
'number' does not have a corresponding DbAttribute

My setup, below, links the two:
id, in this case, is the magic "number" - the name of my POJO value 
field, of type int.

        // represents a database table
        DbEntity dbEntity = new DbEntity(entityName);

        // Represents a domain object
        ObjEntity objEntity = new ObjEntity(entityName);

        dataMap.addDbEntity(dbEntity);
        dataMap.addObjEntity(objEntity);
        // Link the table to the domain object
        objEntity.setDbEntity(dbEntity);
        objEntity.setClassName(className);

        // Create fields
        List<OneToOneAssociation> assocs = specification.getProperties();
        for (OneToOneAssociation assoc : assocs) {
            final String id = assoc.getId(); // number
            final String type = assoc.getSpecification().getFullIdentifier(); // int

            DbAttribute dbAttribute = new DbAttribute(id, java.sql.Types.INTEGER, dbEntity);
            dbEntity.addAttribute(dbAttribute);

            ObjAttribute objAttribute = new ObjAttribute(id, type, objEntity);
            objEntity.addAttribute(objAttribute);
        }

        dataMap.addObjEntity(objEntity);
        dataMap.addDbEntity(dbEntity);


On 11 Dec 2011 at 21:05, Andrus Adamchik wrote:

> Great to hear there a workaround. Object structure is a pretty fundamental issue, so
I was afraid we may get stuck here.
> 
> Cheers,
> Andrus 
> 



Mime
View raw message