In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Apply scene settin
Take the student information management system as an example to demonstrate the addition, deletion, modification and query of student information. Here, the student's Bean class is defined as:
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 () {
}
}
The API for adding, deleting, modifying and querying students is defined as follows:
IStudentDao.java
Public interface IStudentDao {
Void insert (Student s)
Void update (Student s)
Void delete (String studentId)
}
The API implementation file for manipulating MongoDB is as follows
IStudentDaoImpl.java
Public class IStudentDaoImpl implements IStudentDao {
@ Override
Public void insert (Student s) {
/ / not implemented yet
}
@ Override
Public void update (Student s) {
/ / not implemented yet
}
@ Override
Public void delete (String studentId) {
/ / not implemented yet
}
}
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.