emacarron / mybatis

Automatically exported from code.google.com/p/mybatis
0 stars 0 forks source link

When building SqlSessionFactory without XML, it should be possible to add xml mapper file #22

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Reporter:    Igor Milina

Currently, when building SqlSessionFactory without XML it is only possible
to add mapper classes like this:

configuration.addMapper(BlogMapper.class);

I understand that iBATIS will automatically look for and load a peer XML
file if it exists (in this case, BlogMapper.xml would be loaded based on
the classpath and name of BlogMapper.class).

But this approach requires that BlogMapper class exists.
It should be possible to add BlogMapper.xml directly for users that wish to
use just .xml mappings without java interface.

Original issue reported on code.google.com by clinton....@gmail.com on 17 May 2010 at 1:43

GoogleCodeExporter commented 9 years ago
Henrik Kaipe added a comment - 21/Dec/09 01:02 PM
This can be done using XMLMapperBuilder in this manner:

new XMLMapperBuilder(xmlStreamAsReader, configuration,
nameForXmlStreamResourceAsString, sqlFragmentMap).parse();

From my understanding the above statement will parse statements from the xml 
and add
mapped statements to the configuration in the process. sqlFragmentMap will be
populated with sql-fragments and should be reused for all mapper-xmls that are 
added
to the specific configuration.
[ Show » ]
Henrik Kaipe added a comment - 21/Dec/09 01:02 PM This can be done using
XMLMapperBuilder in this manner: new XMLMapperBuilder(xmlStreamAsReader,
configuration, nameForXmlStreamResourceAsString, sqlFragmentMap).parse(); From 
my
understanding the above statement will parse statements from the xml and add 
mapped
statements to the configuration in the process. sqlFragmentMap will be 
populated with
sql-fragments and should be reused for all mapper-xmls that are added to the 
specific
configuration.

Original comment by clinton....@gmail.com on 17 May 2010 at 1:43

GoogleCodeExporter commented 9 years ago

Original comment by clinton....@gmail.com on 17 May 2010 at 3:23

GoogleCodeExporter commented 9 years ago

Original comment by clinton....@gmail.com on 17 May 2010 at 3:23

GoogleCodeExporter commented 9 years ago

Original comment by clinton....@gmail.com on 2 Jun 2010 at 4:46

GoogleCodeExporter commented 9 years ago
Issue 28 has been merged into this issue.

Original comment by eduardo.macarron on 4 Jan 2011 at 11:20