emacarron / mybatis

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

Non-existent object id is incorrectly resolved when there is an entry with the same short name. #180

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What version of the MyBatis are you using?
3.0.3

Please describe the problem.  Unit tests are best!
For example, the following SQL map is parsed without an exception even if the 
include element references non-existent sql fragment.
...
<sql id="columnList">
  field1, field2
</sql>
...
<select id="selectInvalid" resultType="map">
  select
  <!-- Non-existent refid with the same short name -->
  <include refid="noSuchMapper.columnList" />
  from table1
</select>
...

What is the expected output? What do you see instead?
Expected: PersistenceException
Actual: No error

Please provide any additional information below.
Attached a test case and a patch.

Original issue reported on code.google.com by haraw...@gmail.com on 24 Nov 2010 at 3:49

Attachments:

GoogleCodeExporter commented 9 years ago
This appears to be a duplicate of issue 125.

Original comment by haraw...@gmail.com on 25 Nov 2010 at 5:01

GoogleCodeExporter commented 9 years ago

Original comment by christia...@ircm.qc.ca on 14 Feb 2011 at 4:18

GoogleCodeExporter commented 9 years ago
All tests pass except getting a mapped statement without a namespace.
I don't recommend such usage, but this patch will break any code using it.

Here is an example of such code:
MappedStatement selectPet = configuration.getMappedStatement("selectPet");

I've still committed changes in revision 3624.

Original comment by christia...@ircm.qc.ca on 14 Feb 2011 at 7:11

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

Original comment by christia...@ircm.qc.ca on 14 Feb 2011 at 7:13

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

Original comment by eduardo.macarron on 15 Feb 2011 at 9:33

GoogleCodeExporter commented 9 years ago

Original comment by eduardo.macarron on 15 Feb 2011 at 9:34

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Good news, the following code is supported in revision 3625.
MappedStatement selectPet = configuration.getMappedStatement("selectPet");

However, when you specify a element name with a namespace, MyBatis no longer 
falls back to using the short name. For example, before revision 3625, 
"unknown.namespace.MyCache" could have used "com.mycache.MyCache" instead. Now 
using "unknown.namespace.MyCache" throws an exception. The same applies to 
include, resultMap, parameterMap and cache-ref.

Original comment by christia...@ircm.qc.ca on 16 Feb 2011 at 1:26

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

Original comment by eduardo.macarron on 2 Apr 2011 at 5:08

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

Original comment by christia...@ircm.qc.ca on 3 May 2013 at 12:39

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

Original comment by christia...@ircm.qc.ca on 7 May 2013 at 8:13

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

Original comment by christia...@ircm.qc.ca on 8 May 2013 at 2:25

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

Original comment by christia...@ircm.qc.ca on 8 May 2013 at 2:26