Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MYBATIS MAPPING ERROR on 3.2.7 but GOOD on 3.0.3

 
kristian Delos Reyes
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello guys I'm experiencing a mapping error on my project when using mybatis 3.2.7.jar but Im having a good time when using mybatis 3.0.

(trial is based on loaine sample hello world mybatis) please see whole sample project file here:







log4j:WARN No appenders could be found for logger (org.apache.ibatis.logging.LogFactory). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException:
Error updating database. Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for Customer.updateByPrimaryKeySelective
Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for Customer.updateByPrimaryKeySelective

at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:26)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:154)
at test.dao.CustomerDAO.updateByPrimaryKeySelective(CustomerDAO.java:91)
at test.trial.main.main(main.java:27)

Caused by: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for Customer.updateByPrimaryKeySelective at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:797) at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:631) at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:624) at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:151) ... 2 more
 
James Boswell
Bartender
Posts: 1051
5
Chrome Eclipse IDE Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How have you loaded the mapping files? The exception suggests it cannot find the mapping "updateByPrimaryKeySelective"
 
kristian Delos Reyes
Greenhorn
Posts: 6
 
kristian Delos Reyes
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's my structure....

SQL Session is pointing to SQLMAPCONFIG.XML
mapping and queries are pointed to CustomerMapper.xml
mybatis.png
[Thumbnail for mybatis.png]
structure
 
James Boswell
Bartender
Posts: 1051
5
Chrome Eclipse IDE Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kristian

I cannot access that download at the moment.

Could you show the load that loads the XML files? I suspect they are not being found?

BTW, are you able to run any of the other named myBatis statements?

Please also use code tags where appropriate in your posts. I have added them for you this time.
 
kristian Delos Reyes
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi James,

thanks for your help.... its

 
kristian Delos Reyes
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi James, by the way

using mybatis 3.0.3 it is a success! but when I converted my library from 3.0.3 to 3.2.7... it doesn't work anymore... then reverts to mybatis 3.0.3 it works again
 
James Boswell
Bartender
Posts: 1051
5
Chrome Eclipse IDE Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't see CustomerMapper.xml listed in the file, should it not be present?
 
kristian Delos Reyes
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi james,

Sorry a while a go i posted the wrong config
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic