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"
精彩评论