Win a copy of Java Challengers this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

MYBATIS MAPPING ERROR on 3.2.7 but GOOD on 3.0.3

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 1051
5
Hibernate Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply,

Here's the whole project file

http://forums.codeguru.com/showthread.php?545691-MYBATIS-MAPPING-ERROR-on-3-2-7-but-GOOD-on-3-0-3&p=2157129#post2157129
 
kristian Delos Reyes
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Hibernate Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi James,

thanks for your help.... its

 
kristian Delos Reyes
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Hibernate Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi james,

Sorry a while a go i posted the wrong config:)
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic