Java Manipulation mongodb_2 (application scenario settings)

Source: Internet
Author: User


Application Scenario Settings

Taking students ' information management system as an example, this paper demonstrates the change of students ' information. The bean classes that define students here are:


Student.java


public class Student {

Private String StudentID;

private String name;

private int weight;

private int height;

Private Date birthday;

Public String Getstudentid () {

return studentid;

}

public void Setstudentid (String studentid) {

This.studentid = StudentID;

}

Public String GetName () {

return name;

}

public void SetName (String name) {

THIS.name = name;

}

public int getweight () {

return weight;

}

public void setweight (int weight) {

This.weight = weight;

}

public int getheight () {

return height;

}

public void setheight (int height) {

This.height = height;

}

Public Date Getbirthday () {

return birthday;

}

public void Setbirthday (Date birthday) {

This.birthday = Birthday;

}

@Override

Public String toString () {

Return "Student [studentid=" + StudentID + ", name=" + Name

+ ", weight=" + weight + ", height=" + height + ", birthday="

+ Birthday + "]";

}

Public Student (String StudentID, string name, int weight, int height,

Date birthday) {

Super ();

This.studentid = StudentID;

THIS.name = name;

This.weight = weight;

This.height = height;

This.birthday = Birthday;

}

Public Student () {

}

}

and define the student's additions and deletions to check the interface as follows:

Istudentdao.java

Public interface Istudentdao {

void Insert (Student s);

void Update (Student s);

void Delete (String studentid);

}



The interface implementation file that manipulates MongoDB is as follows,

Istudentdaoimpl.java

public class Istudentdaoimpl implements istudentdao{


@Override

public void Insert (Student s) {

Temporarily not implemented

}


@Override

public void Update (Student s) {

Temporarily not implemented

}


@Override

public void Delete (String studentid) {

Temporarily not implemented

}

}



Java Manipulation mongodb_2 (scenario settings)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.