English 中文(简体)
Spring Jdbc Template + MySQL = TransientDataAccessResourceException: Invalid Argument 价值: Java。
原标题:Spring Jdbc Template + MySQL = TransientDataAccessResourceException : Invalid Argument Value : Java.io.notSerializationException

我正在使用春 j模板将一些数据输入数据库,我正在发现这一错误。

我的法典如下:

JdbcTemplate insert = new JdbcTemplate(dataSource);
        for(ResultType result : response.getResultSet().getResult())
        {
            Object[] args = new Object[] {result.getAddress(), result.getCity(), result.getState(), result.getPhone(), result.getLatitude(), result.getLongitude(),result.getRating().getAverageRating(), result.getRating().getAverageRating(), result.getRating().getTotalRatings(), result.getRating().getTotalReviews(), result.getRating().getLastReviewDate(), result.getRating().getLastReviewIntro(), result.getDistance(), result.getUrl(), result.getClickUrl(), result.getBusinessUrl(), result.getBusinessClickUrl()};
            insert.update("INSERT INTO data.carwashes ( address, city, state, phone, lat, lng, rating, average_rating, total_ratings, total reviews, last_review_date, last_review_intro, distance, url, click_url, business_url, business_click_url, category_id, zipcode_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,96925724,78701)", args);
        }

相当长的代码,但基本上从物体到阵列,然后通过该阵列,以插入jdbc模板。

任何帮助都将受到赞赏。

最佳回答

我的猜测是,贵方阵列中的一个项目是不受<代码>承认的一类。 JdbcTemplate , (i.e. It s not a String/code>, a Date, and so on, and so that it s打setObject ( on the statement. 然后,司机将尝试将这一论点编成双向,发现该论点不可序列化,并放弃该例外。

确保阵列中的论点都是你认为应该做的,例如, 它们是你自己的班子,但应当是标准的 Java类型。

问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...