cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "I. Venuti" <>
Subject problems with association table...
Date Wed, 05 Apr 2006 12:12:09 GMT

I have a table (news) where I put some infos. I'd like to associate some 
documents to these news (maybe none). These documents resides in the 
table documents.
I've created an association table called newsdocs, where there are the 
two id's: one for news and one for documents.

The modeler recorgnises the relashionships (infact the object Newsdocs 
has only thwo relationships: toDocuments, toNews.
Also in the object News there is an array (newsdocsArray) and in the 
object Documents (newsdocsArray).

How can I create a relation between a news and a document?

I have tried:

1) created News: nw1 (via createANdRegisterNewObject)
2) created Documents: doc2 (via createANdRegisterNewObject)
3) commit
4) created a black record for Newsdocs:

 Newsdocs ndoc = new Newsdocs();
 ndoc.setDataContext(...) // the same used in (via 
 ndoc.setToDocuments(doc2); //****** NullPointerException
 nw1.add(via createANdRegisterNewObject)

5) commit

Unfortunatly this doesn't work: there is a NullPointerException in ******

Maybe I need to understand better the use of relashionships. Any 
suggestion is wellcome!
Thanks a lot

-- Ivan

View raw message