I am trying to use @JoinColumnOrFormula because I need to join second column by formula. My Hibernate version is 3.6. My annotations look like this - @JoinColumnsOrFormulas({ @JoinColumnOrFormula(column=@JoinColumn(name = "SLITOK_REQUEST_MAJOR", nullable=false)), @JoinColumnOrFormula( formula=@JoinFormula(value="select 1 from dual", referencedColumnName="ID_MEGA")), @JoinColumnOrFormula(column=@JoinColumn(name = "SLITOK_REQUEST_MINOR", nullable=false)) })
When deploying my application I get following exception - Caused by: java.lang.ClassCastException: org.hibernate.mapping.Formula incompatible with org.hibernate.mapping.Column at org.hibernate.persister.collection.AbstractCollectionPersister.<init>(AbstractCollectionPersister.java:297) at org.hibernate.persister.collection.OneToManyPersister.<init>(OneToManyPersister.java:84) at org.hibernate.persister.PersisterFactory.createCollectionPersister(PersisterFactory.java:104) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:307) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1845) at ru.sbrf.vklad.dao.DaoFactory.<init>(DaoFactory.java:64) at ru.sbrf.vklad.dao.LocalDaoFactory.<init>(LocalDaoFactory.java:30) at java.lang.Class.newInstanceImpl(Native Method) at java.lang.Class.newInstance(Class.java:1328) at ru.sbrf.vklad.dao.DaoFactory.getInstance(DaoFactory.java:76) ... 49 more
Did anybody make this work, is there any workaround?
|