Codota Logo
TableInfo.<init>
Code IndexAdd Codota to your IDE (free)

How to use
com.j256.ormlite.table.TableInfo
constructor

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

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ArrayList a =
  • Codota Iconnew ArrayList<String>()
  • Codota Iconnew ArrayList()
  • Codota Iconnew ArrayList<Object>()
  • Smart code suggestions by Codota
}
origin: j256/ormlite-core

@Test(expected = SQLException.class)
public void testUpdateForeignCollection() throws Exception {
  UpdateBuilder<OurForeignCollection, Integer> stmtb =
      new UpdateBuilder<OurForeignCollection, Integer>(databaseType,
          new TableInfo<OurForeignCollection, Integer>(databaseType, OurForeignCollection.class), null);
  stmtb.updateColumnValue(OurForeignCollection.FOOS_FIELD_NAME, null);
}
origin: j256/ormlite-core

@Test(expected = SQLException.class)
public void testQueryNoId() throws Exception {
  StatementExecutor<NoId, String> se = new StatementExecutor<NoId, String>(databaseType,
      new TableInfo<NoId, String>(databaseType, NoId.class), null);
  se.queryForId(null, "1", null);
}
origin: org.entando.entando/entando-core-engine

private static <T, ID> int createTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ifNotExists)
    throws SQLException {
  Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass);
  if (dao instanceof BaseDaoImpl<?, ?>) {
    return doCreateTable(connectionSource, ((BaseDaoImpl<?, ?>) dao).getTableInfo(), ifNotExists);
  } else {
    TableInfo<T, ID> tableInfo = new TableInfo<T, ID>(connectionSource, null, dataClass);
    return doCreateTable(connectionSource, tableInfo, ifNotExists);
  }
}

origin: j256/ormlite-core

@Test(expected = SQLException.class)
public void testIdEqNoId() throws Exception {
  new Where<FooNoId, Integer>(new TableInfo<FooNoId, Integer>(databaseType, FooNoId.class), null, databaseType)
      .idEq(100);
}
origin: j256/ormlite-core

@Test(expected = SQLException.class)
public void testIdEqObjectIdNoId() throws Exception {
  new Where<FooNoId, Integer>(new TableInfo<FooNoId, Integer>(databaseType, FooNoId.class), null, databaseType)
      .idEq(new BaseDaoImpl<FooNoId, Integer>(connectionSource, FooNoId.class) {
      }, new FooNoId());
}
origin: j256/ormlite-core

@Test(expected = SQLException.class)
public void testZeroFieldConfigsSpecified() throws Exception {
  DatabaseTableConfig<NoTableNameAnnotation> tableConfig = new DatabaseTableConfig<NoTableNameAnnotation>(
      databaseType, NoTableNameAnnotation.class, new ArrayList<DatabaseFieldConfig>());
  tableConfig.extractFieldTypes(databaseType);
  new TableInfo<NoTableNameAnnotation, Void>(databaseType, tableConfig);
}
origin: j256/ormlite-core

@Test(expected = SQLException.class)
public void testUpdateNoId() throws Exception {
  StatementExecutor<NoId, String> se = new StatementExecutor<NoId, String>(databaseType,
      new TableInfo<NoId, String>(databaseType, NoId.class), null);
  NoId noId = new NoId();
  noId.stuff = "1";
  se.update(null, noId, null);
}
origin: j256/ormlite-core

@Test
public void testUnknownForeignField() throws Exception {
  TableInfo<Foreign, Void> tableInfo = new TableInfo<Foreign, Void>(databaseType, Foreign.class);
  try {
    tableInfo.getFieldTypeByColumnName("foo");
    fail("expected exception");
  } catch (IllegalArgumentException e) {
    assertTrue(e.getMessage().contains("'" + Foreign.FOREIGN_FIELD_NAME + "'"));
    assertTrue(e.getMessage().contains("'foo'"));
  }
}
origin: j256/ormlite-core

private static <T, ID> int doCreateTable(Dao<T, ID> dao, boolean ifNotExists) throws SQLException {
  ConnectionSource connectionSource = dao.getConnectionSource();
  DatabaseType databaseType = connectionSource.getDatabaseType();
  if (dao instanceof BaseDaoImpl<?, ?>) {
    return doCreateTable(connectionSource, ((BaseDaoImpl<?, ?>) dao).getTableInfo(), ifNotExists);
  } else {
    TableInfo<T, ID> tableInfo = new TableInfo<T, ID>(databaseType, dao.getDataClass());
    return doCreateTable(connectionSource, tableInfo, ifNotExists);
  }
}
origin: j256/ormlite-core

@Test(expected = SQLException.class)
public void testNoIdBuildUpdater() throws Exception {
  Dao<NoId, Void> dao = createDao(NoId.class, false);
  MappedUpdate.build(dao, new TableInfo<NoId, Void>(databaseType, NoId.class));
}
origin: j256/ormlite-core

@Test(expected = IllegalArgumentException.class)
public void testObjectNoConstructor() throws Exception {
  TableInfo<NoConstructor, Void> tableInfo =
      new TableInfo<NoConstructor, Void>(databaseType, NoConstructor.class);
  Dao<NoConstructor, Void> dao = createDao(NoConstructor.class, false);
  new MappedPreparedStmt<NoConstructor, Void>(dao, tableInfo, null, new FieldType[0], new FieldType[0],
      new ArgumentHolder[0], null, StatementType.SELECT, false);
}
origin: j256/ormlite-core

