5 Replies Latest reply on Aug 29, 2002 12:06 PM by benw

    duplicate column name

    scar

      Hello,

      I am calling one [B]create() method in my entity bean. I have correct values for all fields (one int for the primary key and the rest are integer also). When I try to run it I get a strange error which I will paste in at the bottom (duplicate column name).

      17:05:44,030 ERROR [OsdProofsWeekReplace] Could not create entity
      java.sql.SQLException: ORA-00957: duplicate column name

      at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
      at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
      at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
      at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
      at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:822
      )
      at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.ja
      va:1446)
      at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.jav
      a:1371)
      at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStateme
      nt.java:1900)
      .......... and so on.....

        • 1. Re: duplicate column name
          benw

          This is most likely due to trying to map a relationship where the foreign keys are part of the primary keys. Currently, this is not supported by CMP 2.0. If you turn debug on, you will see the exact SQL statements being generated. And you will most likely see that the extra column is the foreign key field.

          Ben

          • 2. Re: duplicate column name
            scar

            Thanks Ben.

            I have not a relationship where the foreign keys are part of the primary keys in my case. I have simple integer primary and integer foreign key only.
            When I have been turned on debug (thanx for your tip), I got next error message in jboss console:

            2002-08-06 09:58:39,167 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.PmInfoVacations] Create: pk=61
            2002-08-06 09:58:39,167 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.PmInfoVacations] Executing SQL: SELECT COUNT(*) FROM
            PM_INFO_VACATIONS WHERE INFO_VACATION_ID=?
            2002-08-06 09:58:39,628 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.PmInfoVacations] Executing SQL: INSERT INTO
            PM_INFO_VACATIONS (INFO_VACATION_ID, CLOCK_NUMBER, LEAVE_DAYS, START_DATE, END_DATE, DECREE_NUMBER, DECREE_DATE, NOTES, LEAVE_KIND_ID,
            CLOCK_NUMBER) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
            2002-08-06 09:58:39,888 ERROR [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.PmInfoVacations] Could not create entity
            java.sql.SQLException: ORA-00957: duplicate column name
            at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)

            Insert statement here is incorrect -- INFO_VACATION_ID is primary key in this table (Integer), first CLOCK_NUMBER - foreign key from another table, LEAVE_KIND_ID - foreign key to another table (it is unimportant in this case) and other fields -- just data. But what is second CLOCK_NUMBER field in this INSERT statement? First CLOCK_NUMBER - real field in the table, but second... Does anybody has any idea?

            Thanks a lot for your help.

            • 3. Re: duplicate column name
              scar

              By the way, I have been tried to remove "duplicatable" field from my entity. Because of my CLOCK_NUMBER field in database is nullable, inserting new data was correct (without duplicate name error message)-- but with NULL value in the CLOCK_NUMBER field of DB. But, there is no way to post new data in new row for CLOCK_NUMBER field -- there is no such field in entity-bean, and as result, there is no method setClockNumber(Integer)...

              Have anybody any idea?

              • 4. Re: duplicate column name
                scar


                Well, if anybody is interesting in subj error, please go to
                http://forum.java.sun.com/thread.jsp?forum=13&thread=285846

                Good luck

                • 5. Re: duplicate column name
                  benw

                  Scar,

                  I have been away for awhile. Are you still having this problem or have you solve it? If you are still trying to fix this (I highly doubt it), can you post the e-r diagram for these two tables (including the columns) and how you are mapping them in your ejb-jar.xml and jbosscmp-jdbc.xml file?

                  Ben