开发者

Hibernate session.get() Problem with UUID string ID

开发者 https://www.devze.com 2023-01-13 17:00 出处:网络
I am having a problem with Hibernate. The primary key of ID in mysql table is UUID style String. e.g.08fe2a75-5d40-4645-896d-aab2a3ac开发者_C百科96b8

I am having a problem with Hibernate.

The primary key of ID in mysql table is UUID style String. e.g.08fe2a75-5d40-4645-896d-aab2a3ac开发者_C百科96b8

But I can not use session.get() to fetch out the data for some reason.

Software software=(Software)session.get(Software.class, id);

It seems ok with integer IDs.

Please advise


Activate the logging of the generated SQL to see what is happening exactly. This can be done by setting the following property in your Hibernate configuration:

<property name="hibernate.show_sql" value="true"/>

Or set the following category to debug in the configuration of your logging backend.

org.hibernate.SQL

Compare the generated query with the expected result (that works in your SQL client).

Reference

  • Hibernate Core reference guide
    • Section 3.5. "Logging"
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号