com.j256.ormlite.field.DataType Java Examples

The following examples show how to use com.j256.ormlite.field.DataType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RawRowObjectMapperTest.java    From ormlite-core with ISC License 6 votes vote down vote up
@Test
public void testRawResultsObjectMapper() throws Exception {
	Dao<Foo, Object> dao = createDao(Foo.class, true);
	Foo foo1 = new Foo();
	foo1.val = 12321;
	foo1.stringField = "fjpojefpwoewfjpewf";
	assertEquals(1, dao.create(foo1));
	Foo foo2 = new Foo();
	foo2.val = 754282321;
	foo2.stringField = "foewjfewpfjwe";
	assertEquals(1, dao.create(foo2));

	QueryBuilder<Foo, Object> qb = dao.queryBuilder();
	qb.selectColumns(Foo.ID_COLUMN_NAME, Foo.VAL_COLUMN_NAME, Foo.STRING_COLUMN_NAME);
	GenericRawResults<Foo> rawResults =
			dao.queryRaw(qb.prepareStatementString(), new DataType[] { DataType.INTEGER, DataType.INTEGER,
					DataType.STRING }, new FooObjectArrayMapper());
	List<Foo> results = rawResults.getResults();
	assertEquals(2, results.size());
	assertEquals(foo1.id, results.get(0).id);
	assertEquals(foo1.val, results.get(0).val);
	assertEquals(foo1.stringField, results.get(0).stringField);
	assertEquals(foo2.id, results.get(1).id);
	assertEquals(foo2.val, results.get(1).val);
	assertEquals(foo2.stringField, results.get(1).stringField);
}
 
Example #2
Source File: SerializableTypeTest.java    From ormlite-core with ISC License 6 votes vote down vote up
@Test
public void testSerializable() throws Exception {
	Class<LocalSerializable> clazz = LocalSerializable.class;
	Dao<LocalSerializable, Object> dao = createDao(clazz, true);
	Integer val = 1331333131;
	ByteArrayOutputStream outStream = new ByteArrayOutputStream();
	ObjectOutputStream objOutStream = new ObjectOutputStream(outStream);
	objOutStream.writeObject(val);
	byte[] sqlArg = outStream.toByteArray();
	String valStr = val.toString();
	LocalSerializable foo = new LocalSerializable();
	foo.serializable = val;
	assertEquals(1, dao.create(foo));
	testType(dao, foo, clazz, val, sqlArg, sqlArg, valStr, DataType.SERIALIZABLE, SERIALIZABLE_COLUMN, false, false,
			true, false, true, true, false, false);
}
 
Example #3
Source File: SerializableTypeTest.java    From ormlite-core with ISC License 6 votes vote down vote up
@Test(expected = SQLException.class)
public void testSerializableInvalidResult() throws Exception {
	Class<LocalByteArray> clazz = LocalByteArray.class;
	Dao<LocalByteArray, Object> dao = createDao(clazz, true);
	LocalByteArray foo = new LocalByteArray();
	foo.byteField = new byte[] { 1, 2, 3, 4, 5 };
	assertEquals(1, dao.create(foo));
	DatabaseConnection conn = connectionSource.getReadOnlyConnection(TABLE_NAME);
	CompiledStatement stmt = null;
	try {
		stmt = conn.compileStatement("select * from " + TABLE_NAME, StatementType.SELECT, noFieldTypes,
				DatabaseConnection.DEFAULT_RESULT_FLAGS, true);
		DatabaseResults results = stmt.runQuery(null);
		assertTrue(results.next());
		FieldType fieldType = FieldType.createFieldType(databaseType, TABLE_NAME,
				LocalSerializable.class.getDeclaredField(SERIALIZABLE_COLUMN), LocalSerializable.class);
		DataType.SERIALIZABLE.getDataPersister().resultToJava(fieldType, results, results.findColumn(BYTE_COLUMN));
	} finally {
		if (stmt != null) {
			stmt.close();
		}
		connectionSource.releaseConnection(conn);
	}
}
 
