-->
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.  [ 2 posts ] 
Author Message
 Post subject: Access type in Java persistance with Hibernate
PostPosted: Tue Sep 02, 2008 8:52 am 
Newbie

Joined: Tue Sep 05, 2006 4:16 am
Posts: 1
on page 165 there is follwing :


@Entity
@Table(name="CATEGORY")
public class Category {
@Id @GeneratedValue
@Column(name = "CATEGORY_ID")
private Long id;
...
public Long getId() {
return this.id;
}
...
}
Mapping annotations are placed on the field declaration when direct field access
is enabled, as defined by the standard.
Whether field or property access is enabled for an entity depends on the position
of the mandatory @Id annotation. In the preceding example, it’s present on a
field, so all attributes of the class are accessed by Hibernate through fields. The
example before that, annotated on the getId() method, enables access to all
attributes through getter and setter methods.

--------------
my question is what is " all attributes of the class are accessed by Hibernate through fields" mean? all the attribute are defined as private , how can hinernate access the private attribute with out access the getter and setter method?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 02, 2008 9:59 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Through reflection. Learn some basic Java.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.