The following error occurs when you use ibatis to query data:
Java. Lang. instantiationexception: COM. Mangocity. Contract. EJB. roomtype, which literally means the. roomtype class cannot be instantiated. The roomtype class is used to encapsulate the query results. Each instance represents a query record. The following is a snippet of my ibatis configuration file:
<Select id = "queryroomtype" parameterclass = "Java. Lang. Long" resultclass = "com. Mangocity. Contract. EJB. roomtype">
Select
A. Upload _id as upload ID,
A. room_type_id as roomtypeid,
A. room_name as roomname
From htl_ii.v_roomtype
Where a. Route _id = # value #
</SELECT>
After searching for information, we found that the cause of this error is that there is no construction method without parameters in the roomtype class, because ibatis is being created in the object, an object is created using a constructor without parameters. Currently, my roomtype class has only one constructor with parameters.
Solution: Add a constructor without parameters to the roomtype class. The method does not have to perform any operations, just like the default constructor.
InHibernateEach persistence class must contain a constructor without parameters.