Example #4
Source File: EnumStringTypeTest.java    From ormlite-core with ISC License 6 votes vote down vote up
@Test
public void testEnumStringResultsNoFieldType() throws Exception {
	Dao<LocalEnumString, Object> dao = createDao(LocalEnumString.class, true);
	OurEnum val = OurEnum.SECOND;
	LocalEnumString foo = new LocalEnumString();
	foo.ourEnum = val;
	assertEquals(1, dao.create(foo));
	DatabaseConnection conn = connectionSource.getReadOnlyConnection(TABLE_NAME);
	CompiledStatement stmt = null;
	try {
		stmt = conn.compileStatement("select * from " + TABLE_NAME, StatementType.SELECT, noFieldTypes,
				DatabaseConnection.DEFAULT_RESULT_FLAGS, true);
		DatabaseResults results = stmt.runQuery(null);
		assertTrue(results.next());
		assertEquals(val.toString(), DataType.ENUM_STRING.getDataPersister().resultToJava(null, results,
				results.findColumn(ENUM_COLUMN)));
	} finally {
		if (stmt != null) {
			stmt.close();
		}
		connectionSource.releaseConnection(conn);
	}
}
 
Example #5
Source File: DateTypeTest.java    From ormlite-core with ISC License 6 votes vote down vote up
@Test
public void testDate() throws Exception {
	Class<LocalDate> clazz = LocalDate.class;
	Dao<LocalDate, Object> dao = createDao(clazz, true);
	// we have to round to 0 millis
	long millis = System.currentTimeMillis();
	millis -= millis % 1000;
	java.util.Date val = new java.util.Date(millis);
	String format = "yyyy-MM-dd HH:mm:ss.SSSSSS";
	DateFormat dateFormat = new SimpleDateFormat(format);
	String valStr = dateFormat.format(val);
	LocalDate foo = new LocalDate();
	foo.date = val;
	assertEquals(1, dao.create(foo));
	Timestamp timestamp = new Timestamp(val.getTime());
	testType(dao, foo, clazz, val, timestamp, timestamp, valStr, DataType.DATE, DATE_COLUMN, false, true, true,
			false, true, false, true, false);
}
 
Example #6
Source File: StatementExecutor.java    From ormlite-core with ISC License 6 votes vote down vote up
/**
 * Return a results object associated with an internal iterator that returns Object[] results.
 */
public GenericRawResults<Object[]> queryRaw(ConnectionSource connectionSource, String query, DataType[] columnTypes,
		String[] arguments, ObjectCache objectCache) throws SQLException {
	logger.debug("executing raw query for: {}", query);
	if (arguments.length > 0) {
		// need to do the (Object) cast to force args to be a single object
		logger.trace("query arguments: {}", (Object) arguments);
	}
	DatabaseConnection connection = connectionSource.getReadOnlyConnection(tableInfo.getTableName());
	CompiledStatement compiledStatement = null;
	try {
		compiledStatement = connection.compileStatement(query, StatementType.SELECT, noFieldTypes,
				DatabaseConnection.DEFAULT_RESULT_FLAGS, false);
		assignStatementArguments(compiledStatement, arguments);
		RawResultsImpl<Object[]> rawResults = new RawResultsImpl<Object[]>(connectionSource, connection, query,
				Object[].class, compiledStatement, new ObjectArrayRowMapper(columnTypes), objectCache);
		compiledStatement = null;
		connection = null;
		return rawResults;
	} finally {
		IOUtils.closeThrowSqlException(compiledStatement, "compiled statement");
		if (connection != null) {
			connectionSource.releaseConnection(connection);
		}
	}
}
 
Example #7
Source File: StatementExecutor.java    From ormlite-core with ISC License 6 votes vote down vote up
/**
 * Return a results object associated with an internal iterator is mapped by the user's rowMapper.
 */
public <UO> GenericRawResults<UO> queryRaw(ConnectionSource connectionSource, String query, DataType[] columnTypes,
		RawRowObjectMapper<UO> rowMapper, String[] arguments, ObjectCache objectCache) throws SQLException {
	logger.debug("executing raw query for: {}", query);
	if (arguments.length > 0) {
		// need to do the (Object) cast to force args to be a single object
		logger.trace("query arguments: {}", (Object) arguments);
	}
	DatabaseConnection connection = connectionSource.getReadOnlyConnection(tableInfo.getTableName());
	CompiledStatement compiledStatement = null;
	try {
		compiledStatement = connection.compileStatement(query, StatementType.SELECT, noFieldTypes,
				DatabaseConnection.DEFAULT_RESULT_FLAGS, false);
		assignStatementArguments(compiledStatement, arguments);
		RawResultsImpl<UO> rawResults = new RawResultsImpl<UO>(connectionSource, connection, query, String[].class,
				compiledStatement, new UserRawRowObjectMapper<UO>(rowMapper, columnTypes), objectCache);
		compiledStatement = null;
		connection = null;
		return rawResults;
	} finally {
		IOUtils.closeThrowSqlException(compiledStatement, "compiled statement");
		if (connection != null) {
			connectionSource.releaseConnection(connection);
		}
	}
}
 
