Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4062024
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:32:46+00:00 2026-05-20T15:32:46+00:00

I want to manage a table with a VARCHAR primary key, that in the

  • 0

I want to manage a table with a VARCHAR primary key, that in the
mapped java object should be a UUID.

i have my sql-map-config.xml:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
   PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
   "http://mybatis.org/dtd/mybatis-3-config.dtd">

<configuration>
       <properties resource="database.properties"/>
   <typeHandlers>
       <typeHandler
handler="[...].persistence.typehandlers.UuidTypeHandler"
                    javaType="java.util.UUID"
                    jdbcType="VARCHAR"/>
   </typeHandlers>
       <environments default="development">
               <environment id="development">
                       <transactionManager type="JDBC" />
                       <dataSource type="POOLED">
                               <property name="driver" value="${driver}" />
                               <property name="url" value="${url}" />
                               <property name="username" value="${username}" />
                               <property name="password" value="${password}" />
                       </dataSource>
               </environment>
       </environments>
       <mappers>
               <mapper resource="user.xml" />
   </mappers>
</configuration>

and the user.xml is like that:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
       PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
       "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="[...].persistence.mappers.UserMapper">

   <select id="selectUserByUUID" parameterType="java.util.UUID"
resultMap="userResultMap">
       SELECT * FROM user WHERE uuid = #{uuid, jdbcType=VARCHAR,
typeHandler=[...].persistence.typehandlers.UuidTypeHandler}
   </select>
   <resultMap id="userResultMap" type="[...].model.User">
       <id property="uuid" column="uuid" jdbcType="OTHER"
typeHandler="[...].persistence.typehandlers.UuidTypeHandler"/>
       ...
   </resultMap>
</mapper>

anyway, i got this exception:

org.apache.ibatis.exceptions.PersistenceException:
### Error querying database.  Cause:
org.apache.ibatis.reflection.ReflectionException: There is no getter
for property named 'uuid' in 'class java.util.UUID'
### The error may involve
[...].persistence.mappers.UserMapper.selectUserByUUID-Inline
### The error occurred while setting parameters
### Cause: org.apache.ibatis.reflection.ReflectionException: There is
no getter for property named 'uuid' in 'class java.util.UUID'

it seems that my typehandler never gets called (i have it logging a
bit, but never prints anything).
Is there something wrong? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T15:32:47+00:00Added an answer on May 20, 2026 at 3:32 pm

    Seems kinda odd answering my own question, but i got some help on the mybatis-users list, so i’d like to share some hints here:

    Mybatis was trying to “get” a non-existing field:
    Luckily, one of mybatis developers helped me a while ago, suggesting that the easiest way to get it to work was to add a @Param annotation in the UserMapper to do this thing:

    public User selectUserByUUID(@Param("uuid") UUID uuid);
    
    <select id="selectUserByUUID" parameterType="uuid" resultMap="userResultMap"> 
    SELECT * FROM user WHERE uuid = #{uuid, typeHandler=com.collective.persistence.typehandlers.UuidTypeHandler, javaType=uuid, jdbcType=VARCHAR}
    </select> 
    

    I was stuck in watching the typehandler configuration, but,
    if I understood it right, this has not much to do with typehandlers,
    since they are used to “transport and translate” data between the sql
    table and the java objects (through setter and getters), while my
    issue was in the handling of methods’ parameters. Hope this helps someone.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple employee table that I want to display in a particular
I have a table full of title that I want to order by title.
I want to manage permissions and access to a SQL Server database server on
I want to ask pro developers out there that how they manage a big
I want to write a unit test for a Django manage.py command that does
I want to use the TFS WebAccess to open/manage work items. I have found
I have a Table that stores data on price movement over a minute. Each
I have an assignment problem that i can't manage to fix and got totally
I want to redistribute some values in a table in a database I manage.
In setting up a MySQL database, consider that I have a table of products

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.