aspose file tools*
The moose likes Object Relational Mapping and the fly likes Setters/Getters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Setters/Getters" Watch "Setters/Getters" New topic
Author

Setters/Getters

Premila Devi Dayalan
Ranch Hand

Joined: Jul 19, 2009
Posts: 40
Dear Sir,

I'm a little less certain about exactly how these getters and setters will interact with all the various field types [Tecnically].

This patch adds a 'getter' and 'setter' attribute to all fields, which takes a string of a method to call when a field is retrieved or set.

This defines a getter returns a filtered value from the DB, a setter processes the value to add "_setter" to it in all cases, and on has_both we see a setter than implements the use case of updating another field when a property is set.


Example: We set the cam.model value as "TVM4" in the database and, when we intended to get the value from the database it will return as "TVM4"as well.A getter receives as its argument the current "real" value (the one that either came from the database, object construction, or a prior setting of the value), and what the getter returns is actually what the user gets back from the attribute.Please guide,me,hoe the setter and getters integrated with database with an Example.
.

A setter receives as its argument the value that the user is setting the property to, and what it returns is what the property will actually be set to.

Getters and setters do not operate during the creation of the object, but by retrieval from the database or creation by instantiating the class; Please advise.

Please correct me,if I am wrong.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

What is the context here? Are you asking about a specific ORM product?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Premila Devi Dayalan
Ranch Hand

Joined: Jul 19, 2009
Posts: 40
What mainly "Setter" and "Getter" did,in the Specification of Java.

Thanks.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

As far as I am aware, the Java language specifications doesn't mention getters or setters anywhere. Where did your quotes come from?
Premila Devi Dayalan
Ranch Hand

Joined: Jul 19, 2009
Posts: 40
Dear Sir,

Example:



** getOwner [getter] and setOwner [setter]


Thanks.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Yes, I know what getters and setters are, what I don't understand is your question:

Getters and setters do not operate during the creation of the object, but by retrieval from the database or creation by instantiating the class; Please advise

A little more context would help us understand what you are asking.
Premila Devi Dayalan
Ranch Hand

Joined: Jul 19, 2009
Posts: 40
Dear Sir,

These sentences,I am not very sure,It was right or wrong,do I am asking your suggesstions sir?
Getters and setters do not operate during the creation of the object, but by retrieval from the database or creation by instantiating the class;



Question:
1.I like to know,how setter and getter integrated with database,Technically,how the are integrated the data as per requested.
I know that mainly,we something as "ABC",and ask the machine to the value of the "ABC",that we already ,defaultly.

2.At here,I like to know,techically,how it work sir.

Thanks.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


1.I like to know,how setter and getter integrated with database,Technically,how the are integrated the data as per requested.

There is no integration between a getter/setter and the database, that is unless you are using an ORM tool.

Premila Devi Dayalan
Ranch Hand

Joined: Jul 19, 2009
Posts: 40
Dear Sir,

I am using Object-relational_mapping (ORM) tools here sir.

Thanks.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Which one? Is that where your quotes come from?
Premila Devi Dayalan
Ranch Hand

Joined: Jul 19, 2009
Posts: 40
Dear Sir,

Referring to these code:



How it is integrated with database sir,using ORM.Just for my undestanding itself.

Just a basic ideas sir.

Thanks.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Setters/Getters