Re: many to many relation

From: gilbertoca (gilbertoc..mail.com)
Date: Thu Sep 30 2010 - 18:19:21 UTC

  • Next message: Mike Kienenberger: "Re: many to many relations and default values for the association table?"

    gilbertoca wrote:
    >
    > Yes, but for some reason it leaves the database in a inconsistent state:
    >
    >
    >> Testcase:
    >> com.google.constructor.extras.security.shiro.cayenne.UserCayenneTest:
    >> Caused an ERROR
    >> Referential integrity constraint violation: "FK_SHIRO_USER_ROLE_ROLE_ID:
    >> PUBLIC.SHIRO_USER_ROLE FOREIGN KEY(ROLE_ID) REFERENCES
    >> PUBLIC.SHIRO_ROLE(ID)"; SQL statement:
    >> delete from SHIRO_ROLE where ID = ? [23003-131]
    >> org.h2.jdbc.JdbcSQLException: Referential integrity constraint violation:
    >> "FK_SHIRO_USER_ROLE_ROLE_ID: PUBLIC.SHIRO_USER_ROLE FOREIGN KEY(ROLE_ID)
    >> REFERENCES PUBLIC.SHIRO_ROLE(ID)"; SQL statement:
    >> delete from SHIRO_ROLE where ID = ? [23003-131]
    >> at
    >> org.h2.message.DbException.getJdbcSQLException(DbException.java:316)
    >>
    > I will try to find the problem!
    >
    >
    I've found the problem. I was using:
    userUpdated.getRoles().remove(roleADMIN);

    instead of

    userUpdated.removeFromRoles(roleADMIN);

    So, can't I use those LIST methods with Cayenne? Just the Cayenne one!

    Thanks a lot, Robert.

    Regards,

    Gilberto

    -- 
    View this message in context: http://cayenne.195.n3.nabble.com/many-to-many-relation-tp3491p1609999.html
    Sent from the Cayenne - User mailing list archive at Nabble.com.
    



    This archive was generated by hypermail 2.0.0 : Thu Sep 30 2010 - 18:19:48 UTC