java.lang.ClassCastException when using @JoinColumnsOrFormulas
---------------------------------------------------------------
Key: HHH-6811
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-6811
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.6.8
Environment: Ubuntu Linux, Oracle 11G DB
Reporter: Vladimir Tsichevski
The following declaration:
@Entity
@Table(name = "SOMETABLE")
public class Process {
@Id
@Column(name = "ID", length = 19, nullable = false)
long id;
@ManyToOne
@JoinColumnsOrFormulas({
@JoinColumnOrFormula(formula=@JoinFormula(value="PARENTID")) })
@Fetch(FetchMode.JOIN)
Process parent;
}
causes the following exception:
java.lang.ClassCastException: org.hibernate.mapping.Formula cannot be cast to
org.hibernate.mapping.Column
at org.hibernate.cfg.annotations.TableBinder.bindFk(TableBinder.java:360)
at
org.hibernate.cfg.annotations.CollectionBinder.bindCollectionSecondPass(CollectionBinder.java:1460)
at
org.hibernate.cfg.annotations.CollectionBinder.bindOneToManySecondPass(CollectionBinder.java:766)
at
org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:696)
at
org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:645)
at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:65)
at org.hibernate.cfg.Configuration.originalSecondPassCompile(Configuration.java:1716)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1423)
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1375)
at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1519)
at
org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:193)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:1100)
at
org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904)
...
Note: if I just use:
@ManyToOne @JoinColumn(name = "PARENTID")
everything works well.
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira