public <E> E store(final E entity) {
		final Class type = entity.getClass();
		final DbEntityDescriptor ded = dbOom.entityManager().lookupType(type);

		if (ded == null) {
			throw new DbOomException("Not an entity: " + type);
		}
		if (!isPersistent(ded, entity)) {
			final DbQuery q;
			if (dbOom.config().isKeysGeneratedByDatabase()) {
				q = query(dbOom.entities().insert(entity));
				q.setGeneratedKey();
				q.executeUpdate();
				final Object nextId = q.getGeneratedKey();
				setEntityId(ded, entity, nextId);
			}
			else {
				final Object nextId = generateNextId(ded);
				setEntityId(ded, entity, nextId);
				q = query(dbOom.entities().insert(entity));
				q.executeUpdate();
			}
			q.close();
		}
		else {
			query(dbOom.entities().updateAll(entity)).autoClose().executeUpdate();
		}
		return entity;
	}
public <E> E store(final E entity) {
		final Class type = entity.getClass();
		final DbEntityDescriptor ded = dbOom.entityManager().lookupType(type);

		if (ded == null) {
			throw new DbOomException("Not an entity: " + type);
		}
		if (!isPersistent(ded, entity)) {
			final DbQuery q;
			if (dbOom.config().isKeysGeneratedByDatabase()) {
				q = query(dbOom.entities().insert(entity));
				q.setGeneratedKey();
				q.executeUpdate();
				final Object nextId = q.getGeneratedKey();
				setEntityId(ded, entity, nextId);
			}
			else {
				final Object nextId = generateNextId(ded);
				setEntityId(ded, entity, nextId);
				q = query(dbOom.entities().insert(entity));
				q.executeUpdate();
			}
			q.close();
		}
		else {
			query(dbOom.entities().updateAll(entity)).autoClose().executeUpdate();
		}
		return entity;
	}
public < E > E store ( final E entity ) { final Class type = entity . getClass ( ) ; final DbEntityDescriptor ded = dbOom . entityManager ( ) . lookupType ( type ) ; if ( ded == null ) { throw new DbOomException ( "Not an entity: " + type ) ; } if ( ! isPersistent ( ded , entity ) ) { final DbQuery q ; if ( dbOom . config ( ) . isKeysGeneratedByDatabase ( ) ) { q = query ( dbOom . entities ( ) . insert ( entity ) ) ; q . setGeneratedKey ( ) ; q . executeUpdate ( ) ; final Object nextId = q . getGeneratedKey ( ) ; setEntityId ( ded , entity , nextId ) ; } else { final Object nextId = generateNextId ( ded ) ; setEntityId ( ded , entity , nextId ) ; q = query ( dbOom . entities ( ) . insert ( entity ) ) ; q . executeUpdate ( ) ; } q . close ( ) ; } else { query ( dbOom . entities ( ) . updateAll ( entity ) ) . autoClose ( ) . executeUpdate ( ) ; } return entity ; }
Saves or updates entity. If ID is not <code>null</code>, entity will be updated.
Otherwise, entity will be inserted into the database.
Saves or updates entity . If ID is not <code > null< / code > entity will be updated . Otherwise entity will be inserted into the database .