[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5587) InheritanceType.TABLE_PER_CLASS crashs when the primary classes have properties with the same name and different values ONLY USING JTA PERSISTENT-UNIT

Mauricio Chamati (JIRA) noreply at atlassian.com
Wed Sep 22 17:33:59 EDT 2010


InheritanceType.TABLE_PER_CLASS crashs when the primary classes have properties with the same name and different values ONLY USING JTA PERSISTENT-UNIT
------------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: HHH-5587
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5587
             Project: Hibernate Core
          Issue Type: Bug
          Components: core, entity-manager
    Affects Versions: 3.5.6
         Environment: Postgre 8.4, Hibernate 3.5.6-Final, Maven 2, Glassfish 3.01, JPA 2.0, EJB 3.1
            Reporter: Mauricio Chamati


I am trying to retrieve a list of Products (Entity). Each product has a list of a pair Attribute/Value mapped as follows:

     @OneToMany(cascade = javax.persistence.CascadeType.ALL, mappedBy="product", fetch=FetchType.EAGER)
     @MapKey(name="attribute")
     private Map<Attribute, Value<?>> attributes = new HashMap<Attribute, Value<?>>();

As this value can be of many types, I used "InheritanceType.TABLE_PER_CLASS" in the "Value.class".

Everything runs OK for LOCAL_RESOURCE persistent-unit.
But, running into the container using JTA that does not work. It gives the database error: "UNION types x and y cannot be matched." (being x and y types like numeric or date).

The generated query for JTA is something like this (I shorten it):

select *
	from (
		select id, attribute, product, value
		from value_datetime

		union all

		select id, attribute, product, value
		from value_decimal

		union all

		select id, attribute, product, value
		from value_integer

	) attributes
where product = ?


And of course, the values won't match.

-- 
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