Java Code Examples for com.j256.ormlite.field.FieldType#isReadOnly()

The following examples show how to use com.j256.ormlite.field.FieldType#isReadOnly() . 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: MappedCreate.java    From ormlite-core with ISC License 6 votes vote down vote up
private static boolean isFieldCreatable(DatabaseType databaseType, FieldType fieldType) {
	// we don't insert anything if it is a collection
	if (fieldType.isForeignCollection()) {
		// skip foreign collections
		return false;
	} else if (fieldType.isReadOnly()) {
		// ignore read-only fields
		return false;
	} else if (databaseType.isIdSequenceNeeded() && databaseType.isSelectSequenceBeforeInsert()) {
		// we need to query for the next value from the sequence and the idField is inserted afterwards
		return true;
	} else if (fieldType.isGeneratedId() && !fieldType.isSelfGeneratedId()
			&& !fieldType.isAllowGeneratedIdInsert()) {
		// skip generated-id fields because they will be auto-inserted
		return false;
	} else {
		return true;
	}
}
 
Example 2
Source File: MappedUpdate.java    From ormlite-core with ISC License 5 votes vote down vote up
private static boolean isFieldUpdatable(FieldType fieldType, FieldType idField) {
	if (fieldType == idField || fieldType.isForeignCollection() || fieldType.isReadOnly()) {
		return false;
	} else {
		return true;
	}
}