Re: COMMIT or ROLLBACK TRANSACTION statement is missing.

From: Filip Balas (fbala..mail.com)
Date: Tue Sep 20 2005 - 13:04:06 EDT

  • Next message: Damir Bijuklic: "Registering extended types"

    Okay, for completeness... for anyone else who may
    encounter this problem, just :

    create an identity column
    set the identity column as the PK in the DB and Modeler
    set the other two columns as a combined indices in DB
    (if you need them to be unique as I did)

    Problem goes away.

    Filip

    On 9/20/05, Filip Balas <fbala..mail.com> wrote:
    > After further investigation it appears that
    > the problem has to do with my combined key.
    >
    > I have a table with two fields.
    > disciplineID
    > userID
    > Both are user input and form a combined key.
    >
    > I have these fields set as a combined key
    > in the database. I have the 'PK' boxes selected
    > in the Cayenne modeler and the 'Generated' unchecked.
    >
    > Now when I try to create a new object using Cayenne,
    > An exception is thrown at line 194 of PrimaryKeyHelper.java
    > (using cayenne 1.2M3). I am not familiar with the code
    > but it appears as though Cayenne has tried to generate a PK
    > itself, and then tried to get the database to generate a PK
    > and failed in all cases. My problem is it should not be trying
    > to generate anything at all... once the two required fields are set,
    > the combination IS the PK. I have checked and both fields are set.
    >
    > Am I doing something wrong?
    >
    > Filip
    >
    >
    >
    >
    > On 9/19/05, Filip Balas <fbala..mail.com> wrote:
    > > The following statements:
    > > DisciplineLead_RelationshipConnected aDL_Connected =
    > > (DisciplineLead_RelationshipConnected)
    > > getDataContext().createAndRegisterNewObject(DisciplineLead_RelationshipConnected.class);
    > >
    > > aDL_Connected.setDiscipline(aDL_context, getDiscipline());
    > > aDL_Connected.setUser(aDL_context, getUser());
    > > getDataContext().commitChanges() ;
    > >
    > > Produce the following cayenne exception:
    > > Transaction count after EXECUTE indicates that a COMMIT or ROLLBACK
    > > TRANSACTION statement is missing. Previous count = 0, current count =
    > > 1.
    > >
    > > I do not perform any commits prior to executing this.
    > > How is this possible?
    > >
    > > Filip
    > >
    >



    This archive was generated by hypermail 2.0.0 : Tue Sep 20 2005 - 13:04:07 EDT