[jOOQ/jOOQ#10280] The method name is Meta.snapshot()
This commit is contained in:
parent
5f0de09cbc
commit
2592960afe
@ -1010,8 +1010,9 @@ public class JavaGenerator extends AbstractGenerator {
|
||||
}
|
||||
|
||||
if (scala)
|
||||
out.print("%s.createIndex(\"%s\", %s, Array[%s [_] ](%s), %s)",
|
||||
out.print("%s.createIndex(%s.name(\"%s\"), %s, Array[%s [_] ](%s), %s)",
|
||||
Internal.class,
|
||||
DSL.class,
|
||||
escapeString(index.getOutputName()),
|
||||
out.ref(getStrategy().getFullJavaIdentifier(index.getTable()), 2),
|
||||
OrderField.class,
|
||||
@ -1019,16 +1020,18 @@ public class JavaGenerator extends AbstractGenerator {
|
||||
index.isUnique()
|
||||
);
|
||||
else if (kotlin)
|
||||
out.print("%s.createIndex(\"%s\", %s, arrayOf(%s), %s)",
|
||||
out.print("%s.createIndex(%s.name(\"%s\"), %s, arrayOf(%s), %s)",
|
||||
Internal.class,
|
||||
DSL.class,
|
||||
escapeString(index.getOutputName()),
|
||||
out.ref(getStrategy().getFullJavaIdentifier(index.getTable()), 2),
|
||||
orderFields,
|
||||
index.isUnique()
|
||||
);
|
||||
else
|
||||
out.print("%s.createIndex(\"%s\", %s, new %s[] { %s }, %s)",
|
||||
out.print("%s.createIndex(%s.name(\"%s\"), %s, new %s[] { %s }, %s)",
|
||||
Internal.class,
|
||||
DSL.class,
|
||||
escapeString(index.getOutputName()),
|
||||
out.ref(getStrategy().getFullJavaIdentifier(index.getTable()), 2),
|
||||
OrderField.class,
|
||||
@ -1132,25 +1135,28 @@ public class JavaGenerator extends AbstractGenerator {
|
||||
|
||||
private void printCreateUniqueKey(JavaWriter out, UniqueKeyDefinition uniqueKey) {
|
||||
if (scala)
|
||||
out.print("%s.createUniqueKey(%s, \"%s\", Array([[%s]]).asInstanceOf[Array[%s[%s, _] ] ], %s)",
|
||||
out.print("%s.createUniqueKey(%s, %s.name(\"%s\"), Array([[%s]]).asInstanceOf[Array[%s[%s, _] ] ], %s)",
|
||||
Internal.class,
|
||||
out.ref(getStrategy().getFullJavaIdentifier(uniqueKey.getTable()), 2),
|
||||
DSL.class,
|
||||
escapeString(uniqueKey.getOutputName()),
|
||||
out.ref(getStrategy().getFullJavaIdentifiers(uniqueKey.getKeyColumns()), colRefSegments(null)),
|
||||
TableField.class,
|
||||
out.ref(getStrategy().getJavaClassName(uniqueKey.getTable(), Mode.RECORD)),
|
||||
uniqueKey.enforced());
|
||||
else if (kotlin)
|
||||
out.print("%s.createUniqueKey(%s, \"%s\", arrayOf([[%s]]), %s)",
|
||||
out.print("%s.createUniqueKey(%s, %s.name(\"%s\"), arrayOf([[%s]]), %s)",
|
||||
Internal.class,
|
||||
out.ref(getStrategy().getFullJavaIdentifier(uniqueKey.getTable()), 2),
|
||||
DSL.class,
|
||||
escapeString(uniqueKey.getOutputName()),
|
||||
out.ref(getStrategy().getFullJavaIdentifiers(uniqueKey.getKeyColumns()), colRefSegments(null)),
|
||||
uniqueKey.enforced());
|
||||
else
|
||||
out.print("%s.createUniqueKey(%s, \"%s\", new %s[] { [[%s]] }, %s)",
|
||||
out.print("%s.createUniqueKey(%s, %s.name(\"%s\"), new %s[] { [[%s]] }, %s)",
|
||||
Internal.class,
|
||||
out.ref(getStrategy().getFullJavaIdentifier(uniqueKey.getTable()), 2),
|
||||
DSL.class,
|
||||
escapeString(uniqueKey.getOutputName()),
|
||||
TableField.class,
|
||||
out.ref(getStrategy().getFullJavaIdentifiers(uniqueKey.getKeyColumns()), colRefSegments(null)),
|
||||
@ -1174,7 +1180,7 @@ public class JavaGenerator extends AbstractGenerator {
|
||||
}
|
||||
|
||||
if (scala)
|
||||
out.println("val %s: %s[%s, %s] = %s.createForeignKey(%s, %s, \"%s\", Array([[%s]]).asInstanceOf[Array[%s[%s, _] ] ], %s)",
|
||||
out.println("val %s: %s[%s, %s] = %s.createForeignKey(%s, %s, %s.name(\"%s\"), Array([[%s]]).asInstanceOf[Array[%s[%s, _] ] ], %s)",
|
||||
getStrategy().getJavaIdentifier(foreignKey),
|
||||
ForeignKey.class,
|
||||
out.ref(getStrategy().getFullJavaClassName(foreignKey.getKeyTable(), Mode.RECORD)),
|
||||
@ -1182,13 +1188,14 @@ public class JavaGenerator extends AbstractGenerator {
|
||||
Internal.class,
|
||||
out.ref(getStrategy().getFullJavaIdentifier(foreignKey.getReferencedKey()), 2),
|
||||
out.ref(getStrategy().getFullJavaIdentifier(foreignKey.getKeyTable()), 2),
|
||||
DSL.class,
|
||||
escapeString(foreignKey.getOutputName()),
|
||||
out.ref(getStrategy().getFullJavaIdentifiers(foreignKey.getKeyColumns()), colRefSegments(null)),
|
||||
TableField.class,
|
||||
out.ref(getStrategy().getJavaClassName(foreignKey.getTable(), Mode.RECORD)),
|
||||
foreignKey.enforced());
|
||||
else if (kotlin)
|
||||
out.println("val %s: %s<%s, %s> = %s.createForeignKey(%s, %s, \"%s\", arrayOf([[%s]]), %s)",
|
||||
out.println("val %s: %s<%s, %s> = %s.createForeignKey(%s, %s, %s.name(\"%s\"), arrayOf([[%s]]), %s)",
|
||||
getStrategy().getJavaIdentifier(foreignKey),
|
||||
ForeignKey.class,
|
||||
out.ref(getStrategy().getFullJavaClassName(foreignKey.getKeyTable(), Mode.RECORD)),
|
||||
@ -1196,11 +1203,12 @@ public class JavaGenerator extends AbstractGenerator {
|
||||
Internal.class,
|
||||
out.ref(getStrategy().getFullJavaIdentifier(foreignKey.getReferencedKey()), 2),
|
||||
out.ref(getStrategy().getFullJavaIdentifier(foreignKey.getKeyTable()), 2),
|
||||
DSL.class,
|
||||
escapeString(foreignKey.getOutputName()),
|
||||
out.ref(getStrategy().getFullJavaIdentifiers(foreignKey.getKeyColumns()), colRefSegments(null)),
|
||||
foreignKey.enforced());
|
||||
else
|
||||
out.println("static final %s<%s, %s> %s = %s.createForeignKey(%s, %s, \"%s\", new %s[] { [[%s]] }, %s);",
|
||||
out.println("static final %s<%s, %s> %s = %s.createForeignKey(%s, %s, %s.name(\"%s\"), new %s[] { [[%s]] }, %s);",
|
||||
ForeignKey.class,
|
||||
out.ref(getStrategy().getFullJavaClassName(foreignKey.getKeyTable(), Mode.RECORD)),
|
||||
out.ref(getStrategy().getFullJavaClassName(foreignKey.getReferencedTable(), Mode.RECORD)),
|
||||
@ -1208,6 +1216,7 @@ public class JavaGenerator extends AbstractGenerator {
|
||||
Internal.class,
|
||||
out.ref(getStrategy().getFullJavaIdentifier(foreignKey.getReferencedKey()), 2),
|
||||
out.ref(getStrategy().getFullJavaIdentifier(foreignKey.getKeyTable()), 2),
|
||||
DSL.class,
|
||||
escapeString(foreignKey.getOutputName()),
|
||||
TableField.class,
|
||||
out.ref(getStrategy().getFullJavaIdentifiers(foreignKey.getKeyColumns()), colRefSegments(null)),
|
||||
|
||||
@ -11,6 +11,7 @@ import org.jooq.example.flyway.ddl.db.h2.tables.Author;
|
||||
import org.jooq.example.flyway.ddl.db.h2.tables.Book;
|
||||
import org.jooq.example.flyway.ddl.db.h2.tables.records.AuthorRecord;
|
||||
import org.jooq.example.flyway.ddl.db.h2.tables.records.BookRecord;
|
||||
import org.jooq.impl.DSL;
|
||||
import org.jooq.impl.Internal;
|
||||
|
||||
|
||||
@ -44,11 +45,11 @@ public class Keys {
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
private static class UniqueKeys0 {
|
||||
static final UniqueKey<AuthorRecord> PK_T_AUTHOR = Internal.createUniqueKey(Author.AUTHOR, "PK_T_AUTHOR", new TableField[] { Author.AUTHOR.ID }, true);
|
||||
static final UniqueKey<BookRecord> PK_T_BOOK = Internal.createUniqueKey(Book.BOOK, "PK_T_BOOK", new TableField[] { Book.BOOK.ID }, true);
|
||||
static final UniqueKey<AuthorRecord> PK_T_AUTHOR = Internal.createUniqueKey(Author.AUTHOR, DSL.name("PK_T_AUTHOR"), new TableField[] { Author.AUTHOR.ID }, true);
|
||||
static final UniqueKey<BookRecord> PK_T_BOOK = Internal.createUniqueKey(Book.BOOK, DSL.name("PK_T_BOOK"), new TableField[] { Book.BOOK.ID }, true);
|
||||
}
|
||||
|
||||
private static class ForeignKeys0 {
|
||||
static final ForeignKey<BookRecord, AuthorRecord> FK_T_BOOK_AUTHOR_ID = Internal.createForeignKey(Keys.PK_T_AUTHOR, Book.BOOK, "FK_T_BOOK_AUTHOR_ID", new TableField[] { Book.BOOK.AUTHOR_ID }, true);
|
||||
static final ForeignKey<BookRecord, AuthorRecord> FK_T_BOOK_AUTHOR_ID = Internal.createForeignKey(Keys.PK_T_AUTHOR, Book.BOOK, DSL.name("FK_T_BOOK_AUTHOR_ID"), new TableField[] { Book.BOOK.AUTHOR_ID }, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,6 +15,7 @@ import org.jooq.example.kotlin.db.h2.tables.records.AuthorRecord
|
||||
import org.jooq.example.kotlin.db.h2.tables.records.BookRecord
|
||||
import org.jooq.example.kotlin.db.h2.tables.records.BookStoreRecord
|
||||
import org.jooq.example.kotlin.db.h2.tables.records.BookToBookStoreRecord
|
||||
import org.jooq.impl.DSL
|
||||
import org.jooq.impl.Internal
|
||||
|
||||
|
||||
@ -60,16 +61,16 @@ object Keys {
|
||||
}
|
||||
|
||||
private object UniqueKeys0 {
|
||||
val PK_T_AUTHOR: UniqueKey<AuthorRecord> = Internal.createUniqueKey(Author.AUTHOR, "PK_T_AUTHOR", arrayOf(Author.AUTHOR.ID), true)
|
||||
val PK_T_BOOK: UniqueKey<BookRecord> = Internal.createUniqueKey(Book.BOOK, "PK_T_BOOK", arrayOf(Book.BOOK.ID), true)
|
||||
val UK_T_BOOK_STORE_NAME: UniqueKey<BookStoreRecord> = Internal.createUniqueKey(BookStore.BOOK_STORE, "UK_T_BOOK_STORE_NAME", arrayOf(BookStore.BOOK_STORE.NAME), true)
|
||||
val PK_B2BS: UniqueKey<BookToBookStoreRecord> = Internal.createUniqueKey(BookToBookStore.BOOK_TO_BOOK_STORE, "PK_B2BS", arrayOf(BookToBookStore.BOOK_TO_BOOK_STORE.BOOK_STORE_NAME, BookToBookStore.BOOK_TO_BOOK_STORE.BOOK_ID), true)
|
||||
val PK_T_AUTHOR: UniqueKey<AuthorRecord> = Internal.createUniqueKey(Author.AUTHOR, DSL.name("PK_T_AUTHOR"), arrayOf(Author.AUTHOR.ID), true)
|
||||
val PK_T_BOOK: UniqueKey<BookRecord> = Internal.createUniqueKey(Book.BOOK, DSL.name("PK_T_BOOK"), arrayOf(Book.BOOK.ID), true)
|
||||
val UK_T_BOOK_STORE_NAME: UniqueKey<BookStoreRecord> = Internal.createUniqueKey(BookStore.BOOK_STORE, DSL.name("UK_T_BOOK_STORE_NAME"), arrayOf(BookStore.BOOK_STORE.NAME), true)
|
||||
val PK_B2BS: UniqueKey<BookToBookStoreRecord> = Internal.createUniqueKey(BookToBookStore.BOOK_TO_BOOK_STORE, DSL.name("PK_B2BS"), arrayOf(BookToBookStore.BOOK_TO_BOOK_STORE.BOOK_STORE_NAME, BookToBookStore.BOOK_TO_BOOK_STORE.BOOK_ID), true)
|
||||
}
|
||||
|
||||
private object ForeignKeys0 {
|
||||
val FK_T_BOOK_AUTHOR_ID: ForeignKey<BookRecord, AuthorRecord> = Internal.createForeignKey(Keys.PK_T_AUTHOR, Book.BOOK, "FK_T_BOOK_AUTHOR_ID", arrayOf(Book.BOOK.AUTHOR_ID), true)
|
||||
val FK_T_BOOK_CO_AUTHOR_ID: ForeignKey<BookRecord, AuthorRecord> = Internal.createForeignKey(Keys.PK_T_AUTHOR, Book.BOOK, "FK_T_BOOK_CO_AUTHOR_ID", arrayOf(Book.BOOK.CO_AUTHOR_ID), true)
|
||||
val FK_B2BS_BS_NAME: ForeignKey<BookToBookStoreRecord, BookStoreRecord> = Internal.createForeignKey(Keys.UK_T_BOOK_STORE_NAME, BookToBookStore.BOOK_TO_BOOK_STORE, "FK_B2BS_BS_NAME", arrayOf(BookToBookStore.BOOK_TO_BOOK_STORE.BOOK_STORE_NAME), true)
|
||||
val FK_B2BS_B_ID: ForeignKey<BookToBookStoreRecord, BookRecord> = Internal.createForeignKey(Keys.PK_T_BOOK, BookToBookStore.BOOK_TO_BOOK_STORE, "FK_B2BS_B_ID", arrayOf(BookToBookStore.BOOK_TO_BOOK_STORE.BOOK_ID), true)
|
||||
val FK_T_BOOK_AUTHOR_ID: ForeignKey<BookRecord, AuthorRecord> = Internal.createForeignKey(Keys.PK_T_AUTHOR, Book.BOOK, DSL.name("FK_T_BOOK_AUTHOR_ID"), arrayOf(Book.BOOK.AUTHOR_ID), true)
|
||||
val FK_T_BOOK_CO_AUTHOR_ID: ForeignKey<BookRecord, AuthorRecord> = Internal.createForeignKey(Keys.PK_T_AUTHOR, Book.BOOK, DSL.name("FK_T_BOOK_CO_AUTHOR_ID"), arrayOf(Book.BOOK.CO_AUTHOR_ID), true)
|
||||
val FK_B2BS_BS_NAME: ForeignKey<BookToBookStoreRecord, BookStoreRecord> = Internal.createForeignKey(Keys.UK_T_BOOK_STORE_NAME, BookToBookStore.BOOK_TO_BOOK_STORE, DSL.name("FK_B2BS_BS_NAME"), arrayOf(BookToBookStore.BOOK_TO_BOOK_STORE.BOOK_STORE_NAME), true)
|
||||
val FK_B2BS_B_ID: ForeignKey<BookToBookStoreRecord, BookRecord> = Internal.createForeignKey(Keys.PK_T_BOOK, BookToBookStore.BOOK_TO_BOOK_STORE, DSL.name("FK_B2BS_B_ID"), arrayOf(BookToBookStore.BOOK_TO_BOOK_STORE.BOOK_ID), true)
|
||||
}
|
||||
}
|
||||
|
||||
@ -291,7 +291,7 @@ public interface Meta extends Scope {
|
||||
* Eager-create an in-memory copy of this {@link Meta} instance without any
|
||||
* connection to the original data source.
|
||||
*/
|
||||
Meta detach() throws DataAccessException;
|
||||
Meta snapshot() throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Generate a creation script for the entire meta data.
|
||||
|
||||
@ -463,8 +463,8 @@ abstract class AbstractMeta extends AbstractScope implements Meta, Serializable
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Meta detach() {
|
||||
return new DetachedMeta(this);
|
||||
public final Meta snapshot() {
|
||||
return new Snapshot(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -68,12 +68,12 @@ import org.jooq.exception.DataAccessException;
|
||||
*
|
||||
* @author Knut Wannheden
|
||||
*/
|
||||
final class DetachedMeta extends AbstractMeta {
|
||||
final class Snapshot extends AbstractMeta {
|
||||
|
||||
private static final long serialVersionUID = 5561057000510740144L;
|
||||
private Meta delegate;
|
||||
|
||||
DetachedMeta(Meta meta) {
|
||||
Snapshot(Meta meta) {
|
||||
super(meta.configuration());
|
||||
|
||||
delegate = meta;
|
||||
@ -117,7 +117,7 @@ final class DetachedMeta extends AbstractMeta {
|
||||
|
||||
@Override
|
||||
public final List<Schema> getSchemas() {
|
||||
return Collections.unmodifiableList(schemas);
|
||||
return Collections.<Schema>unmodifiableList(schemas);
|
||||
}
|
||||
}
|
||||
|
||||
@ -154,22 +154,22 @@ final class DetachedMeta extends AbstractMeta {
|
||||
|
||||
@Override
|
||||
public final List<Domain<?>> getDomains() {
|
||||
return Collections.unmodifiableList(domains);
|
||||
return Collections.<Domain<?>>unmodifiableList(domains);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final List<Table<?>> getTables() {
|
||||
return Collections.unmodifiableList(tables);
|
||||
return Collections.<Table<?>>unmodifiableList(tables);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final List<Sequence<?>> getSequences() {
|
||||
return Collections.unmodifiableList(sequences);
|
||||
return Collections.<Sequence<?>>unmodifiableList(sequences);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final List<UDT<?>> getUDTs() {
|
||||
return Collections.unmodifiableList(udts);
|
||||
return Collections.<UDT<?>>unmodifiableList(udts);
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,7 +96,7 @@ final class TranslatingMetaProvider implements MetaProvider {
|
||||
for (Source script : scripts)
|
||||
initializer.loadScript(script);
|
||||
|
||||
return new DetachedMeta(new DefaultMetaProvider(
|
||||
return new Snapshot(new DefaultMetaProvider(
|
||||
configuration.derive().set(initializer.connection).set(configuration.settings().getInterpreterDialect())
|
||||
).provide());
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user