I would like to use IDs of type long for my persisted objects. However, I find that get() method requires a Serializable object as its ID parameter (discussed here). What is the best workaround?
2 Answers
Use a Long. Hibernate will do the correct mapping for you. And if you use Java 5, you can
long id = ...;
session.get (id);
and the compiler will do the rest.
1 Comment
ripper234
Great! This completes my first integration test using hibernate. It took several hours, but I can finally persist and read an entity!