[hibernate-issues] [Hibernate-JIRA] Commented: (METAGEN-29) Embedded generic types not supported by metamodel generator

Hardy Ferentschik (JIRA) noreply at atlassian.com
Wed May 12 12:49:24 EDT 2010


    [ http://opensource.atlassian.com/projects/hibernate/browse/METAGEN-29?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=37092#action_37092 ] 

Hardy Ferentschik commented on METAGEN-29:
------------------------------------------

Here is a  "boiled down" version of the problem:

{noformat}
@MappedSuperclass
public abstract class AbstractEntity<T> {

	@Id
	@GeneratedValue
	private Long id;

	private T foo;

	public AbstractEntity() {
	}
}
{noformat}

{noformat}
@Entity
public class Person extends AbstractEntity<String> {
	private String name;

	protected Person() {
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
}
{noformat}

The problem is that the type visitor in {{AnnotationMetaEntity}} does currently not handle visiting a type variable. The generated meta class {{AbstractEntity_}} should use the upper bound of T for the property. In the example {{SingularAttribute<AbstractEntity, Object>}}.

> Embedded generic types not supported by metamodel generator
> -----------------------------------------------------------
>
>                 Key: METAGEN-29
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/METAGEN-29
>             Project: Hibernate Metamodel Generator
>          Issue Type: Bug
>          Components: processor
>    Affects Versions: 1.0.0-CR-1
>         Environment: Hibernate 3.5.0-CR-2
>            Reporter: Adrian Hummel
>            Assignee: Hardy Ferentschik
>            Priority: Critical
>             Fix For: 1.1.0
>
>         Attachments: bugreport.zip
>
>
> Scenario: I have a @MappedSuperclass defining an abstract entity. This class has a technical primary key and a business identity. The business identity is realized by means of a generic embeddable (e.g. for a Customer class there is a corresponding CustomerId class for its business identity).
> The JPAMetaModelEntityProcessor does generate the AbstractEntity_ class but does only include the primary key field but omits the generic field for the business identity (which leads to subsequent errors when accessing this field using a CriteriaBuilder).
> Attached a mini project with a test case which illustrates the problem. 

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