-
1. Re: duplicate column name
benw Aug 5, 2002 4:04 PM (in response to scar)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 Aug 6, 2002 4:15 AM (in response to 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 Aug 7, 2002 3:31 AM (in response to 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 Aug 8, 2002 11:39 AM (in response to 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 Aug 29, 2002 12:06 PM (in response to scar)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