Example #8
Source File: EnumIntegerTypeTest.java    From ormlite-core with ISC License 6 votes vote down vote up
@Test
public void testEnumIntResultsNoFieldType() throws Exception {
	Class<LocalEnumInt> clazz = LocalEnumInt.class;
	Dao<LocalEnumInt, Object> dao = createDao(clazz, true);
	OurEnum val = OurEnum.SECOND;
	LocalEnumInt foo = new LocalEnumInt();
	foo.ourEnum = val;
	assertEquals(1, dao.create(foo));
	DatabaseConnection conn = connectionSource.getReadOnlyConnection(FOO_TABLE_NAME);
	CompiledStatement stmt = null;
	try {
		stmt = conn.compileStatement("select * from " + TABLE_NAME, StatementType.SELECT, noFieldTypes,
				DatabaseConnection.DEFAULT_RESULT_FLAGS, true);
		DatabaseResults results = stmt.runQuery(null);
		assertTrue(results.next());
		assertEquals(val.ordinal(), DataType.ENUM_INTEGER.getDataPersister().resultToJava(null, results,
				results.findColumn(ENUM_COLUMN)));
	} finally {
		if (stmt != null) {
			stmt.close();
		}
		connectionSource.releaseConnection(conn);
	}
}
 
Example #9
Source File: DateStringTypeTest.java    From ormlite-core with ISC License 6 votes vote down vote up
@Test(expected = SQLException.class)
public void testDateStringResultInvalid() throws Exception {
	Class<LocalString> clazz = LocalString.class;
	Dao<LocalString, Object> dao = createDao(clazz, true);
	LocalString foo = new LocalString();
	foo.string = "not a date format";
	assertEquals(1, dao.create(foo));
	DatabaseConnection conn = connectionSource.getReadOnlyConnection(FOO_TABLE_NAME);
	CompiledStatement stmt = null;
	try {
		stmt = conn.compileStatement("select * from " + TABLE_NAME, StatementType.SELECT, noFieldTypes,
				DatabaseConnection.DEFAULT_RESULT_FLAGS, true);
		DatabaseResults results = stmt.runQuery(null);
		assertTrue(results.next());
		int colNum = results.findColumn(STRING_COLUMN);
		DataType.DATE_STRING.getDataPersister().resultToJava(null, results, colNum);
	} finally {
		if (stmt != null) {
			stmt.close();
		}
		connectionSource.releaseConnection(conn);
	}
}
 
Example #10
Source File: JdbcBaseDaoImplTest.java    From ormlite-jdbc with ISC License 6 votes vote down vote up
@Test
public void testFieldConfig() throws Exception {
	List<DatabaseFieldConfig> fieldConfigs = new ArrayList<DatabaseFieldConfig>();
	fieldConfigs.add(new DatabaseFieldConfig("id", "id2", DataType.UNKNOWN, null, 0, false, false, true, null,
			false, null, false, null, false, null, false, null, null, false, -1, 0));
	fieldConfigs.add(new DatabaseFieldConfig("stuff", "stuffy", DataType.UNKNOWN, null, 0, false, false, false,
			null, false, null, false, null, false, null, false, null, null, false, -1, 0));
	DatabaseTableConfig<NoAnno> tableConfig = new DatabaseTableConfig<NoAnno>(NoAnno.class, "noanno", fieldConfigs);
	Dao<NoAnno, Integer> noAnnotaionDao = createDao(tableConfig, true);
	NoAnno noa = new NoAnno();
	String stuff = "qpoqwpjoqwp12";
	noa.stuff = stuff;
	assertEquals(1, noAnnotaionDao.create(noa));
	NoAnno noa2 = noAnnotaionDao.queryForId(noa.id);
	assertEquals(noa.id, noa2.id);
	assertEquals(stuff, noa2.stuff);
}
 
