@OneToOne Object references can't be used as @Id
------------------------------------------------
Key: ANN-681
URL:
http://opensource.atlassian.com/projects/hibernate/browse/ANN-681
Project: Hibernate Annotations
Issue Type: Bug
Components: binder
Affects Versions: 3.3.0.ga
Reporter: __dk__
Is this related to ANN-619, or is it in general impossible to use object refs as IDs?
Don't know:
Dummy:
class B {
@Id
[... Generator ...]
long id;
}
This works:
class A {
@Id
long id;
@OneToOne(optional=false, fetch=FetchType.LAZY)
@JoinColumn(name="B_ID", nullable=false, updatable=false)
B b;
}
This doesn't:
class A {
@Id
@OneToOne(optional=false, fetch=FetchType.LAZY)
@JoinColumn(name="B_ID", nullable=false, updatable=false)
B b;
}
Output:
05:59:11 FATAL [artcollector.welt.Persistence] Exception:
org.hibernate.MappingException: Could not determine type for: test.B, for columns:
[org.hibernate.mapping.Column(b_id)]
at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:266)
at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:253)
at org.hibernate.mapping.RootClass.validate(RootClass.java:193)
at org.hibernate.cfg.Configuration.validate(Configuration.java:1102)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1287)
at
org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:915)
at test.Persistence.init(Persistence.java:33)
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira