These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Accesstype
PostPosted: Sat Jan 05, 2008 11:26 am 
Beginner
Beginner

Joined: Sat Oct 20, 2007 8:28 am
Posts: 28
can someone please explain what is the purpose of this annotation , i can't understand what is it's purpose .
thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 06, 2008 5:09 am 
Expert
Expert

Joined: Mon Nov 26, 2007 2:29 pm
Posts: 443
Amnon,

The possible values for the "access" attribute are:

property: it means that hibernate accesses the value of the class member by using the class getXXX method of that property. It is the most common and logical way to access an object's property value.

field: Hibernate can do weird stuff using the introspection API, and that allows it to access the property value directly from the field, without going through the getXXX method

in the following class:

Code:
  Class A{
    String example;
    public String getExample(){
      if (example==null)
        return null;
      else
        return example.toUpperCase();
    }
  }


if you set the access="property", it return the member variable in uppercase or a null. If you set access="field", it will return the exact content of the example property.


The same goes for the "seXXX" methods.


There is a third possible setting for access: "ClassName". This is used when the class you define is not a normal Java Bean, but a map with configurable properties. Don't worry about this one.

_________________
Gonzalo Díaz


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 06, 2008 1:08 pm 
Beginner
Beginner

Joined: Sat Oct 20, 2007 8:28 am
Posts: 28
thanks gonzao_diaz


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.