@Test(expected = SQLException.class)
public void testJustIdBuildUpdater() throws Exception {
  Dao<NoId, Void> dao = createDao(NoId.class, false);
  MappedUpdate.build(dao, new TableInfo<NoId, Void>(databaseType, NoId.class));
}
origin: j256/ormlite-core

@Test(expected = SQLException.class)
public void testNoIdBuildUpdater() throws Exception {
  Dao<NoId, Void> dao = createDao(NoId.class, false);
  MappedUpdate.build(dao, new TableInfo<NoId, Void>(databaseType, NoId.class));
}
origin: j256/ormlite-core

@Test(expected = SQLException.class)
public void testNoIdBuildDelete() throws Exception {
  Dao<NoId, Void> dao = createDao(NoId.class, false);
  MappedDelete.build(dao, new TableInfo<NoId, Void>(databaseType, NoId.class));
}
origin: j256/ormlite-core

@Test(expected = SQLException.class)
public void testSequenceZero() throws Exception {
  DatabaseConnection databaseConnection = createMock(DatabaseConnection.class);
  expect(databaseConnection.queryForLong(isA(String.class))).andReturn(0L);
  replay(databaseConnection);
  NeedsSequenceDatabaseType needsSequence = new NeedsSequenceDatabaseType();
  Dao<GeneratedIdSequence, Integer> dao = createDao(GeneratedIdSequence.class, false);
  MappedCreate<GeneratedIdSequence, Integer> mappedCreate = MappedCreate.build(dao,
      new TableInfo<GeneratedIdSequence, Integer>(databaseType, GeneratedIdSequence.class));
  mappedCreate.insert(needsSequence, databaseConnection, new GeneratedIdSequence(), null);
  verify(databaseConnection);
}
origin: com.j256.ormlite/ormlite-jdbc

@Test
public void testBoolean() throws Exception {
  TableInfo<AllTypes, Void> tableInfo = new TableInfo<AllTypes, Void>(connectionSource, null, AllTypes.class);
  assertEquals(9, tableInfo.getFieldTypes().length);
  FieldType booleanField = tableInfo.getFieldTypes()[1];
  assertEquals("booleanField", booleanField.getColumnName());
  StringBuilder sb = new StringBuilder();
  List<String> additionalArgs = new ArrayList<String>();
  List<String> statementsBefore = new ArrayList<String>();
  databaseType.appendColumnArg(null, sb, booleanField, additionalArgs, statementsBefore, null, null);
  assertTrue(sb.toString().contains("SMALLINT"));
}
origin: com.j256.ormlite/ormlite-core

private static <T, ID> int doCreateTable(Dao<T, ID> dao, boolean ifNotExists) throws SQLException {
  if (dao instanceof BaseDaoImpl<?, ?>) {
    return doCreateTable(dao.getConnectionSource(), ((BaseDaoImpl<?, ?>) dao).getTableInfo(), ifNotExists);
  } else {
    TableInfo<T, ID> tableInfo = new TableInfo<T, ID>(dao.getConnectionSource(), null, dao.getDataClass());
    return doCreateTable(dao.getConnectionSource(), tableInfo, ifNotExists);
  }
}
origin: j256/ormlite-core

@Test(expected = SQLException.class)
public void testArgumentHolderNotSet() throws Exception {
  TableInfo<Foo, Integer> tableInfo = new TableInfo<Foo, Integer>(databaseType, Foo.class);
  Dao<Foo, Integer> dao = createDao(Foo.class, false);
  MappedCreate<Foo, Integer> mappedCreate = MappedCreate.build(dao, tableInfo);
  DatabaseConnection conn = createMock(DatabaseConnection.class);
  expect(conn.insert(isA(String.class), isA(Object[].class), isA(FieldType[].class),
      isA(GeneratedKeyHolder.class))).andReturn(1);
  replay(conn);
  mappedCreate.insert(databaseType, conn, new Foo(), null);
}
origin: j256/ormlite-core

@Test(expected = SQLException.class)
public void testInSubQueryToManySubColumns() throws Exception {
  TableInfo<ForeignFoo, Integer> tableInfo = new TableInfo<ForeignFoo, Integer>(databaseType, ForeignFoo.class);
  Where<ForeignFoo, Integer> where = new Where<ForeignFoo, Integer>(tableInfo, null, databaseType);
  BaseDaoImpl<ForeignFoo, Integer> foreignDao =
      new BaseDaoImpl<ForeignFoo, Integer>(connectionSource, ForeignFoo.class) {
      };
  QueryBuilder<ForeignFoo, Integer> qb = foreignDao.queryBuilder();
  qb.selectColumns(ID_COLUMN_NAME, FOREIGN_COLUMN_NAME);
  where.in(ID_COLUMN_NAME, qb);
}
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.tableTableInfo<init>

Popular methods of TableInfo

  • getFieldTypes
    Return the array of field types associated with the object.
  • getTableName
    Return the name of the table 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

  • Updating database using SQL prepared statement
  • getExternalFilesDir (Context)
  • findViewById (Activity)
  • setScale (BigDecimal)
    Returns a BigDecimal whose scale is the specified value, and whose value is numerically equal to thi
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • Reference (javax.naming)
  • BoxLayout (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now