You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Ari Maniatis (JIRA)" <ji...@apache.org> on 2009/03/15 09:25:16 UTC

[jira] Closed: (CAY-538) Relationship not refreshed before committing the context.

     [ https://issues.apache.org/cayenne/browse/CAY-538?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ari Maniatis closed CAY-538.
----------------------------

    Resolution: Cannot Reproduce

> Relationship not refreshed before committing the context.
> ---------------------------------------------------------
>
>                 Key: CAY-538
>                 URL: https://issues.apache.org/cayenne/browse/CAY-538
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Cayenne Core Library
>    Affects Versions: 1.2 branch
>         Environment: I think any platform, but tested on os x and freebsd.
> Cayenne 3t
>            Reporter: Marcin Skladaniec
>
> I have two sites : site1 and site2 and a room linked to site1
> If I change the relationship so the room links to site2, than before I commit the changes both sites are linked to the room.
> The code
> {
> 		Expression expression = ExpressionFactory.matchExp(CSite.NAME_PROPERTY, "site1");
> 		SelectQuery query = new SelectQuery(CSite.class, expression);
> 		List list = context2.performQuery(query);
> 		CSite tempsite1 = (CSite)list.get(0);
> 		
> 		expression = ExpressionFactory.matchExp(CSite.NAME_PROPERTY, "site2");
> 		query = new SelectQuery(CSite.class, expression);
> 		list = context2.performQuery(query);
> 		CSite tempsite2 = (CSite)list.get(0);
> 		
> 		
> 		expression = ExpressionFactory.matchExp(CRoom.NAME_PROPERTY, "room");
> 		query = new SelectQuery(CRoom.class, expression);
> 		list = context2.performQuery(query);
> 		CRoom temproom = (CRoom)list.get(0);
> 		
> 		
> 		logger.info("site 1 rooms");
> 		List rooms = tempsite1.getRooms();
> 		for (int i=0; i<rooms.size();i++) {
> 			logger.info("\troom "+i+" : "+((CRoom)rooms.get(i)).getName());
> 		}
> 		
> 		logger.info("site 2 rooms");
> 		rooms = tempsite2.getRooms();
> 		for (int i=0; i<rooms.size();i++) {
> 			logger.info("\troom "+i+" : "+((CRoom)rooms.get(i)).getName());
> 		}
> 		logger.info("(here relationship is modified)");
> 		temproom.setSite(tempsite2);
> 		
> 		logger.info("site 1 rooms");
> 		rooms = tempsite1.getRooms();
> 		for (int i=0; i<rooms.size();i++) {
> 			logger.info("\troom "+i+" : "+((CRoom)rooms.get(i)).getName());
> 		}
> 		
> 		logger.info("site 2 rooms");
> 		rooms = tempsite2.getRooms();
> 		for (int i=0; i<rooms.size();i++) {
> 			logger.info("\troom "+i+" : "+((CRoom)rooms.get(i)).getName());
> 		}
> }
> produces output :
> site 1 rooms
> 	room 0 : room
> site 2 rooms
> (here relationship is modified)
> site 1 rooms
> 	room 0 : room
> site 2 rooms
> 	room 0 : room
> I can publish a small project reproducing this bug.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.