Hibernate ORM Mapping - 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 Mapping class.

This code example shows how to use the following methods: getIdentifierType, getReferencedPropertyType
	@Override 
	public Size[] defaultSizes(Mapping mapping) throws MappingException { 
		return super.getIdentifierOrUniqueKeyType( mapping ).defaultSizes( mapping ); 
	} 
 
	public boolean useLHSPrimaryKey() { 
		return false; 
	} 
	 
	public Object hydrate(ResultSet rs, String[] names, SessionImplementor session, Object owner) 
	throws HibernateException, SQLException { 
		return super.getIdentifierOrUniqueKeyType( session.getFactory() ) 
			.nullSafeGet(rs, names, session, owner); 
	} 
	 
	// TODO: copy/paste from ManyToOneType 
 
	public Serializable disassemble(Object value, SessionImplementor session, Object owner) 
	throws HibernateException { 
 

7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: getIdentifierType, getReferencedPropertyType
			PreparedStatement st, 
			Object value, 
			int index, 
			SessionImplementor session) throws HibernateException, SQLException { 
		getIdentifierOrUniqueKeyType( session.getFactory() ) 
				.nullSafeSet( st, getIdentifier( value, session ), index, session ); 
	} 
 
	public ForeignKeyDirection getForeignKeyDirection() { 
		return ForeignKeyDirection.FOREIGN_KEY_FROM_PARENT; 
	} 
 
	public Object hydrate( 
			ResultSet rs, 
			String[] names, 
			SessionImplementor session, 
			Object owner) throws HibernateException, SQLException { 
		// return the (fully resolved) identifier value, but do not resolve 
		// to the actual referenced entity instance 
		// NOTE: the owner of the association is not really the owner of the id! 

6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: sqlType
    } 
 
    public void nullSafeSet(PreparedStatement st, Object value, int index) throws HibernateException, SQLException {
        try { 
            if (value == null) { 
                st.setNull(index, type.sqlType());
            } else { 
                Object identifier = identifierMethod.invoke(value, new Object[0]);
                type.set(st, identifier, index);
            } 
        } catch (Exception e) {
            throw new HibernateException("Exception while invoking identifierMethod '" + identifierMethod.getName() + "' of " +
                    "enumeration class '" + enumClass + "'", e);
        } 
    } 
 
    public int[] sqlTypes() { 
        return sqlTypes;
    } 
 
Full Snippet Info
3
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: sqlType
    { 
        try 
        { 
            if (value == null) 
            { 
                st.setNull(index, type.sqlType());
            } 
            else 
            { 
                Object identifier = identifierMethod.invoke(value, new Object[0]);
                type.set(st, identifier, index);
            } 
        } 
        catch (Exception e)
        { 
            throw new HibernateException("Exception while invoking identifierMethod '"
                + identifierMethod.getName() + "' of " + "enumeration class '" + enumClass + "'", e);
        } 
    } 
 
Full Snippet Info
3
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: getIdentifierType, getReferencedPropertyType
	 * Load an instance by a unique key that is not the primary key. 
	 * 
	 * @param entityName The name of the entity to load 
	 * @param uniqueKeyPropertyName The name of the property defining the uniqie key. 
	 * @param key The unique key property value. 
	 * @param session The originating session. 
	 * @return The loaded entity 
	 * @throws HibernateException generally indicates problems performing the load. 
	 */ 
	public Object loadByUniqueKey( 
			String entityName,  
			String uniqueKeyPropertyName,  
			Object key,  
			SessionImplementor session) throws HibernateException { 
		final SessionFactoryImplementor factory = session.getFactory(); 
		UniqueKeyLoadable persister = ( UniqueKeyLoadable ) factory.getEntityPersister( entityName ); 
 
		//TODO: implement caching?! proxies?! 
 
		EntityUniqueKey euk = new EntityUniqueKey( 

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: getReferencedPropertyType
		// I don't believe that Mapping#getReferencedPropertyType accounts for the identifier property; so 
		// if it returns for a property named 'id', then we should have a non-id field named id 
		try { 
			return factory.getReferencedPropertyType( entityType.getAssociatedEntityName(), EntityPersister.ENTITY_ID ) != null; 
		} 
		catch( MappingException e ) { 
			return false; 
		} 
	} 
 
	protected void initComponentPropertyPaths( 
			final String path, 
			final CompositeType type, 
			final String[] columns, 
			final String[] columnReaders, 
			final String[] columnReaderTemplates, 
			String[] formulaTemplates, final Mapping factory) throws MappingException { 
 
		Type[] types = type.getSubtypes(); 
		String[] properties = type.getPropertyNames(); 
Full Snippet Info
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java