congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
TableInfo.getTableName
Code IndexAdd Tabnine to your IDE (free)

How to use
getTableName
method
in
com.j256.ormlite.table.TableInfo

Best Java code snippets using com.j256.ormlite.table.TableInfo.getTableName (Showing top 20 results out of 315)

origin: com.j256.ormlite/ormlite-core

public StatementBuilder(DatabaseType databaseType, TableInfo<T, ID> tableInfo, Dao<T, ID> dao, StatementType type) {
  this.databaseType = databaseType;
  this.tableInfo = tableInfo;
  this.tableName = tableInfo.getTableName();
  this.dao = dao;
  this.type = type;
  if (!type.isOkForStatementBuilder()) {
    throw new IllegalStateException("Building a statement from a " + type + " statement is not allowed");
  }
}
origin: j256/ormlite-core

public StatementBuilder(DatabaseType databaseType, TableInfo<T, ID> tableInfo, Dao<T, ID> dao, StatementType type) {
  this.databaseType = databaseType;
  this.tableInfo = tableInfo;
  this.tableName = tableInfo.getTableName();
  this.dao = dao;
  this.type = type;
  if (!type.isOkForStatementBuilder()) {
    throw new IllegalStateException("Building a statement from a " + type + " statement is not allowed");
  }
}
origin: j256/ormlite-core

@Override
protected void appendStatementStart(StringBuilder sb, List<ArgumentHolder> argList) {
  sb.append("DELETE FROM ");
  databaseType.appendEscapedEntityName(sb, tableInfo.getTableName());
  sb.append(' ');
}
origin: j256/ormlite-core

protected static <T, ID> String buildStatement(DatabaseType databaseType, TableInfo<T, ID> tableInfo,
    FieldType idFieldType) {
  // build the select statement by hand
  StringBuilder sb = new StringBuilder(64);
  appendTableName(databaseType, sb, "SELECT * FROM ", tableInfo.getTableName());
  appendWhereFieldEq(databaseType, idFieldType, sb, null);
  return sb.toString();
}
origin: j256/ormlite-core

@Override
public boolean isTableExists() throws SQLException {
  checkForInitialized();
  DatabaseConnection connection = connectionSource.getReadOnlyConnection(tableInfo.getTableName());
  try {
    return connection.isTableExists(tableInfo.getTableName());
  } finally {
    connectionSource.releaseConnection(connection);
  }
}
origin: j256/ormlite-core

@Override
public boolean idExists(ID id) throws SQLException {
  DatabaseConnection connection = connectionSource.getReadOnlyConnection(tableInfo.getTableName());
  try {
    return statementExecutor.ifExists(connection, id);
  } finally {
    connectionSource.releaseConnection(connection);
  }
}
origin: j256/ormlite-core

/**
 * Call batch tasks inside of a connection which may, or may not, have been "saved".
 */
public <CT> CT callBatchTasks(ConnectionSource connectionSource, Callable<CT> callable) throws SQLException {
  if (connectionSource.isSingleConnection(tableInfo.getTableName())) {
    synchronized (this) {
      return doCallBatchTasks(connectionSource, callable);
    }
  } else {
    return doCallBatchTasks(connectionSource, callable);
  }
}
origin: j256/ormlite-core

public static <T, ID> MappedDelete<T, ID> build(Dao<T, ID> dao, TableInfo<T, ID> tableInfo) throws SQLException {
  FieldType idField = tableInfo.getIdField();
  if (idField == null) {
    throw new SQLException(
        "Cannot delete from " + tableInfo.getDataClass() + " because it doesn't have an id field");
  }
  StringBuilder sb = new StringBuilder(64);
  DatabaseType databaseType = dao.getConnectionSource().getDatabaseType();
  appendTableName(databaseType, sb, "DELETE FROM ", tableInfo.getTableName());
  appendWhereFieldEq(databaseType, idField, sb, null);
  return new MappedDelete<T, ID>(dao, tableInfo, sb.toString(), new FieldType[] { idField });
}
origin: j256/ormlite-core

@Override
public T queryForId(ID id) throws SQLException {
  checkForInitialized();
  DatabaseConnection connection = connectionSource.getReadOnlyConnection(tableInfo.getTableName());
  try {
    return statementExecutor.queryForId(connection, id, objectCache);
  } finally {
    connectionSource.releaseConnection(connection);
  }
}
origin: j256/ormlite-core

@Override
public T queryForFirst(PreparedQuery<T> preparedQuery) throws SQLException {
  checkForInitialized();
  DatabaseConnection connection = connectionSource.getReadOnlyConnection(tableInfo.getTableName());
  try {
    return statementExecutor.queryForFirst(connection, preparedQuery, objectCache);
  } finally {
    connectionSource.releaseConnection(connection);
  }
}
origin: j256/ormlite-core

@Override
public long countOf() throws SQLException {
  checkForInitialized();
  DatabaseConnection connection = connectionSource.getReadOnlyConnection(tableInfo.getTableName());
  try {
    return statementExecutor.queryForCountStar(connection);
  } finally {
    connectionSource.releaseConnection(connection);
  }
}
origin: j256/ormlite-core

@Override
public int executeRaw(String statement, String... arguments) throws SQLException {
  checkForInitialized();
  DatabaseConnection connection = connectionSource.getReadWriteConnection(tableInfo.getTableName());
  try {
    return statementExecutor.executeRaw(connection, statement, arguments);
  } catch (SQLException e) {
    throw SqlExceptionUtil.create("Could not run raw execute statement " + statement, e);
  } finally {
    connectionSource.releaseConnection(connection);
  }
}
origin: com.j256.ormlite/ormlite-core

