[hibernate-issues] [Hibernate-JIRA] Created: (HCANN-8) Hibernate allow to embed non embeddable class

Maillefer Jean-David (JIRA) noreply at atlassian.com
Wed Aug 5 08:36:53 EDT 2009


Hibernate allow to embed non embeddable class
---------------------------------------------

                 Key: HCANN-8
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HCANN-8
             Project: Hibernate Commons Annotations
          Issue Type: Bug
         Environment: JBoss-5.1.0.GA, postgresql 8.4.0
            Reporter: Maillefer Jean-David
            Priority: Minor


Hibernate allows to embed  (successfully !)  a non embeddable class (if it was embeddable,  it would throw a compiler exception)

@Entity
public class BanqueId {
	@Id
	int id;
}

public class Compte{

	@ManyToOne
	@JoinColumn(name = "compte_banqueId_id", insertable = false, updatable = false)
	private BanqueId banqueId;

	@Column(name = "compte_iban", length = 30)
	private String iban;
}


@Entity
public class Cotisation {

	@Id
	int id;

	@Embedded
	private Compte compte;
}

In this case, using @Embeddable on Compte yields the following compiler error: "Attribute "banqueId" has invalid mapping type in this context"
Not using this annotation (as in this example) generates (at least partially) working code, but seems not to follow the specification (ejb 3.0 spec persistance, 9.1.35) !



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