0

我收到一个无法在 Eclipse 中重现但出现在服务器上的奇怪错误。

说:

Caused by: java.sql.BatchUpdateException: Batch entry 0 
update public.user set 
    is_at='[B@136ef65', 
    user_name='elk', 
    password='33e79218965eb72c92a549dd5a330113', 
    location_precision=NULL, 
    location_simulated=NULL, 
    active=NULL, 
    last_seen_at='2013-02-20 08:13:45.992000 +01:00:00', 
    app_uuid=NULL, 
    avatar_url='http://server.org/img/avatars/10.png', 
    email='mail@mail.com', 
    score=NULL, 
    phrase='hibernate fail', 
    state=NULL, 
    reputation=NULL, 
    reputation_desc=NULL, 
    privacy_settings='visibleForAll', 
    gender='male', 
    email_verified='1', 
    geom='SRID=4326;POINT(2.209740161895752 41.400447845458984)' 
where user_id='[B@19ee400' 
was aborted.  Call getNextException to see the cause.

跟随

java.lang.IllegalArgumentException: id to load is required for loading

它失败是因为(休眠?)无法将属性 is_at 和 user_id 转换为字符串。它似乎试图用对象上的某种二进制表示来参数化查询。

相关 hbm.xml 片段:

<id name="userId" type="java.lang.Long">
    <column name="user_id" />
    <generator class="sequence">
        <param name="sequence">user_user_id_seq</param>
    </generator>
</id>
<many-to-one name="checkin" class="org.server.entity.Checkin" fetch="select">
    <column name="is_at" />
</many-to-one>

我看不到任何奇怪的东西,也许更多的眼睛看得更多?奇怪的是,在我的 IDE 中工作。有人见过类似的错误吗?

hibernate: 3.6.2
版本 tomcat 6.0.33
java openjdk 1.6.0.18
postgresql: 8.3.9

更新:

用于此的 Java 代码:

// queryHistory is to be persisted
// user is not null 
queryHistory.setUser(user);
queryHistory.setApiKey(apiKey);


// create point
Coordinate coordinate = new Coordinate(queryHeader.getLocLon(),queryHeader.getLocLat());
GeometryFactory geometryFactory = new GeometryFactory(new PrecisionModel(),4326);
Point point = geometryFactory.createPoint(coordinate);

queryHistory.setGeom(point);

if(user!=null) {
        user.setGeom(point);
        user.setLastSeenAt(new Timestamp(new Date().getTime()));
        hSession.update(user);
}

hSession.persist(queryHistory);
t.commit();

提前致谢

4

0 回答 0