[hibernate-issues] [Hibernate-JIRA] Commented: (ANN-526) Property xyz has an unbound type - is that so?
Paolo "Nusco" Perrotta (JIRA)
noreply at atlassian.com
Thu Jan 18 05:13:47 EST 2007
[ http://opensource.atlassian.com/projects/hibernate/browse/ANN-526?page=comments#action_25837 ]
Paolo "Nusco" Perrotta commented on ANN-526:
--------------------------------------------
It's a broader problem than I thought. I'm still not 100% sure that fixing it will change the behaviour described by Sebastian, but I found other cases that are more clearly pathological. For example, this is not approximated correctly, even if in theory it should:
class SomeGenericType<T extends SomeType> {
public T property() {return null;}
}
We don't even have recursive definitions here, but HA still doesn't notice that the property type can be approximated to a SomeType. The problem is that I focused on resolving generic types in hierarchies - but there are cases (like the one above) where you can make a decent approximation of types by just looking at the class itself. It's not really a bug, as this is on the border of what people should be expecting to do - but as a feature request, it's very reasonable. What do you think, Emmanuel?
We have many corner cases where type binding doesn't work as well as Java's - generics in interfaces, inner classes and so on. Java makes extremely difficult to work reflexively at this level. This one probably deserves fixing, though.
> Property xyz has an unbound type - is that so?
> ----------------------------------------------
>
> Key: ANN-526
> URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-526
> Project: Hibernate Annotations
> Type: Bug
> Versions: 3.2.1
> Reporter: Sebastian Kirsch
> Assignee: Paolo "Nusco" Perrotta
> Priority: Minor
> Attachments: Hibernate ANN-526.zip
>
>
> I get this "Property reference has an unbound type and no explictit target entity" exception and I think this is not exactly true. I'm not sure if this is a bug or a feature requests though.
> Have a look at the attached files and read on.
> I guess the model ist pretty easy to understand. The AbstractGeneric allows my to have concrete entities referring to specifc other subclasses - as seen in ConcreteOther and ConcreteSelf. The test case "workingClasses" shows us that Hibernate may work with this model - note that the class AbstractGeneric itslef was NOT added to the configuration.
> Now for the problem: The class OtherEntity is a completly different entity, but it refers to instances of AbstractGeneric - to any subclass of it actually, as AbstractGeneric is obviously abstract.
> If you run the test case "otherClass" the first part states that Hibernate doesn't know AbstractGeneric - which is fine, so I add that class to the configuration and try to build a session factory again. Now we receive the beforementioned exception.
> That's the situation. So is AbstractGeneric really an unbound type? I'd say it is not - T has an upper bound which should be good enough to work with - we know the table and the PK...
--
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