That is a different problem
Does your generated LaborTicket class specify an identity column? Can
you paste the generated Table class, please?

2012/9/13 Rick van Biljouw <[email protected]>:
> Hi,
>
> I've updated all the JooQ libraries to version 2.5.0 and it's now impossible
> for me to actually do anything with the POJO created.
> Following exception is thrown when trying to store the created object:
>>>
>>> Caused by: org.jooq.exception.DataAccessException: SQL [insert into
>>> [LABOR_TICKET] ([ROWID], [TRANSACTION_ID], [WORKORDER_TYPE],
>>> [WORKORDER_BASE_ID], [WORKORDER_LOT_ID], [WORKORDER_SPLIT_ID],
>>> [WORKORDER_SUB_ID], [OPERATION_SEQ_NO], [TYPE], [SETUP_COMPLETED],
>>> [EMPLOYEE_ID], [DEPARTMENT_ID], [RESOURCE_ID], [HOURLY_COST], [CLOCK_IN],
>>> [CLOCK_OUT], [HOURS_WORKED], [HOURS_BREAK], [MULTIPLIER_1], [MULTIPLIER_2],
>>> [GOOD_QTY], [BAD_QTY], [TRANSACTION_DATE], [DESCRIPTION], [USER_ID],
>>> [BURDEN_PER_HR], [BURDEN_PERCENT], [BUR_PER_OPERATION], [POSTING_CANDIDATE],
>>> [HOURS_OVERALL], [HOURS_PREVIOUS], [INDIRECT_CODE], [INDIRECT_ID],
>>> [SHIFT_DATE], [BREAK_CLOCKIN], [HOURS_BREAK_IND], [ACT_LABOR_COST],
>>> [ACT_BURDEN_COST], [CREATE_DATE], [ACT_CLOCK_IN], [ACT_CLOCK_OUT],
>>> [STARTING_TRANS], [BURDEN_PER_UNIT], [UNIT_COST], [GL_ACCT_ID],
>>> [EARNING_CODE_ID], [BUDGET_ACCT_YEAR], [BUDGET_ACCT_PERIOD],
>>> [MILESTONE_TXN_ID], [MILESTONE_UPDATED], [COST_CATEGORY_ID],
>>> [AUTOGEN_TXN_ID], [UNADJ_CLOCK_IN], [UNADJ_CLOCK_OUT], [DEVIATION_ID],
>>> [DATA_COLL_COMP], [PRD_INSP_PLAN_ID], [ACT_RATE_ID], [ACT_PERIOD_ID],
>>> [RETRO_RATE_ID], [RETRO_PERIOD_ID], [RETRO_RATE_CODE]) values (?, ?, ?, ?,
>>> ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
>>> ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
>>> ?, ?, ?, ?, ?, ?, ?, ?)]; Cannot insert explicit value for identity column
>>> in table 'LABOR_TICKET' when IDENTITY_INSERT is set to OFF.
>>>
>>> at org.jooq.impl.Util.translate(Util.java:562) ~[jooq-2.5.0.jar:na]
>>>
>>> at
>>> org.jooq.impl.DefaultExecuteContext.sqlException(DefaultExecuteContext.java:360)
>>> ~[jooq-2.5.0.jar:na]
>>>
>>> at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:176)
>>> ~[jooq-2.5.0.jar:na]
>>>
>>> at org.jooq.impl.TableRecordImpl.storeInsert(TableRecordImpl.java:184)
>>> ~[jooq-2.5.0.jar:na]
>>>
>>> at org.jooq.impl.TableRecordImpl.storeUsing(TableRecordImpl.java:145)
>>> ~[jooq-2.5.0.jar:na]
>>>
>>> at org.jooq.impl.UpdatableRecordImpl.store(UpdatableRecordImpl.java:76)
>>> ~[jooq-2.5.0.jar:na]
>>>
>>> Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Cannot insert
>>> explicit value for identity column in table 'LABOR_TICKET' when
>>> IDENTITY_INSERT is set to OFF.
>>>
>>> at
>>> com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:197)
>>> ~[sqljdbc.jar:na]
>>>
>>> at
>>> com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1493)
>>> ~[sqljdbc.jar:na]
>>>
>>> at
>>> com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:390)
>>> ~[sqljdbc.jar:na]
>>>
>>> at
>>> com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:340)
>>> ~[sqljdbc.jar:na]
>>>
>>> at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4575)
>>> ~[sqljdbc.jar:na]
>>>
>>> at
>>> com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1400)
>>> ~[sqljdbc.jar:na]
>>
>>
> Now I'm really lost..
>
> On Wednesday, September 12, 2012 6:13:04 PM UTC+2, Rick van Biljouw wrote:
>>
>> It would seem that the exception occurs because LaborTicketRecord defines
>> a relation with EmployeeRecord on that particular employeeId, since its a
>> foreign key. That doesn't explain why the type is wrongly converted though
>> as it would seem to me that it should actually fetch the relationships from
>> the database if that is what it does. Perhaps 2.5.0 deals with Records just
>> a little differently and it only appears with this specific use-case? I'll
>> give it a try using just 2.5.0 this evening.

Reply via email to