-
November 11th, 2018, 08:08 AM
#1
Hibernate: set and get and save
Hello;
Let us take the following code example:
Code:
@Column(name = "SERVICE_TYPES")
public String getServiceTypes() {
return serviceTypes;
}
public void setServiceTypes(String serviceTypes) {
this.serviceTypes = serviceTypes;
}
I need to know if setServiceTypes is related to database or not?
And regarding to getServiceTypes, it is fetching the data from the database and from column SERVICE_TYPES, but what if there were too many records in this table, so this will be used to fetch the value from the SERVICE_TYPES column for one record only? That means, I have first to fetch the record of the table and then I can use getServiceTypes method?
And regarding to save and commit, let us take the following example:
Code:
session.saveOrUpdate(customer);
HibernateUtil.commitTransaction();
This will be for one customer record? (As the customer is configured a class and annotated by @Entity and @Table and it implements Serializable).
Regards
Bilal
-
November 11th, 2018, 09:47 AM
#2
Re: Hibernate: set and get and save
With regard to the first question, this appears to be all custom code (i.e. code that is not standard framework code). That means it could be doing anything. My advice is to step through the code to find out. In the 2nd question, the code appears to act on a single record, but since HybernateUtil.saveOrUpdate is custom code, again you'll need to debug and step through the code to be sure.
-
November 11th, 2018, 09:57 AM
#3
Re: Hibernate: set and get and save
session.saveOrUpdate is custom code? It is not standard in Hibernate?
And regarding to this part:
@Column(name = "SERVICE_TYPES")
public String getServiceTypes() {
return serviceTypes;
}
is not hibernate? So all overall, it does not mean to get data from database?
Regards
Bilal
-
November 11th, 2018, 11:15 AM
#4
Re: Hibernate: set and get and save
Why can't you step through the code to find out? Do you know how to debug?
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|