org.hibernate.collection.PersistentSet Java Examples

The following examples show how to use org.hibernate.collection.PersistentSet. 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: UtilFunctions.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check if collection contains an element.
 */
public static boolean contains(Collection<?> collection, Object obj) {
	if (collection != null) {
		if (collection instanceof PersistentSet) {
			for (Object elto : collection) {
				if (elto.equals(obj)) {
					return true;
				}
			}

			return false;
		} else {
			return collection.contains(obj);
		}
	} else {
		return false;
	}
}
 
Example #2
Source File: SetType.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key) {
	if ( session.getEntityMode()==EntityMode.DOM4J ) {
		return new PersistentElementHolder(session, persister, key);
	}
	else {
		return new PersistentSet(session);
	}
}
 
Example #3
Source File: SetType.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public PersistentCollection wrap(SessionImplementor session, Object collection) {
	if ( session.getEntityMode()==EntityMode.DOM4J ) {
		return new PersistentElementHolder( session, (Element) collection );
	}
	else {
		return new PersistentSet( session, (java.util.Set) collection );
	}
}
 
Example #4
Source File: HibernateMapper.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
public void init()
{
  collectionMap.put(PersistentBag.class, ArrayList.class);
  collectionMap.put(PersistentList.class, ArrayList.class);
  collectionMap.put(PersistentMap.class, HashMap.class);
  collectionMap.put(PersistentSet.class, HashSet.class);
  collectionMap.put(PersistentSortedMap.class, TreeMap.class);
  collectionMap.put(PersistentSortedSet.class, TreeSet.class);
}