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

This code example shows how to use the following methods: getPropertyAccessor, isBackRef
	 * return accessors  
	 * @param mappedProperty 
	 * @return 
	 */ 
	private PropertyAccessor buildPropertyAccessor(Property mappedProperty) {
		if ( mappedProperty.isBackRef() ) {
			PropertyAccessor ac = mappedProperty.getPropertyAccessor(null);
			if(ac!=null) return ac;
		} 
		return accessor;
	} 
 
	 
	@Override 
	protected Getter buildPropertyGetter(Property mappedProperty, PersistentClass mappedEntity) {
		return buildPropertyAccessor(mappedProperty).getGetter( null, mappedProperty.getName() );
	} 
 
	 
	@Override 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setName
        Logger logger = mockLogger(); 
 
        replay(); 
 
        RootClass persistentClass = new RootClass();
        Property idProperty = new Property();
        idProperty.setName("id");
        persistentClass.setIdentifierProperty(idProperty);
        SampleEntity entity = new SampleEntity();
 
        HibernateEntityValueEncoder<SampleEntity> encoder = new HibernateEntityValueEncoder<SampleEntity>(
                SampleEntity.class, persistentClass, session, access, typeCoercer, logger);
 
        assertNull(encoder.toClient(entity));
 
        verify(); 
    } 
 
    @Test
    public void to_value_not_found() 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getCascadeStyle, getName, getValue, getValueGenerationStrategy, isInsertable
		// we need to dirty check collections, since they can cause an owner 
		// version number increment 
		 
		// we need to dirty check many-to-ones with not-found="ignore" in order  
		// to update the cache (not the database), since in this case a null 
		// entity reference can lose information 
		 
		boolean alwaysDirtyCheck = type.isAssociationType() && 
				( (AssociationType) type ).isAlwaysDirtyChecked(); 
 
		return new StandardProperty(
				property.getName(),
				property.getNodeName(),
				type,
				lazyAvailable && property.isLazy(),
				property.isInsertable(),
				property.isUpdateable(),
		        property.getGeneration() == PropertyGeneration.INSERT || property.getGeneration() == PropertyGeneration.ALWAYS,
				property.getGeneration() == PropertyGeneration.ALWAYS,
				property.isOptional(),

5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getName, getValue
         checkKeyProperties( id, extraId );
          
     } 
	protected void checkKeyProperties(Property id, Property extraId) {
		assertEquals(toPropertyName("customerid"), id.getName() );
         assertEquals(toPropertyName("ordernumber"), extraId.getName() );
          
         assertFalse(id.getValue() instanceof ManyToOne);
         assertFalse(extraId.getValue() instanceof ManyToOne);
	} 
      
     public void testKeyProperty() { 
        cfg.buildMappings(); 
         
        PersistentClass product = cfg.getClassMapping( toClassName(identifier("Product") ) );
         
        Property identifierProperty = product.getIdentifierProperty();
         
        assertTrue(identifierProperty.getValue() instanceof Component);
         
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getName, getPropertyAccessor, isBackRef
	 * {@inheritDoc} 
	 */ 
	public EntityMode getEntityMode() { 
		return EntityMode.MAP; 
	} 
 
	private PropertyAccessor buildPropertyAccessor(Property mappedProperty) { 
		if ( mappedProperty.isBackRef() ) { 
			return mappedProperty.getPropertyAccessor(null); 
		} 
		else { 
			return PropertyAccessorFactory.getDynamicMapPropertyAccessor(); 
		} 
	} 
 
	/** 
	 * {@inheritDoc} 
	 */ 
	@Override 
    protected Getter buildPropertyGetter(Property mappedProperty, PersistentClass mappedEntity) { 
		return buildPropertyAccessor(mappedProperty).getGetter( null, mappedProperty.getName() ); 
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getName
	 * Method getGetterSignature. 
	 * 
	 * @return String 
	 */ 
	public String getGetterSignature(Property p) {
		String prefix = c2j.getJavaTypeName( p, false).equals( "boolean" ) ? "is" : "get";
		return prefix + beanCapitalize( p.getName() );
	} 
 
	/** 
	 * @param p 
	 * @return foo -> Foo, FOo -> FOo 
	 */ 
	public String getPropertyName(Property p) {
		return beanCapitalize( p.getName() );
	} 
 
 
	// get the "opposite" collectionnae for a property. Currently a "hack" that just uses the same naming algorithm as in reveng, will fail on more general models! 
	public String getCollectionNameFor(Property property) {

5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getName
        this.typeCoercer = typeCoercer;
        this.logger = logger;
 
        Property property = persistentClass.getIdentifierProperty();
 
        propertyAdapter = propertyAccess.getAdapter(this.entityClass).getPropertyAdapter(property.getName());
    } 
 
    public String toClient(E value)
    { 
        if (value == null)
            return null; 
 
        Object id = propertyAdapter.get(value);
 
        if (id == null) 
        { 
            return null; 
        } 
 
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getValue, isComposite
 
            // null mapper - the mapping where already added the first time, now we only want to generate the xml 
            if (!addIdProperties(orig_id_mapping, (Iterator<Property>) id_mapper.getPropertyIterator(), null, true, audited)) {
                return null; 
            } 
        } else if (id_prop.isComposite()) {
            // Embedded id 
 
            Component id_component = (Component) id_prop.getValue();
 
            mapper = new EmbeddedIdMapper(getIdPropertyData(id_prop), id_component.getComponentClassName());
            if (!addIdProperties(rel_id_mapping, (Iterator<Property>) id_component.getPropertyIterator(), mapper, false, audited)) {
                return null; 
            } 
 
            // null mapper - the mapping where already added the first time, now we only want to generate the xml 
            if (!addIdProperties(orig_id_mapping, (Iterator<Property>) id_component.getPropertyIterator(), null, true, audited)) {
                return null; 
            } 
        } else { 

5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getName
		return PropertyAccessorFactory.getDynamicMapPropertyAccessor();
	} 
 
	protected Getter buildGetter(Component component, Property prop) {
		return buildPropertyAccessor(prop).getGetter( null, prop.getName() );
	} 
 
	protected Setter buildSetter(Component component, Property prop) {
		return buildPropertyAccessor(prop).getSetter( null, prop.getName() );
	} 
 
} 
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getPropertyAccessorName
     * @return An appropriate accessor. 
     * @throws MappingException 
     */ 
	public static PropertyAccessor getPropertyAccessor(Property property, EntityMode mode) throws MappingException {
		//TODO: this is temporary in that the end result will probably not take a Property reference per-se. 
	    if ( null == mode || EntityMode.POJO.equals( mode ) ) {
		    return getPojoPropertyAccessor( property.getPropertyAccessorName() );
	    } 
	    else if ( EntityMode.MAP.equals( mode ) ) {
		    return getDynamicMapPropertyAccessor();
	    } 
	    else { 
		    throw new MappingException( "Unknown entity mode [" + mode + "]" );
	    } 
	} 
 
	/** 
     * Retrieves a PropertyAccessor instance based on the given property definition and 
     * entity mode. 
     * 
Full Snippet Info
4
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE