Extending Entity with Custom Properties

# Introduction In this project, you will learn how to add custom properties to an entity class and use a custom type handler to convert between Boolean and Integer values in a MyBatis application. ## 👀 Preview ``` ------------------------------------------------------- T E S T S ------------------------------------------------------- Running org.lanqiao.test.MyBatisTest Data deleted successfully Data added successfully [Course Number: 1 Course Name: Data Structures Instructor: Zoe Compulsory Course: false, Course Number: 2 Course Name: JAVA Instructor: William Compulsory Course: true, Course Number: 3 Course Name: Python Instructor: Olivia Compulsory Course: true, Course Number: 4 Course Name: C++ Instructor: Brian Compulsory Course: false, Course Number: 6 Course Name: C Instructor: Lisa Compulsory Course: true, Course Number: 8 Course Name: Artificial Intelligence Instructor: Tom Compulsory Course: true] Data updated successfully Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.119 sec ... cNo cName teacher cProperties 1 Software Testing Jack 1 2 JAVA William 1 3 Python Olivia 1 4 C++ Brian 0 6 C Lisa 1 8 Artificial Intelligence Tom 1 ``` ## ðŸŽŊ Tasks In this project, you will learn: - How to add a property to the `Course` entity class to represent the course property (Boolean `cProperties`, where `true` represents a required course and `false` represents an elective course) - How to create a custom type handler to convert between Boolean and Integer values - How to register the custom type handler in the MyBatis configuration file - How to update the course table and the `CourseMapper` to use the new `cProperties` field - How to use the custom type handler to update the course information in the database ## 🏆 Achievements After completing this project, you will be able to: - Extend the `BaseTypeHandler` class to create a custom type handler - Register a custom type handler in the MyBatis configuration file - Update the database schema and the corresponding mapper file to use a custom field - Use the custom type handler to update data in the database

|
60 : 00

Click the virtual machine below to start practicing