Example #11
Source File: OracleDatabaseType.java    From ormlite-jdbc with ISC License 6 votes vote down vote up
@Override
public FieldConverter getFieldConverter(DataPersister dataPersister, FieldType fieldType) {
	switch (dataPersister.getSqlType()) {
		case BOOLEAN:
			/*
			 * Booleans in Oracle are stored as the character '1' or '0'. You can change the characters by
			 * specifying a format string. It must be a string with 2 characters. The first character is the value
			 * for TRUE, the second is FALSE. See {@link BooleanCharType}.
			 * 
			 * You can also specify the format as "integer" to use an integer column type and the value 1 (really
			 * non-0) for true and 0 for false. See {@link BooleanIntegerType}.
			 */
			if (BOOLEAN_INTEGER_FORMAT.equalsIgnoreCase(fieldType.getFormat())) {
				return DataType.BOOLEAN_INTEGER.getDataPersister();
			} else {
				return DataType.BOOLEAN_CHAR.getDataPersister();
			}
		default:
			return super.getFieldConverter(dataPersister, fieldType);
	}
}
 
Example #12
Source File: BigIntegerTypeTest.java    From ormlite-core with ISC License 5 votes vote down vote up
@Test
public void testBigInteger() throws Exception {
	Class<LocalBigInteger> clazz = LocalBigInteger.class;
	Dao<LocalBigInteger, Object> dao = createDao(clazz, true);
	BigInteger val = new BigInteger(
			"324234234234234234234234246467647647463345345435345345345345345345345345345345345346356524234234");
	String valStr = val.toString();
	LocalBigInteger foo = new LocalBigInteger();
	foo.bigInteger = val;
	assertEquals(1, dao.create(foo));
	testType(dao, foo, clazz, val, valStr, valStr, valStr, DataType.BIG_INTEGER, BIGINTEGER_COLUMN, true, true,
			true, false, false, false, true, true);
}
 
Example #13
Source File: BooleanObjectTypeTest.java    From ormlite-core with ISC License 5 votes vote down vote up
@Test
public void testBooleanObj() throws Exception {
	Class<LocalBooleanObj> clazz = LocalBooleanObj.class;
	Dao<LocalBooleanObj, Object> dao = createDao(clazz, true);
	Boolean val = true;
	String valStr = val.toString();
	LocalBooleanObj foo = new LocalBooleanObj();
	foo.bool = val;
	assertEquals(1, dao.create(foo));
	testType(dao, foo, clazz, val, val, val, valStr, DataType.BOOLEAN_OBJ, BOOLEAN_COLUMN, false, false, false,
			false, false, false, true, false);
}
 
Example #14
Source File: EnumStringTypeTest.java    From ormlite-core with ISC License 5 votes vote down vote up
@Test
public void testEnumStringNull() throws Exception {
	Class<LocalEnumString> clazz = LocalEnumString.class;
	Dao<LocalEnumString, Object> dao = createDao(clazz, true);
	LocalEnumString foo = new LocalEnumString();
	assertEquals(1, dao.create(foo));
	testType(dao, foo, clazz, null, null, null, null, DataType.ENUM_STRING, ENUM_COLUMN, false, true, true, false,
			false, false, true, false);
}
 
Example #15
Source File: CharObjectTypeTest.java    From ormlite-core with ISC License 5 votes vote down vote up
@Test
public void testCharObj() throws Exception {
	Class<LocalCharObj> clazz = LocalCharObj.class;
	Dao<LocalCharObj, Object> dao = createDao(clazz, true);
	Character val = 'w';
	String valStr = val.toString();
	LocalCharObj foo = new LocalCharObj();
	foo.charField = val;
	assertEquals(1, dao.create(foo));
	testType(dao, foo, clazz, val, val, val, valStr, DataType.CHAR_OBJ, CHAR_COLUMN, false, true, true, false,
			false, false, true, false);
}
 
Example #16
Source File: DateLongTypeTest.java    From ormlite-core with ISC License 5 votes vote down vote up
@Test
public void testDateLong() throws Exception {
	Class<LocalDateLong> clazz = LocalDateLong.class;
	Dao<LocalDateLong, Object> dao = createDao(clazz, true);
	Date val = new Date();
	long sqlVal = val.getTime();
	String valStr = Long.toString(val.getTime());
	LocalDateLong foo = new LocalDateLong();
	foo.date = val;
	assertEquals(1, dao.create(foo));
	testType(dao, foo, clazz, val, sqlVal, sqlVal, valStr, DataType.DATE_LONG, DATE_COLUMN, false, true, false,
			false, false, false, true, false);
}
 
