cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: trouble w/ tutorial and foreign keys
Date Mon, 30 Jul 2007 21:04:09 GMT
I think I know what happens. There's no relationship established  
between the artist and his paintings (and also paintings and  
galleries). So when fetching paintings qualified on artist date of  
birth, you get no rows. So before the first commit do this:

(per http://cayenne.apache.org/doc/tutorial-dataobjects.html)

picasso.addToPaintings(girl);
picasso.addToPaintings(stein);

girl.setGallery(metropolitan);
stein.setGallery(metropolitan);

Andrus


On Jul 30, 2007, at 12:00 PM, McRib wrote:

>
> here is the complete log - HTH:
>
>
> INFO  QueryLogger: Created connection pool:
> jdbc:mysql://localhost/playground
> 	Driver class: com.mysql.jdbc.Driver
> 	Min. connections in the pool: 1
> 	Max. connections in the pool: 1
> INFO  QueryLogger: --- will run 3 queries.
> INFO  QueryLogger: Opening connection: jdbc:mysql://localhost/ 
> playground
> 	Login: root
> 	Password: *******
> INFO  QueryLogger: +++ Connecting: SUCCESS.
> INFO  QueryLogger: --- transaction started.
> INFO  QueryLogger: Detected and installed adapter:
> org.apache.cayenne.dba.mysql.MySQLAdapter
> INFO  QueryLogger: delete from PAINTING
> INFO  QueryLogger: === updated 2 rows.
> INFO  QueryLogger: delete from ARTIST
> INFO  QueryLogger: === updated 1 row.
> INFO  QueryLogger: delete from GALLERY
> INFO  QueryLogger: === updated 1 row.
> INFO  QueryLogger: +++ transaction committed.
> INFO  QueryLogger: --- transaction started.
> INFO  QueryLogger: LOCK TABLES AUTO_PK_SUPPORT WRITE
> INFO  QueryLogger: SELECT NEXT_ID FROM AUTO_PK_SUPPORT WHERE  
> TABLE_NAME =
> 'ARTIST'
> INFO  QueryLogger: UPDATE AUTO_PK_SUPPORT SET NEXT_ID = NEXT_ID +  
> 20 WHERE
> TABLE_NAME = 'ARTIST' AND NEXT_ID = 260
> INFO  QueryLogger: UNLOCK TABLES
> INFO  QueryLogger: LOCK TABLES AUTO_PK_SUPPORT WRITE
> INFO  QueryLogger: SELECT NEXT_ID FROM AUTO_PK_SUPPORT WHERE  
> TABLE_NAME =
> 'GALLERY'
> INFO  QueryLogger: UPDATE AUTO_PK_SUPPORT SET NEXT_ID = NEXT_ID +  
> 20 WHERE
> TABLE_NAME = 'GALLERY' AND NEXT_ID = 260
> INFO  QueryLogger: UNLOCK TABLES
> INFO  QueryLogger: LOCK TABLES AUTO_PK_SUPPORT WRITE
> INFO  QueryLogger: SELECT NEXT_ID FROM AUTO_PK_SUPPORT WHERE  
> TABLE_NAME =
> 'PAINTING'
> INFO  QueryLogger: UPDATE AUTO_PK_SUPPORT SET NEXT_ID = NEXT_ID +  
> 20 WHERE
> TABLE_NAME = 'PAINTING' AND NEXT_ID = 260
> INFO  QueryLogger: UNLOCK TABLES
> INFO  QueryLogger: --- will run 3 queries.
> INFO  QueryLogger: INSERT INTO ARTIST (DATE_OF_BIRTH, ID, NAME)  
> VALUES (?,
> ?, ?)
> INFO  QueryLogger: [bind: '1881-10-25 00:00:00.0', 260, 'Pablo  
> Picasso']
> INFO  QueryLogger: === updated 1 row.
> INFO  QueryLogger: INSERT INTO GALLERY (ID, NAME) VALUES (?, ?)
> INFO  QueryLogger: [bind: 260, 'Metropolitan Museum of Art']
> INFO  QueryLogger: === updated 1 row.
> INFO  QueryLogger: INSERT INTO PAINTING (ARTIST_ID, GALLERY_ID, ID,  
> NAME)
> VALUES (?, ?, ?, ?)
> INFO  QueryLogger: [bind: NULL, NULL, 260, 'Gertrude Stein']
> INFO  QueryLogger: === updated 1 row.
> INFO  QueryLogger: [bind: NULL, NULL, 261, 'Girl Reading at a Table']
> INFO  QueryLogger: === updated 1 row.
> INFO  QueryLogger: +++ transaction committed.
> INFO  QueryLogger: --- will run 1 query.
> INFO  QueryLogger: --- transaction started.
> INFO  QueryLogger: SELECT t0.NAME, t0.ARTIST_ID, t0.GALLERY_ID,  
> t0.ID FROM
> PAINTING t0 - prepared in 7 ms.
> INFO  QueryLogger: === returned 2 rows. - took 11 ms.
> INFO  QueryLogger: +++ transaction committed.
> INFO  QueryLogger: --- will run 1 query.
> INFO  QueryLogger: --- transaction started.
> INFO  QueryLogger: SELECT t0.NAME, t0.ARTIST_ID, t0.GALLERY_ID,  
> t0.ID FROM
> PAINTING t0 WHERE UPPER(t0.NAME) LIKE UPPER(?) [bind: 'gi%']
> INFO  QueryLogger: === returned 1 row. - took 32 ms.
> INFO  QueryLogger: +++ transaction committed.
> INFO  QueryLogger: --- will run 1 query.
> INFO  QueryLogger: --- transaction started.
> INFO  QueryLogger: SELECT t0.NAME, t0.ARTIST_ID, t0.GALLERY_ID,  
> t0.ID FROM
> PAINTING t0, ARTIST t1 WHERE t0.ARTIST_ID = t1.ID AND  
> (t1.DATE_OF_BIRTH < ?)
> [bind: '1907-01-01 00:00:00.777']
> INFO  QueryLogger: === returned 0 rows. - took 16 ms.
> INFO  QueryLogger: +++ transaction committed.
>
>
>
> -- 
> View this message in context: http://www.nabble.com/trouble-w-- 
> tutorial-and-foreign-keys-tf4163514.html#a11860076
> Sent from the Cayenne - User mailing list archive at Nabble.com.
>
>


Mime
View raw message