Problem Faced in Hibernate
Here i will add all the problem related to Hibernate which i have faced while developing the Application in Hibernate.
Problem Type: java.lang.ClassCastException: org.hibernate.type.StringType cannot be cast to org.hibernate.type.VersionType
Problem In: Hibernate Tool While reverse engineering
Reason for this problem: In one of my table there was a field named version. Which Hibernate tool treated as field version and try to cast the same and it throws an exception becasue the type of the field was not what hibernate tool was expecting.
Resolution: Open the hbm configuration file for corresponding table and change the configuration of that field from <version> to <property> .
Other Detail: More details could be found here
—————————————————————————————-
Difference between
<property name=”hibernate.show.sql”>true</property> &
<property name=”show_sql”>true</property>
Second one is displaying the query while first one is not displaying query in console.
Why Hibernate is not working properly if default schema is provided explicitly
If default schema is provided in connection URL and explicitly then it cause problem inn Hibernate
<property name=”hibernate.connection.url”>jdbc:mysql://localhost/abc</property>
<property name=”hibernate.default_schema”>abc</property>
—————————————
Problems: If using Hibernate Tools and there is two tables with same name only difference is for number or special character(ABC & ABC1 & ABC_) then tool will throw error saying the generated classes are same for theses tables.
Resolution: Manual class creation can be done. To exclude given Tables while creating mapping and class file reveng.xml file can be used.
