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 8461509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:54:01+00:00 2026-06-10T13:54:01+00:00

I am inserting values to one of mysql table and I am getting following

  • 0

I am inserting values to one of mysql table and I am getting following exception:

Could not set property 'id' of 'class com.mycom.myproject.db.mybatis.model.FeedEntry' with    value '2' Cause: java.lang.IllegalArgumentException: java.lang.ClassCastException@175e216] with root cause.

Record is getting inserted successfully in table. In my table id is auto-increment and primary key with not null. In my mapper class I have

 <insert id="insertSelective" parameterType="com.mycom.myproject.db.mybatis.model.Category" >
<!--
  WARNING - @mbggenerated
  This element is automatically generated by MyBatis Generator, do not modify.
  This element was generated on Fri Aug 10 11:40:59 BST 2012.
-->
<selectKey resultType="java.lang.Integer" keyProperty="id" order="AFTER" >
  SELECT LAST_INSERT_ID()
</selectKey>
insert into category
<trim prefix="(" suffix=")" suffixOverrides="," >
  <if test="fSourceId != null" >
    f_source_id,
  </if>
  <if test="userId != null" >
    user_id,
  </if>
  <if test="author != null" >
    author,
  </if>
  <if test="name != null" >
    name,
  </if>

</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
  <if test="fSourceId != null" >
    #{fSourceId,jdbcType=INTEGER},
  </if>
  <if test="userId != null" >
    #{userId,jdbcType=BIGINT},
  </if>
  <if test="author != null" >
    #{author,jdbcType=VARCHAR},
  </if>
  <if test="name != null" >
    #{name,jdbcType=VARCHAR},
  </if>      
</trim>

so I don’t understand why I am getting the above exception if everything is all right.

Please let me know if I missed anything.

  • 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-06-10T13:54:02+00:00Added an answer on June 10, 2026 at 1:54 pm

    MyBatis is trying to call method “setId” on class FeedEntry with parameter of java.lang.Integer and the result is a ClassCastException.

    You need to ensure the result type of the select key gives correct type.

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

Sidebar

Related Questions

My normal process for inserting into one table and then getting the ID back
When inserting values into my table what do I edit here? Do I delete
I am inserting values into a table and below is my code protected void
I have a problem inserting values on my table. -------------------------------------------- | products_id | related_products_ids
Getting error while inserting values into database (SQL Server 2008) Implicit conversion from data
First i gave all values of row in JTAble. While inserting table values into
I am trying to take data from one mysql table and insert it in
One of my tables has the following definition: CREATE TABLE incidents ( id serial
I have two set of arrays in different MYSQL table. This what I want
I'm inserting multiple rows in a table, and I get this message: MySQL server

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.