Message:
A new issue has been created in JIRA.
---------------------------------------------------------------------
View the issue:
http://objectstyle.org/jira/secure/ViewIssue.jspa?key=CAY-435
Here is an overview of the issue:
---------------------------------------------------------------------
Key: CAY-435
Summary: Transient object registration
Type: Bug
Status: Assigned
Priority: Major
Project: Cayenne
Assignee: Andrus Adamchik
Reporter: weidox
Created: Tue, 31 Jan 2006 6:46 AM
Updated: Tue, 31 Jan 2006 6:46 AM
Environment: winxp, M7
Description:
(Haven't tested on M10 because of earlier issues).
User guide states, that "Newly created objects must be registered with DataContext explicitly".
Given example:
import org.objectstyle.cayenne.access.DataContext;
DataContext ctxt; // assume this exists
Artist artist = new Artist();
ctxt.registerNewObject(artist);
However, if I do something like this:
Artist artist = new (Artist);
Country country = ((List<Country>)ctxt.performQuery(new SelectQuery(Country.class))).get(0);
Artist.setCountry(country);
Object artist gets registered with DataContext, and goes to database after commit. I think of several ways - one, that it is difficult to manage relationships with other objects maintaining transient state, and it should be stated as expected behavior, second, this should be corrected that object wouldn't get registred (preferred way), third, maybe object would be related with the DataContext someway internally, but still maintain transient state and not go to DB (mainly the same as second way), fourth, relationship operations may throw exception with transient objects.
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://objectstyle.org/jira/secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
This archive was generated by hypermail 2.0.0 : Tue Jan 31 2006 - 06:47:40 EST