hi Guys Cann't i Retrieve a persistence objects by String identifier..??
I tried the following example... My persistence object is
Class Book{ String ISBN; String bookName; // // //All my setter and getter method // // }
and Book.hbm.xml is
<hibernate-mapping> <class name="Book" table="Book"> <id name="ISBN"> <generator class="assigned"/> </id> <property name="bookName"/> </class> </hibernate-mapping>
Now while i try to retrieve the Book Object using the following line
Book myBook = (Book) session.get(Book.class, ISBN); I am getting the following error
hibernate.TypeMismatchException: Provided id of the wrong type. Expected: class java.lang.Integer, got class java.lang.String
Please Give me a solution...Cant i Retrieving a persistence objects by String identifier ??? or what can i do to retrieve my book object?
From Utpal Dutta
|