First time using Idea,mybatis to get data from a database 2017-9-14

Source: Internet
Author: User
Tags code tag

1, install idea on this machine (the installation steps are not explained here).

2, open idea configuration maven

2.1 It takes a while to open idea, please wait patiently,

3. Create Project Projects

There's only one projiect in idea that can have multiple module.

3.1 Creating Project

Click Next

Click Next

Click on the + sign above

Archetypecatalog=internal

When you click Next

Just click Finish.

And then look at the following line of code

-darchetypecatalog=internal This line of code is placed on the top left of the project after the project has been built file->setting-> search maven->funning

4. Create a module

A project has multiple module

Right-click New----"Module" on the Created project

Just click OK.

Then the next step is all right.

Then we create a test file under the src file created by the module

Then the main and rest files are built next to the Java and resources files. On the Java file, right-click Marks derectory as and let him turn green. On the resources file, right-click Marks derectory as and let him turn into a picture.

5, after building the module project in the Pom.xml file under it we add the use of dependency. Look at the picture below:

If we also have other dependencies to add to the package can be added here.

Note Some computers do not support some versions of the dependent packages. When you add it on your computer, look at the status bar on the left to see if there are any related packages you've introduced.

If unsuccessful, it will not be displayed in the status bar on the left.

6, next write the code snippet note that the content we wrote is written under the main package under SRC.

6.1 First write our database corresponding to the entity class, in writing to the database work on the DAO layer.

Entity class:

DAO layer Interface:

To the once implemented class:

6.2 writes the jdbc.properties of the connection database and reads the jdbc.properties file mybatis-config.xml.

   

6.2 Testing

I've got a single side here. Because I want to write and delete the content next.

Note The test is written under SRC under the test file.

Execution Result:

Thanks for watching! If there is no, please leave a message to guide .....

Attached to some of the shortcut keys that idea uses frequently!!!!!!!!!!!!!!!!!!

  These shortcut keys have a small keyboard notebook and a notebook without a small keyboard some gap please use!!!

Common shortcut keys for idea

ALT + ENTER import package, auto fix
CTRL + N Find class
Ctrl+shift+n Finding files
Ctrl+alt+l Formatting Code
Ctrl+alt+o Optimizing imported classes and Packages
Alt+insert generate code (such as Get,set method, constructor, etc.)
Ctrl+e or Alt+shift+c recently changed code
Ctrl+r replacing text
Ctrl+f finding text
Ctrl+shift+space Auto-Complete code
CTRL + Space Code hints
Ctrl+alt+space class name or interface name hint
Ctrl+p Method Parameter Hints
Ctrl+shift+alt+n find a method or variable in a class
Alt+shift+c vs. recently modified code

Shift+f6 Refactoring-Renaming
Ctrl+x Deleting rows
Ctrl+d Copying rows
ctrl+/or ctrl+shift+/Comments (//or/.../)
CTRL+J Automatic Code
Ctrl+e recently opened files
CTRL+H Display class structure diagram
Ctrl+q displaying comment documents
Alt+f1 find where the code is located
Alt+1 quickly open or hide the engineering panel
ctrl+alt+ Left/right back to the last viewed location
ALT + Left/right Toggle Code View
ALT + Up/down Fast move location between methods
The Ctrl+shift+up/down code moves up/down.
F2 or SHIFT+F2 highlighting error or warning quick location

When the code tag is entered, press TAB to generate the code.
Select the text, press CTRL+SHIFT+F7, highlight all the text, and press ESC to highlight the disappear.
Ctrl+w selected code, continuous press will have other effects
Select the text, press ALT+F3, look down the same text, and highlight it.
Ctrl+up/down cursor jumps to the first or last line
Ctrl+b quickly open the class or method at the cursor

First time using Idea,mybatis to get data from a database 2017-9-14

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.