Re: Deleting Object from M to M relation

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Deleting Object from M to M relation

Andrus Adamchik
Hmm... now this is strange - a delete query without a qualifier... I'd
even open a feature request to make sure Cayenne detects such cases and
reports a meanigful error.

The only reason I can think of is that the join table columns that
participate in relationships are not marked as PK. Are they?

Andrus

> Hi,
> Sorry I am asking this question again.
>
> I am using cayenne1.1 and postgresql7 as database.
> I have M to M relation between SystemUser and UserRole objects, join table
> is called UserRole_SystemUser.
>
> Now if I add some SystemUser to UserRole I don't have any problems but
> when I try to delete the user from UserRole and if i say commitChanges()
> it throws following exception,
>
> INFO QUERYLOGGER : DELETE FROM UserRole_SystemUser WHERE
> INFO QUERYLOGGER : *** error.
> java.sql.SQLException: ERROR: parse: parse error at end of input
>
> I really need help with this.
> Thanks,
> Denna

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Deleting Object from M to M relation

Dhruti Ramani
No, they are not marked as Primary key. Should it be both marked as PK in join table?
 
Thanks,
Denna

Andrus Adamchik <[hidden email]> wrote:
Hmm... now this is strange - a delete query without a qualifier... I'd
even open a feature request to make sure Cayenne detects such cases and
reports a meanigful error.

The only reason I can think of is that the join table columns that
participate in relationships are not marked as PK. Are they?

Andrus

> Hi,
> Sorry I am asking this question again.
>
> I am using cayenne1.1 and postgresql7 as database.
> I have M to M relation between SystemUser and UserRole objects, join table
> is called UserRole_SystemUser.
>
> Now if I add some SystemUser to UserRole I don't have any problems but
> when I try to delete the user from UserRole and if i say commitChanges()
> it throws following exception,
>
> INFO QUERYLOGGER : DELETE FROM UserRole_SystemUser WHERE
> INFO QUERYLOGGER : *** error.
> java.sql.SQLException: ERROR: parse: parse error at end of input
>
> I really need help with this.
> Thanks,
> Denna

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Deleting Object from M to M relation

Andrus Adamchik
> Should it be both marked as PK in
> join table?

Why don't you just go ahead and try it? ;-)

Andrus



> No, they are not marked as Primary key. Should it be both marked as PK in
> join table?
>
> Thanks,
> Denna
>
> Andrus Adamchik <[hidden email]> wrote:
> Hmm... now this is strange - a delete query without a qualifier... I'd
> even open a feature request to make sure Cayenne detects such cases and
> reports a meanigful error.
>
> The only reason I can think of is that the join table columns that
> participate in relationships are not marked as PK. Are they?
>
> Andrus
>
>> Hi,
>> Sorry I am asking this question again.
>>
>> I am using cayenne1.1 and postgresql7 as database.
>> I have M to M relation between SystemUser and UserRole objects, join
>> table
>> is called UserRole_SystemUser.
>>
>> Now if I add some SystemUser to UserRole I don't have any problems but
>> when I try to delete the user from UserRole and if i say commitChanges()
>> it throws following exception,
>>
>> INFO QUERYLOGGER : DELETE FROM UserRole_SystemUser WHERE
>> INFO QUERYLOGGER : *** error.
>> java.sql.SQLException: ERROR: parse: parse error at end of input
>>
>> I really need help with this.
>> Thanks,
>> Denna
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Deleting Object from M to M relation

Dhruti Ramani
In reply to this post by Andrus Adamchik
Thanks Andrus,
 
Making those two columns as PK, it seems like exception goes away.
 
Thanks again,
Denna

Andrus Adamchik <[hidden email]> wrote:
Hmm... now this is strange - a delete query without a qualifier... I'd
even open a feature request to make sure Cayenne detects such cases and
reports a meanigful error.

The only reason I can think of is that the join table columns that
participate in relationships are not marked as PK. Are they?

Andrus

> Hi,
> Sorry I am asking this question again.
>
> I am using cayenne1.1 and postgresql7 as database.
> I have M to M relation between SystemUser and UserRole objects, join table
> is called UserRole_SystemUser.
>
> Now if I add some SystemUser to UserRole I don't have any problems but
> when I try to delete the user from UserRole and if i say commitChanges()
> it throws following exception,
>
> INFO QUERYLOGGER : DELETE FROM UserRole_SystemUser WHERE
> INFO QUERYLOGGER : *** error.
> java.sql.SQLException: ERROR: parse: parse error at end of input
>
> I really need help with this.
> Thanks,
> Denna


Start your day with Yahoo! - make it your home page
Loading...