Hi,

Evidently this is only an 3.0M1 problem, as I've just switched back to
2.0.3 and the problem disappeared!

I can't paste the actual code due to NDA reasons of this project,
however the modified version looks something like this:

public void createAndSaveNotification() {
        //find the existing mail record in the database
        IMaintenanceRequest req = getDao().findMaintenanceRequestRecord(corId);

        //create a new notification record
        INotification notification = getDao().createAndRegisterNotification();

        
notification.setDateSent(KatyaUtil.getCalendarInGmtTimeZone().getTime());
        notification.setType(INotification.TYPE_IM);

        //req.addToNotificationArray(notification);
        notification.setToCorrespondence(req);

        logObjects();

        getDao().commit();
}

I use the DAO to find the record for which notification will be
created. Then I use the DAO to create and register a new instance of
the notification object. Set some fields on it like date sent and
type. The try to build a relationship and commit back to the DB.

the logObjects method logs all the uncommitted objects from the data
context. When I check the log there are 2 objects being logged, one
being the maintenance request record in modified state, and one being
the notification record in the new state.

And at the commit level I get the exception I wrote about. Didn't
think there was anything to complicated about this. And as I said
above I reverted back to 2.0.3 and it works fine, but in 3.0M1 it
throws an exception.

Any thoughts?

Thank you!

Gary

On 9/19/07, Tore Halset <[EMAIL PROTECTED]> wrote:
> Hello.
>
> Looks like you are using an uncomitted new object in a query. Could
> you post your relevant java code?
>
>   - Tore.
>
> On Sep 19, 2007, at 12:12 , Gary Jarrel wrote:
>
> > Hi Guys!
> >
> > Any thoughts on what could be causing this during commit?
> >
> > org.apache.cayenne.CayenneRuntimeException: [v.3.0M1 Jul 27 2007
> > 23:05:47] Can't build a query for temporary id:
> > <ObjectId:CorrespondenceRecepientNotification, TEMP:0000032DC4F40101>
> >         at
> > org.apache.cayenne.query.ObjectIdQuery.createReplacementQuery
> > (ObjectIdQuery.java:120)
> >         at
> > org.apache.cayenne.query.IndirectQuery.getReplacementQuery
> > (IndirectQuery.java:75)
> >         at org.apache.cayenne.query.IndirectQuery.route
> > (IndirectQuery.java:58)
> >         at org.apache.cayenne.access.DataDomainQueryAction.runQuery
> > (DataDomainQueryAction.java:
> > <snip>
> >
> > I've did some googling and came across similar errors, all which
> > related to version 1.2 of Cayenne and all appear to have been resolved
> > based on the Jira issues which I read?
> >
> > Thank you!
> >
> > Gary
> >
>
>

Reply via email to