0 Replies Latest reply on Aug 6, 2002 12:25 PM by scar

    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 an 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.....


      When I have been removed relationships with another entity beans in my cantainer, [B]create()[/B] method works correctly -- insert new string into my table. I have many such entity beans and I got one thing -- I may call [B]create()[/B] method succesfully when current bean HAS NOT relationships FROM another beans...

      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, 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?

      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)