Hello, hibernate-dev! I've found following problem. I need, that my persistent entity Reference would have calculated field "title". It is a title of object, that my Reference entity refers to. My Reference entity also would have identifier of this object. This object can be an entity of classes in the different classes hierarhies. I want to calculate title field of Reference as object title. So, I'm writing this mapping:
<class name="Reference" ..> <property name="objectId" ../> <property name="title" formula="(select obj1.title from Table1 obj1 where obj1.Id=objectId union select obj2.title from Table2 obj2 where obj2.Id=objectId)"/> </class> I know, that this query in my case will return only one value. So, When hibernate is trying to load my Reference entity, it constructs wrong SQL query (something like this): select ..., objectId, (select obj1.title from Table1 obj1 where obj1.Id=objectId reference0_.union select obj2.title from Table2 obj2 where obj2.Id=objectId) from ReferenceTable reference0_ ... I think it is a bug. Could anybody comment my situation? P.S. My execution environment: Hibernate-Version: 3.2.5.ga Sincerely yours, Vadim Gindin mailto: [EMAIL PROTECTED]
_______________________________________________ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/hibernate-dev