[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3758) Data model object types issue with Id and Generics

Giovanni Azua (JIRA) noreply at atlassian.com
Fri Feb 6 09:04:38 EST 2009


Data model object types issue with Id and Generics
--------------------------------------------------

                 Key: HHH-3758
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3758
             Project: Hibernate Core
          Issue Type: Bug
          Components: core
    Affects Versions: 3.2.6
         Environment: Hibernate 3.2.6.ga, Windows XP, Maven 2.0.9, JDK 1.6.0_11
            Reporter: Giovanni Azua


Wanting to have a reusable base for Identifiable data model Object types and at the same time a stronger type checking (e.g. Generic DAO implementations) I introduced the interface and Abstract class below.

The problem is that my working models as soon as I extend from AbstractIdentifyable or just implement Identifyable, my test cases break with the following:
org.perfectjpattern.jee.api.integration.dao.DaoException: org.hibernate.exception.SQLGrammarException: could not insert: [example.datamodel.Person]

I suspect this is related to some kind of Hibernate use of Reflection that can't find in the model supertypes a definition of setId that matches exactly the type it expects e.g. Long but it is a generic parameter.

regards,
Giovanni

public interface Identifyable<Id extends java.io.Serializable>
{
       public Id getId();

       public void setId(Id anId);
}

and base abstract reusable implementation

public abstract class AbstractIdentifyable<Id extends java.io.serializable>
implements Identifyable<Id>
{
     // ... implements the reusable Identifyable methods
}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list