Example #17
Source File: BooleanObjectTypeTest.java    From ormlite-core with ISC License 5 votes vote down vote up
@Test
public void testBooleanObjNull() throws Exception {
	Class<LocalBooleanObj> clazz = LocalBooleanObj.class;
	Dao<LocalBooleanObj, Object> dao = createDao(clazz, true);
	LocalBooleanObj foo = new LocalBooleanObj();
	assertEquals(1, dao.create(foo));
	testType(dao, foo, clazz, null, null, null, null, DataType.BOOLEAN_OBJ, BOOLEAN_COLUMN, false, false, false,
			false, false, false, true, false);
}
 
Example #18
Source File: IntegerObjectTypeTest.java    From ormlite-core with ISC License 5 votes vote down vote up
@Test
public void testIntObjNull() throws Exception {
	Class<LocalIntObj> clazz = LocalIntObj.class;
	Dao<LocalIntObj, Object> dao = createDao(clazz, true);
	LocalIntObj foo = new LocalIntObj();
	assertEquals(1, dao.create(foo));
	testType(dao, foo, clazz, null, null, null, null, DataType.INTEGER_OBJ, INT_COLUMN, true, true, false, false,
			false, false, true, true);
}
 
Example #19
Source File: DateTypeTest.java    From ormlite-core with ISC License 5 votes vote down vote up
@Test
public void testDateNull() throws Exception {
	Class<LocalDate> clazz = LocalDate.class;
	Dao<LocalDate, Object> dao = createDao(clazz, true);
	LocalDate foo = new LocalDate();
	assertEquals(1, dao.create(foo));
	testType(dao, foo, clazz, null, null, null, null, DataType.DATE, DATE_COLUMN, false, true, true, false, true,
			false, true, false);
}
 
Example #20
Source File: DatabaseTableConfigTest.java    From ormlite-core with ISC License 5 votes vote down vote up
@Test
public void testFieldConfigConstructorDataType() {
	DataType dataType = DataType.BIG_DECIMAL;
	DatabaseFieldConfig config = new DatabaseFieldConfig("stuff", null, dataType, null, 0, true, false, false, null,
			false, null, false, null, false, null, false, null, null, false,
			DatabaseFieldConfig.NO_MAX_FOREIGN_AUTO_REFRESH_LEVEL_SPECIFIED, 0);
	assertEquals(dataType, config.getDataType());
}
 
Example #21
Source File: LongTypeTest.java    From ormlite-core with ISC License 5 votes vote down vote up
@Test
public void testLong() throws Exception {
	Class<LocalLong> clazz = LocalLong.class;
	Dao<LocalLong, Object> dao = createDao(clazz, true);
	long val = 13312321312312L;
	String valStr = Long.toString(val);
	LocalLong foo = new LocalLong();
	foo.longField = val;
	assertEquals(1, dao.create(foo));
	testType(dao, foo, clazz, val, val, val, valStr, DataType.LONG, LONG_COLUMN, true, true, false, true, false,
			false, true, true);
}
 
Example #22
Source File: DoubleObjectTypeTest.java    From ormlite-core with ISC License 5 votes vote down vote up
@Test
public void testDoubleObjNull() throws Exception {
	Class<LocalDoubleObj> clazz = LocalDoubleObj.class;
	Dao<LocalDoubleObj, Object> dao = createDao(clazz, true);
	LocalDoubleObj foo = new LocalDoubleObj();
	assertEquals(1, dao.create(foo));
	testType(dao, foo, clazz, null, null, null, null, DataType.DOUBLE_OBJ, DOUBLE_COLUMN, false, true, false, false,
			false, false, true, false);
}
 
Example #23
Source File: EnumIntegerTypeTest.java    From ormlite-core with ISC License 5 votes vote down vote up
@Test
public void testEnumIntNull() throws Exception {
	Class<LocalEnumInt> clazz = LocalEnumInt.class;
	Dao<LocalEnumInt, Object> dao = createDao(clazz, true);
	LocalEnumInt foo = new LocalEnumInt();
	assertEquals(1, dao.create(foo));
	testType(dao, foo, clazz, null, null, null, null, DataType.ENUM_INTEGER, ENUM_COLUMN, false, true, false, false,
			false, false, true, false);
}
 
Example #24
Source File: BooleanCharTypeTest.java    From ormlite-core with ISC License 5 votes vote down vote up
@Test
public void testBooleanObj() throws Exception {
	Class<LocalBooleanChar> clazz = LocalBooleanChar.class;
	Dao<LocalBooleanChar, Object> dao = createDao(clazz, true);
	boolean val = true;
	String valStr = Boolean.toString(val);
	LocalBooleanChar foo = new LocalBooleanChar();
	foo.bool = val;
	assertEquals(1, dao.create(foo));
	testType(dao, foo, clazz, val, '1', '1', valStr, DataType.BOOLEAN_CHAR, BOOLEAN_COLUMN, false, false, false,
			true, false, false, true, false);
}
 