@Override
public int executeRawNoArgs(String statement) throws SQLException {
  checkForInitialized();
  DatabaseConnection connection = connectionSource.getReadWriteConnection(tableInfo.getTableName());
  try {
    return statementExecutor.executeRawNoArgs(connection, statement);
  } catch (SQLException e) {
    throw SqlExceptionUtil.create("Could not run raw execute statement " + statement, e);
  } finally {
    connectionSource.releaseConnection(connection);
  }
}
origin: j256/ormlite-core

@Test
public void testNoTableNameInAnnotation() throws Exception {
  TableInfo<NoTableNameAnnotation, Void> tableInfo =
      new TableInfo<NoTableNameAnnotation, Void>(databaseType, NoTableNameAnnotation.class);
  assertEquals(NoTableNameAnnotation.class.getSimpleName().toLowerCase(), tableInfo.getTableName());
}
origin: j256/ormlite-core

@Override
public int updateRaw(String statement, String... arguments) throws SQLException {
  checkForInitialized();
  DatabaseConnection connection = connectionSource.getReadWriteConnection(tableInfo.getTableName());
  try {
    return statementExecutor.updateRaw(connection, statement, arguments);
  } catch (SQLException e) {
    throw SqlExceptionUtil.create("Could not run raw update statement " + statement, e);
  } finally {
    connectionSource.releaseConnection(connection);
  }
}
origin: j256/ormlite-core

@Test
public void testLimit() throws Exception {
  QueryBuilder<Foo, Integer> qb = new QueryBuilder<Foo, Integer>(databaseType, baseFooTableInfo, null);
  long limit = 103;
  qb.limit(limit);
  StringBuilder sb = new StringBuilder();
  sb.append("SELECT * FROM ");
  databaseType.appendEscapedEntityName(sb, baseFooTableInfo.getTableName());
  sb.append(" LIMIT ").append(limit).append(' ');
  assertEquals(sb.toString(), qb.prepareStatementString());
}
origin: j256/ormlite-core

@Test
public void testSelectAll() throws Exception {
  QueryBuilder<Foo, Integer> qb = new QueryBuilder<Foo, Integer>(databaseType, baseFooTableInfo, null);
  StringBuilder sb = new StringBuilder();
  sb.append("SELECT * FROM ");
  databaseType.appendEscapedEntityName(sb, baseFooTableInfo.getTableName());
  sb.append(' ');
  assertEquals(sb.toString(), qb.prepareStatementString());
}
origin: j256/ormlite-core

@Test
public void testDistinct() throws Exception {
  QueryBuilder<Foo, Integer> qb = new QueryBuilder<Foo, Integer>(databaseType, baseFooTableInfo, null);
  qb.distinct();
  StringBuilder sb = new StringBuilder();
  sb.append("SELECT DISTINCT * FROM ");
  databaseType.appendEscapedEntityName(sb, baseFooTableInfo.getTableName());
  sb.append(' ');
  assertEquals(sb.toString(), qb.prepareStatementString());
}
origin: j256/ormlite-core

@Test
public void testPrepareStatement() throws Exception {
  Dao<Foo, Integer> dao = createDao(Foo.class, false);
  QueryBuilder<Foo, Integer> qb = new QueryBuilder<Foo, Integer>(databaseType, baseFooTableInfo, dao);
  PreparedQuery<Foo> stmt = qb.prepare();
  stmt.getStatement();
  StringBuilder sb = new StringBuilder();
  sb.append("SELECT * FROM ");
  databaseType.appendEscapedEntityName(sb, baseFooTableInfo.getTableName());
  sb.append(' ');
  assertEquals(sb.toString(), qb.prepareStatementString());
}
origin: j256/ormlite-core

@Test
public void testBasic() throws SQLException {
  TableInfo<Foo, String> tableInfo = new TableInfo<Foo, String>(databaseType, Foo.class);
  assertEquals(Foo.class, tableInfo.getDataClass());
  assertEquals(TABLE_NAME, tableInfo.getTableName());
  assertEquals(COLUMN_NAME, tableInfo.getIdField().getColumnName());
  assertEquals(1, tableInfo.getFieldTypes().length);
  assertSame(tableInfo.getIdField(), tableInfo.getFieldTypes()[0]);
  assertEquals(COLUMN_NAME, tableInfo.getFieldTypeByColumnName(COLUMN_NAME).getColumnName());
}
com.j256.ormlite.tableTableInfogetTableName

Javadoc

Return the name of the table associated with the object.

Popular methods of TableInfo

  • <init>
  • getFieldTypes
    Return the array of field types associated with the object.
  • getIdField
    Return the id-field associated with the object.
  • getDataClass
    Return the class associated with this object-info.
  • getFieldTypeByColumnName
    Return the FieldType associated with the columnName.
  • objectToString
    Return a string representation of the object.
  • createObject
    Create and return an object of this type using our reflection constructor.
  • getForeignCollections
    Return an array with the fields that are ForeignCollections or a blank array if none.
  • hasColumnName
    Return true if this table information has a field with this columnName as set by DatabaseField#colum
  • isForeignAutoCreate
    Return true if one of the fields has DatabaseField#foreignAutoCreate() enabled.
  • isUpdatable
    Return true if we can update this object via its ID.
  • wireNewInstance
  • isUpdatable,
  • wireNewInstance

Popular in Java

  • Finding current android device location
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • scheduleAtFixedRate (Timer)
  • findViewById (Activity)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • String (java.lang)
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now