MyBatis on-line problem finder

Source: Internet
Author: User

The online reflection can not find the data, according to the business logic to find out the SQL to execute, there is actually data. For some reason, record the process of finding the problem. Greys Finding problems

Greys to find the problem on the line is still very helpful, address https://github.com/oldmanpushcart/greys-anatomy into Greys

The Java Process ID is first checked by JPS

sudo jps-l

Switch to jetty account, execute Greys script to enter

sudo su-jetty

SH greys.sh 16092 View Call Parameters

Ga?>watch-b com.dfire.soa.order.dao.ITotalPayDAO selecttotalpaycountinfo params[1]+ ' | ' +PARAMS[2]
Press Ctrl+d to abort.
Affect (Class-cnt:2, method-cnt:4) cost in 228 Ms.
Thu Oct 00:00:00 CST 2017| Sat Oct 00:00:00 CST 2017
Thu Oct 00:00:00 CST 2017| Sat Oct 00:00:00 CST 2017
Thu Oct 00:00:00 CST 2017| Sat Oct 00:00:00 CST 2017
Thu Oct 00:00:00 CST 2017| Sat Oct 00:00:00 CST 2017
Thu Oct 00:00:00 CST 2017| Sat Oct 00:00:00 CST 2017

OK, no problem. View return Parameters

Ga?>watch-s *mapper selecttotalpaycountinfo returnobj-x 1
Press Ctrl+d to abort.
Affect (Class-cnt:2, method-cnt:2) cost in 341 Ms.

Null

found that the return parameter is NULL, the return value has a problem locating

No problem from SQL, but the view type is Totalpaypo,

<select id= "Selecttotalpaycountinfo" resulttype= "Com.dfire.soa.order.domain.po.TotalPayPo" >

Returns the actual type required Totalpaycount

Totalpaycount Selecttotalpaycountinfo (@Param ("EntityId") String entity, @Param ("Currdate") Date currdate, @Param (" Twodayago ") Date Twodayago, @Param (" Ishide ") Integer ishide);

this place MyBatis no error, unbelievable.

View MyBatis source only to find that the problem occurs in the processing of the Defaultresultsethandler class, which is responsible for the assembly conversion of the returned data, where the Getrowvalue method foundvalues not found directly return NULL. Feel unreasonable here, should throw an exception, at least here should be able to configure, otherwise this configuration error can not be found in time.

  Private Object Getrowvalue (Resultsetwrapper rsw, Resultmap resultmap) throws SQLException {final Resultloadermap LA
    Zyloader = new Resultloadermap ();
    Object resultobject = Createresultobject (RSW, Resultmap, lazyloader, NULL); if (resultobject! = null &&!typehandlerregistry.hastypehandler (Resultmap.gettype ())) {Final MetaObject met
      Aobject = Configuration.newmetaobject (Resultobject);
      Boolean foundvalues = Resultmap.getconstructorresultmappings (). Size () > 0; if (Shouldapplyautomaticmappings (Resultmap,! AutoMappingBehavior.NONE.equals (Configuration.getautomappingbehavior ()))) {foundvalues = APPLYAUTOMATICMA Ppings (RSW, Resultmap, metaobject, null) | |
      Foundvalues; } foundvalues = Applypropertymappings (RSW, Resultmap, metaobject, Lazyloader, null) | |
      Foundvalues; Foundvalues = lazyloader.size () > 0 | |
      Foundvalues; Resultobject = foundvalues?
      Resultobject:null;
    return resultobject; } return Resultobject; }

Note: mybatis-3.2.7

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.