Example #25
Source File: BooleanTypeTest.java    From ormlite-core with ISC License 5 votes vote down vote up
@Test
public void testBoolean() throws Exception {
	Class<LocalBoolean> clazz = LocalBoolean.class;
	Dao<LocalBoolean, Object> dao = createDao(clazz, true);
	boolean val = true;
	String valStr = Boolean.toString(val);
	LocalBoolean foo = new LocalBoolean();
	foo.bool = val;
	assertEquals(1, dao.create(foo));
	testType(dao, foo, clazz, val, val, val, valStr, DataType.BOOLEAN, BOOLEAN_COLUMN, false, false, false, true,
			false, false, true, false);
}
 
Example #26
Source File: StringBytesTypeTest.java    From ormlite-core with ISC License 5 votes vote down vote up
@Test
public void testStringBytesFormat() throws Exception {
	Class<LocalStringBytesUtf8> clazz = LocalStringBytesUtf8.class;
	Dao<LocalStringBytesUtf8, Object> dao = createDao(clazz, true);
	String val = "string with \u0185";
	LocalStringBytesUtf8 foo = new LocalStringBytesUtf8();
	foo.string = val;
	assertEquals(1, dao.create(foo));
	byte[] valBytes = val.getBytes("UTF-8");
	testType(dao, foo, clazz, val, valBytes, valBytes, val, DataType.STRING_BYTES, STRING_COLUMN, false, true, true,
			false, true, false, true, false);
}
 
Example #27
Source File: StringBytesTypeTest.java    From ormlite-core with ISC License 5 votes vote down vote up
@Test
public void testStringBytes() throws Exception {
	Class<LocalStringBytes> clazz = LocalStringBytes.class;
	Dao<LocalStringBytes, Object> dao = createDao(clazz, true);
	String val = "string with \u0185";
	LocalStringBytes foo = new LocalStringBytes();
	foo.string = val;
	assertEquals(1, dao.create(foo));
	byte[] valBytes = val.getBytes("Unicode");
	testType(dao, foo, clazz, val, valBytes, valBytes, val, DataType.STRING_BYTES, STRING_COLUMN, false, true, true,
			false, true, false, true, false);
}
 
Example #28
Source File: FloatObjectTypeTest.java    From ormlite-core with ISC License 5 votes vote down vote up
@Test
public void testFloatObjNull() throws Exception {
	Class<LocalFloatObj> clazz = LocalFloatObj.class;
	Dao<LocalFloatObj, Object> dao = createDao(clazz, true);
	LocalFloatObj foo = new LocalFloatObj();
	assertEquals(1, dao.create(foo));
	testType(dao, foo, clazz, null, null, null, null, DataType.FLOAT_OBJ, FLOAT_COLUMN, false, true, false, false,
			false, false, true, false);
}
 
Example #29
Source File: FloatObjectTypeTest.java    From ormlite-core with ISC License 5 votes vote down vote up
@Test
public void testFloatObj() throws Exception {
	Class<LocalFloatObj> clazz = LocalFloatObj.class;
	Dao<LocalFloatObj, Object> dao = createDao(clazz, true);
	Float val = 1331.221F;
	String valStr = val.toString();
	LocalFloatObj foo = new LocalFloatObj();
	foo.floatField = val;
	assertEquals(1, dao.create(foo));
	testType(dao, foo, clazz, val, val, val, valStr, DataType.FLOAT_OBJ, FLOAT_COLUMN, false, true, false, false,
			false, false, true, false);
}
 
Example #30
Source File: SerializableTypeTest.java    From ormlite-core with ISC License 5 votes vote down vote up
@Test
public void testSerializableNull() throws Exception {
	Class<LocalSerializable> clazz = LocalSerializable.class;
	Dao<LocalSerializable, Object> dao = createDao(clazz, true);
	LocalSerializable foo = new LocalSerializable();
	assertEquals(1, dao.create(foo));
	testType(dao, foo, clazz, null, null, null, null, DataType.SERIALIZABLE, SERIALIZABLE_COLUMN, false, false,
			true, false, true, true, false, false);
}