Hibernate ORM Collection - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Hibernate ORM Collection class.

This code example shows how to use the following methods:getComparatorClassName, isSorted, accept
		if(c2j.getJavaTypeName(p, false)==null) {
			throw new IllegalArgumentException();
		} else if (p.getValue() instanceof Collection) {
			Collection col = (Collection) p.getValue();
			 
			DefaultInitializor initialization = (DefaultInitializor) col.accept(new DefaultValueVisitor(true) {
			  
				public Object accept(Bag o) {
					return new DefaultInitializor("java.util.ArrayList", true); 
				} 
				 
				public Object accept(org.hibernate.mapping.List o) {
					return new DefaultInitializor("java.util.ArrayList", true); 
				} 
				 
				public Object accept(org.hibernate.mapping.Map o) {
					if(o.isSorted()) {
						return new DefaultInitializor("java.util.TreeMap", false); 
					} else { 
						return new DefaultInitializor("java.util.HashMap", true); 

5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getElement
	public Object accept(OneToMany value) {
		return value.getAssociatedClass().getEntityName();
	} 
	 
	public Object acceptCollection(Collection c) {
		return c.getElement().accept( this );
	} 
	 
	public Object accept(Bag o) {
		return acceptCollection( o );
	} 
	 
	public Object accept(List o) {
		return acceptCollection( o );
	} 
	 
	public Object accept(IdentifierBag o) {
		return acceptCollection( o );
	} 
	 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getRole, isMap

5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getCollectionPersisterClass, getRole
 
	@Test
	public void testCollectionPersisterSpecified() throws Exception {
		//tests the persister specified by the @Persister annotation on a collection 
		Collection collection = (Collection) configuration().getCollectionMapping( Deck.class.getName() + ".cards" );
		assertEquals( "Incorrect Persister class for collection " + collection.getRole(), CollectionPersister.class,
				collection.getCollectionPersisterClass() );
	} 
 
	@Override 
	protected Class[] getAnnotatedClasses() {
		return new Class[]{
				Card.class, 
				Deck.class 
		}; 
	} 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:isSorted
		return super.accept(o);
	} 
	 
	// special handling for Set's to avoid initialization of comparators that depends on the keys/values which might not be generated yet. 
	public Object accept(Set o) {
		if ( o.isSorted() ) {
			return "java.util.SortedSet"; 
		} 
		return super.accept(o);
	} 
 
	public Object accept(Component value) {
		// composite-element breaks without it. 
		return value.getComponentClassName();
	} 
		 
	public Object accept(OneToOne o) {
		return acceptToOne(o);
	} 
	 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getOwner, isMutable
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getCollectionPersisterClass
This code example shows how to use the following methods:isIndexed
		} 
		if ( value instanceof Collection ) {
			Collection collection = ((Collection)value);
			Value element = collection.getElement();
			String elementType = getReferencedEntityName( element );
			if(collection.isIndexed()) {
				//TODO..list/map 
				/*IndexedCollection idxCol = (IndexedCollection) collection; 
				if(!idxCol.isList()) { 
					Value idxElement = idxCol.getIndex(); 
					String indexType = getReferencedEntityName( value ); 
					genericDecl = indexType + "," + elementType; 
				}*/ 
			} 			 
			return elementType;
		} 
		 
		if(value instanceof OneToMany) {
			return ((OneToMany)value).getReferencedEntityName();
		} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getComparator, getType
        } 
    } 
 
    private void addMapper(CommonCollectionMapperData commonCollectionMapperData, MiddleComponentData elementComponentData,
                           MiddleComponentData indexComponentData) {
        Type type = propertyValue.getType();
        if (type instanceof SortedSetType) {
			currentMapper.addComposite(propertyAuditingData.getPropertyData(),
					new SortedSetCollectionMapper(commonCollectionMapperData,
							TreeSet.class, SortedSetProxy.class, elementComponentData, propertyValue.getComparator()));
		} else if (type instanceof SetType) {
			currentMapper.addComposite(propertyAuditingData.getPropertyData(),
                    new BasicCollectionMapper<Set>(commonCollectionMapperData,
                    HashSet.class, SetProxy.class, elementComponentData));
        } else if (type instanceof SortedMapType) {
            // Indexed collection, so <code>indexComponentData</code> is not null. 
			currentMapper.addComposite(propertyAuditingData.getPropertyData(),
					new SortedMapCollectionMapper(commonCollectionMapperData,
							TreeMap.class, SortedMapProxy.class, elementComponentData, indexComponentData, propertyValue.getComparator()));
        } else if (type instanceof MapType) {

4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getCacheRegionName, getCollectionTable
    /** 
     * Build the value mapping. 
     */ 
    private void buildMapping( Collection mapping )
    { 
        String cacheRegion = mapping.getCacheRegionName();
        String collectionTable = mapping.getCollectionTable().getName();
        TableInvalidation rules = getOrCreateTableRule( collectionTable );
        rules.addCollectionRole( cacheRegion );
    } 
 
    /** 
     * Add invalidation rules. 
     */ 
    private TableInvalidation addTableRule( String tableName, String className )
    { 
        Class entityClass = className != null ? findClass( className ) : null;
        TableInvalidation rule = new TableInvalidation( tableName, entityClass );
        this.rules.addTableRule( rule );
        return rule;
3
CodeRank
Connect your IDE to all the code out there  Get Codota for Java