Have you tried
AmlTestResults tr = AML_TEST_RESULTS.as("tr");
create.insertInto(AML_TETS_RESULTS, tr.ID, tr.BANK_ID, tr.RUN_ID, tr.TEST_NAME, tr.TEST_SCORE)
                .values(34L, 123, "T1", "ThisIsATest", -1000000).execute();

On 04/07/2014 11:19 AM, [email protected] wrote:
Hello-

I'm actually a commercial user, but have a low-priority support question. I have generated bindings and I have code, following the examples, like:

  AmlTestResults tr = AML_TEST_RESULTS.as("tr");
create.insertInto(tr, tr.ID, tr.BANK_ID, tr.RUN_ID, tr.TEST_NAME, tr.TEST_SCORE) .values(34L, 123, "T1", "ThisIsATest", -1000000).execute();

However, I see that this generates sql incorrectly. The table name is AML_TEST_RESULTS but it creates the insert statement with the alias instead of the table name!

DEBUG Executing query : insert into [tr] ([id], [bank_id], [run_id], [test_name], [test_score]) values (?, ?, ?, ?, ?) DEBUG -> with bind values : insert into [tr] ([id], [bank_id], [run_id], [test_name], [test_score]) values (34, 123, 'T1', 'ThisIsATest', -1000000)
DEBUG Exception                : Total: 81.936ms
DEBUG Finishing                : Total: 83.077ms, +1.14ms

org.springframework.jdbc.UncategorizedSQLException: jOOQ; uncategorized SQLException for SQL [insert into [tr] ([id], [bank_id], [run_id], [test_name], [test_score]) values (?, ?, ?, ?, ?)]; SQL state [S0002]; error code [208]; Invalid object name 'tr'.; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name 'tr'. at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:84) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81) at com.argodata.fraud.commons.database.mapping.JooqExceptionTranslator.exception(JooqExceptionTranslator.java:21)
    at org.jooq.impl.ExecuteListeners.exception(ExecuteListeners.java:232)
    at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:328)
at org.jooq.impl.AbstractDelegatingQuery.execute(AbstractDelegatingQuery.java:140)


The workaround of doing create.insertInto(AML_TEST_RESULTS, tr.ID, ..) works fine, but it seems like I should be able to do the other as well, no?

Also, as a minor nit: in all of the documentation examples here http://www.jooq.org/doc/3.3/manual/sql-building/sql-statements/insert-statement/ it never shows that you need to call .execute() at the end. This was pretty obvious to debug, but still a minor annoyance for someone new to jooq.

Thanks!
Steve Ash
--
You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "jOOQ User 
Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to