javaoraclemybatis

Java MyBatis Call a custom function in mapper to get secure information receive Error Oracle ORA-00904


I have a function secureUser.collection.getExampleId. This function returns an Example Id given a keyId. I am attempting to call this in a MyBatis mapper.


<mapper namespace="core.namespace.dao.mybatis.MyMapper">
   <resultMap id="Data" type="core.model.impl.table">
      <result column="column1" property="one" />
      <result column="column2" property="two" />
      <result column="column3" property="three" />
      <result column="secure" property="sec" />
   </resultMap>

   <select id="getSecure" parameterType="java.lang.Long" resultMap="Data">
      select column1, column2, column3, secureUser.collection.getExampleId(#{id}) secure
      from mytable mt
      where mt.keyId = #{id}
   </select>
</mapper>

When this code is called I receive an error ORA-00904: "SECUREUSER"."COLLECTION"."GETEXAMPLEID": invalid identifier. I ran this code in PL/SQL as written above and it works fine and return the correct data. After looking at the error I attempted to run the above code with the "'s around the secureUser, collection and getExampleId. When I ran that I received the same error that I was receiving from Java ORA-00904 so I figured that Java is putting the quotes around those values in the select statement.

How would I call this Oracle function secureUser.collection.getExampleId(#{id}) secure?

This is work data so I had to change all of the object names.


Solution

  • I have to apologize. The above does work. The function name was changed in the database. That was the issue with the Invalid Identifier message.