[#3154] Add code-generation configuration to generate synthetic primary keys for updatable views
This commit is contained in:
parent
e83850b356
commit
7ea042aa4c
@ -488,9 +488,13 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T7
|
||||
|
||||
// Check if relations are correctly loaded (and typed) as well
|
||||
if (generatedTable.getPrimaryKey() != null) {
|
||||
assertNotNull(metaTable.getPrimaryKey());
|
||||
assertEquals(generatedTable, metaTable.getPrimaryKey().getTable());
|
||||
assertEquals(generatedTable.getPrimaryKey().getFields(), metaTable.getPrimaryKey().getFields());
|
||||
|
||||
// [#3154] In H2, we now have synthetic primary keys on views
|
||||
if (dialect() != H2 || !generatedTable.getName().toLowerCase().startsWith("v_")) {
|
||||
assertNotNull(metaTable.getPrimaryKey());
|
||||
assertEquals(generatedTable, metaTable.getPrimaryKey().getTable());
|
||||
assertEquals(generatedTable.getPrimaryKey().getFields(), metaTable.getPrimaryKey().getFields());
|
||||
}
|
||||
}
|
||||
|
||||
// Only truly updatable tables should be "Updatable"
|
||||
|
||||
@ -0,0 +1,82 @@
|
||||
/**
|
||||
* This class is generated by jOOQ
|
||||
*/
|
||||
package org.jooq.test.h2.generatedclasses.tables.daos;
|
||||
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class VAuthorDao extends org.jooq.impl.DAOImpl<org.jooq.test.h2.generatedclasses.tables.records.VAuthorRecord, org.jooq.test.h2.generatedclasses.tables.pojos.VAuthor, java.lang.Integer> {
|
||||
|
||||
/**
|
||||
* Create a new VAuthorDao without any configuration
|
||||
*/
|
||||
public VAuthorDao() {
|
||||
super(org.jooq.test.h2.generatedclasses.tables.VAuthor.V_AUTHOR, org.jooq.test.h2.generatedclasses.tables.pojos.VAuthor.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new VAuthorDao with an attached configuration
|
||||
*/
|
||||
public VAuthorDao(org.jooq.Configuration configuration) {
|
||||
super(org.jooq.test.h2.generatedclasses.tables.VAuthor.V_AUTHOR, org.jooq.test.h2.generatedclasses.tables.pojos.VAuthor.class, configuration);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected java.lang.Integer getId(org.jooq.test.h2.generatedclasses.tables.pojos.VAuthor object) {
|
||||
return object.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch records that have <code>ID IN (values)</code>
|
||||
*/
|
||||
public java.util.List<org.jooq.test.h2.generatedclasses.tables.pojos.VAuthor> fetchById(java.lang.Integer... values) {
|
||||
return fetch(org.jooq.test.h2.generatedclasses.tables.VAuthor.V_AUTHOR.ID, values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch a unique record that has <code>ID = value</code>
|
||||
*/
|
||||
public org.jooq.test.h2.generatedclasses.tables.pojos.VAuthor fetchOneById(java.lang.Integer value) {
|
||||
return fetchOne(org.jooq.test.h2.generatedclasses.tables.VAuthor.V_AUTHOR.ID, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch records that have <code>FIRST_NAME IN (values)</code>
|
||||
*/
|
||||
public java.util.List<org.jooq.test.h2.generatedclasses.tables.pojos.VAuthor> fetchByFirstName(java.lang.String... values) {
|
||||
return fetch(org.jooq.test.h2.generatedclasses.tables.VAuthor.V_AUTHOR.FIRST_NAME, values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch records that have <code>LAST_NAME IN (values)</code>
|
||||
*/
|
||||
public java.util.List<org.jooq.test.h2.generatedclasses.tables.pojos.VAuthor> fetchByLastName(java.lang.String... values) {
|
||||
return fetch(org.jooq.test.h2.generatedclasses.tables.VAuthor.V_AUTHOR.LAST_NAME, values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch records that have <code>DATE_OF_BIRTH IN (values)</code>
|
||||
*/
|
||||
public java.util.List<org.jooq.test.h2.generatedclasses.tables.pojos.VAuthor> fetchByDateOfBirth(java.sql.Date... values) {
|
||||
return fetch(org.jooq.test.h2.generatedclasses.tables.VAuthor.V_AUTHOR.DATE_OF_BIRTH, values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch records that have <code>YEAR_OF_BIRTH IN (values)</code>
|
||||
*/
|
||||
public java.util.List<org.jooq.test.h2.generatedclasses.tables.pojos.VAuthor> fetchByYearOfBirth(java.lang.Integer... values) {
|
||||
return fetch(org.jooq.test.h2.generatedclasses.tables.VAuthor.V_AUTHOR.YEAR_OF_BIRTH, values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch records that have <code>ADDRESS IN (values)</code>
|
||||
*/
|
||||
public java.util.List<org.jooq.test.h2.generatedclasses.tables.pojos.VAuthor> fetchByAddress(java.lang.String... values) {
|
||||
return fetch(org.jooq.test.h2.generatedclasses.tables.VAuthor.V_AUTHOR.ADDRESS, values);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,117 @@
|
||||
/**
|
||||
* This class is generated by jOOQ
|
||||
*/
|
||||
package org.jooq.test.h2.generatedclasses.tables.daos;
|
||||
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class VBookDao extends org.jooq.impl.DAOImpl<org.jooq.test.h2.generatedclasses.tables.records.VBookRecord, org.jooq.test.h2.generatedclasses.tables.pojos.VBook, java.lang.Integer> {
|
||||
|
||||
/**
|
||||
* Create a new VBookDao without any configuration
|
||||
*/
|
||||
public VBookDao() {
|
||||
super(org.jooq.test.h2.generatedclasses.tables.VBook.V_BOOK, org.jooq.test.h2.generatedclasses.tables.pojos.VBook.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new VBookDao with an attached configuration
|
||||
*/
|
||||
public VBookDao(org.jooq.Configuration configuration) {
|
||||
super(org.jooq.test.h2.generatedclasses.tables.VBook.V_BOOK, org.jooq.test.h2.generatedclasses.tables.pojos.VBook.class, configuration);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected java.lang.Integer getId(org.jooq.test.h2.generatedclasses.tables.pojos.VBook object) {
|
||||
return object.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch records that have <code>ID IN (values)</code>
|
||||
*/
|
||||
public java.util.List<org.jooq.test.h2.generatedclasses.tables.pojos.VBook> fetchById(java.lang.Integer... values) {
|
||||
return fetch(org.jooq.test.h2.generatedclasses.tables.VBook.V_BOOK.ID, values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch a unique record that has <code>ID = value</code>
|
||||
*/
|
||||
public org.jooq.test.h2.generatedclasses.tables.pojos.VBook fetchOneById(java.lang.Integer value) {
|
||||
return fetchOne(org.jooq.test.h2.generatedclasses.tables.VBook.V_BOOK.ID, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch records that have <code>AUTHOR_ID IN (values)</code>
|
||||
*/
|
||||
public java.util.List<org.jooq.test.h2.generatedclasses.tables.pojos.VBook> fetchByAuthorId(java.lang.Integer... values) {
|
||||
return fetch(org.jooq.test.h2.generatedclasses.tables.VBook.V_BOOK.AUTHOR_ID, values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch records that have <code>CO_AUTHOR_ID IN (values)</code>
|
||||
*/
|
||||
public java.util.List<org.jooq.test.h2.generatedclasses.tables.pojos.VBook> fetchByCoAuthorId(java.lang.Integer... values) {
|
||||
return fetch(org.jooq.test.h2.generatedclasses.tables.VBook.V_BOOK.CO_AUTHOR_ID, values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch records that have <code>DETAILS_ID IN (values)</code>
|
||||
*/
|
||||
public java.util.List<org.jooq.test.h2.generatedclasses.tables.pojos.VBook> fetchByDetailsId(java.lang.Integer... values) {
|
||||
return fetch(org.jooq.test.h2.generatedclasses.tables.VBook.V_BOOK.DETAILS_ID, values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch records that have <code>TITLE IN (values)</code>
|
||||
*/
|
||||
public java.util.List<org.jooq.test.h2.generatedclasses.tables.pojos.VBook> fetchByTitle(java.lang.String... values) {
|
||||
return fetch(org.jooq.test.h2.generatedclasses.tables.VBook.V_BOOK.TITLE, values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch records that have <code>PUBLISHED_IN IN (values)</code>
|
||||
*/
|
||||
public java.util.List<org.jooq.test.h2.generatedclasses.tables.pojos.VBook> fetchByPublishedIn(java.lang.Integer... values) {
|
||||
return fetch(org.jooq.test.h2.generatedclasses.tables.VBook.V_BOOK.PUBLISHED_IN, values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch records that have <code>LANGUAGE_ID IN (values)</code>
|
||||
*/
|
||||
public java.util.List<org.jooq.test.h2.generatedclasses.tables.pojos.VBook> fetchByLanguageId(java.lang.Integer... values) {
|
||||
return fetch(org.jooq.test.h2.generatedclasses.tables.VBook.V_BOOK.LANGUAGE_ID, values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch records that have <code>CONTENT_TEXT IN (values)</code>
|
||||
*/
|
||||
public java.util.List<org.jooq.test.h2.generatedclasses.tables.pojos.VBook> fetchByContentText(java.lang.String... values) {
|
||||
return fetch(org.jooq.test.h2.generatedclasses.tables.VBook.V_BOOK.CONTENT_TEXT, values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch records that have <code>CONTENT_PDF IN (values)</code>
|
||||
*/
|
||||
public java.util.List<org.jooq.test.h2.generatedclasses.tables.pojos.VBook> fetchByContentPdf(byte[]... values) {
|
||||
return fetch(org.jooq.test.h2.generatedclasses.tables.VBook.V_BOOK.CONTENT_PDF, values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch records that have <code>REC_VERSION IN (values)</code>
|
||||
*/
|
||||
public java.util.List<org.jooq.test.h2.generatedclasses.tables.pojos.VBook> fetchByRecVersion(java.lang.Integer... values) {
|
||||
return fetch(org.jooq.test.h2.generatedclasses.tables.VBook.V_BOOK.REC_VERSION, values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch records that have <code>REC_TIMESTAMP IN (values)</code>
|
||||
*/
|
||||
public java.util.List<org.jooq.test.h2.generatedclasses.tables.pojos.VBook> fetchByRecTimestamp(java.sql.Timestamp... values) {
|
||||
return fetch(org.jooq.test.h2.generatedclasses.tables.VBook.V_BOOK.REC_TIMESTAMP, values);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user