This issue was originally reported in which was closed as the issue was not verified with recent versions of hibernate. Unfortunately, the problem still exists.
create two tables a and b with identical primary keys,
add a foreign key to table b referencing the primary key of table a,
add some records to the tables,
use spring roo (1.3.1.RELEASE) to reverse engineer the table, create JPA entities and MVC,
run the generated code in tomcat. On trying to list the contents of one of the tables, the org.hibernate.TypeMismatchException is raised.
I will attach sample DDL and sources to this issue.
use only one primary key class for both tables (but this will not work nicely with roo)
change relationship from one-to-one to one-to-many (not verified by myself)
Ubuntu Linux 14.04, JDK 8u45, Spring Roo 1.3.1, Maven 3.3.1
Note: roo 1.3.1 creates the project with old versions of spring and roo. The pom.xml in the attached zip file was updated to use the current versions.
This bug report does not indicate that the reported issue affects version 5.x. Versions prior to 5.x are no longer maintained. It would be a great help to the Hibernate team and community for someone to verify that the reported issue still affects version 5.x. If so, please add the 5.x version that you verified with to the list of affected-versions and attach the (preferably SSCCE) test case you used to do the verification to the report; from there the issues will be looked at during our triage meetings.
For details, see http://in.relation.to/2015/10/27/great-jira-cleanup-2015/
As part of verifying that this issue affects 5.0, please just set the "Affects version". Leave the "verify-affects-5.0" label and leave the issue in "Awaiting Response" status; these are critical for us to be able to track these verifications and triage them. Thanks.
I just verified that the problem still occurs with Hibernate 5.0.9 and 5.1.0.
Steps to reproduce:
create sample database (see attached ddl)
adjust database.properties in sample project to point to sample database.
run project in tomcat using mvn tomcat7:run
load web interface (see console output for URL), try to list As or Bs.
Note: problem only occurs if the database tables are non-empty, so make sure you insert a few records.