dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Hibernate: set and get and save

  1. #1
    Join Date
    Sep 2018
    Posts
    4

    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

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    12,843

    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.

  3. #3
    Join Date
    Sep 2018
    Posts
    4

    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;
    }
    @Column
    is not hibernate? So all overall, it does not mean to get data from database?

    Regards
    Bilal

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    12,843

    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
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)