@Override
	public T persist(T entity) {

		// Case of new, non-persisted entity
		if (extractId(entity) == null) {
			getEntityManager().persist(entity);
		}
	
		else if (!getEntityManager().contains(entity)) {
			// In the case of an attached entity, we do nothing (it
			// will be persisted automatically on synchronisation)
			// But... in the case of an unattached, but persisted entity
			// we perform a merge to re-attach and persist it
			entity = getEntityManager().merge(entity);
		}

		return entity;
	}
@ Override public T persist ( T entity ) { if ( extractId ( entity ) == null ) { getEntityManager ( ) . persist ( entity ) ; } else if ( ! getEntityManager ( ) . contains ( entity ) ) { entity = getEntityManager ( ) . merge ( entity ) ; } return entity ; }
{@inheritDoc}