Pages

Customizing Property Access

Customizing Property Access

There are two ways to access the property , one is direct access ( through fields) and another is using getter or setter method of the property.
you can control this default property access behavior using default-access attribute in following xml mapping metadata :

<hibernate-mapping package="com" default-access="property">
- - -
</hibernate-mapping>

There are following values of this attribute. 
default-access="field|property|noop|custom.Class"

You can also control this access strategy on the property element in hibernate xml mapping with access attribute.
<property name="itemName" column="ITEM_NAME" access="property"/>

Noop value is used to map a property that doesn't exist in java persistent class. you can use it to map virtual property in HQL queries.

You can also create your own custom property access strategy by implementing org.hibernate.property.PropertyAccessor interface on a class.

class MyPropertyAccessStrategy implements PropertyAccessor {

@Override
public Getter getGetter(Class arg0, String arg1)
throws PropertyNotFoundException {
return null;
}

@Override
public Setter getSetter(Class arg0, String arg1)
throws PropertyNotFoundException {
return null;
}
}

7 comments:

  1. Well and informative content provided about LOAN AGAINST PROPERTY, LOAN AGAINST SALARY , LOAN AGAINST CAR. Thanks for given this information here about this blog.
    Flats in Chhattarpur Enclave Phase1

    ReplyDelete
  2. Great Article… I love to read your articles because your writing style is too good, its is very very helpful for all of us and I never get bored while reading your article because, they are becomes a more and more interesting from the starting lines until the end.

    rpa training in bangalore
    best rpa training in bangalore
    RPA training in bangalore
    rpa courses in bangalore

    ReplyDelete
  3. Thank you for benefiting from time to focus on this kind of, I feel firmly about it and also really like comprehending far more with this particular subject matter. In case doable, when you get know-how, is it possible to thoughts modernizing your site together with far more details? It’s extremely useful to me 
    python Online training in chennai
    python Online training in bangalore
    python interview question and answers

    ReplyDelete
  4. Nice post. By reading your blog, i get inspired and this provides some useful information. Thank you for posting this exclusive post for our vision. 
    AWS Training in Bangalore

    ReplyDelete
  5. This is quite educational arrange. It has famous breeding about what I rarity to vouch. Colossal proverb. This trumpet is a famous tone to nab to troths. Congratulations on a career well achieved. This arrange is synchronous s informative impolites festivity to pity. I appreciated what you ok extremely here 
    python training in chennai
    Python Online training in usa
    python course institute in chennai

    ReplyDelete
  6. Happy to found this blog. Good Post!. It was so good to read and useful to improve my knowledge as updated one, keep blogging. Hibernate Training in Electronic City
    Java Training in Electronic City

    ReplyDelete