[hibernate-issues] [Hibernate-JIRA] Commented: (ANN-210) @ManyToOne not working wth @Formula

Emmanuel Bernard (JIRA) noreply at atlassian.com
Tue Apr 24 19:10:04 EDT 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/ANN-210?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_26811 ] 

Emmanuel Bernard commented on ANN-210:
--------------------------------------

My idea was to have a
@JoinColumnOrFormulas
which contains an array of
@JoinColumnOrFormula(
   joinColumn=@JoinColumn, formula=@Formula
)

The rational behind that is to be able to keep the column ordering even if formula and columns are mix and matched

I am also considering having an org.hibernate.annotations.JoinColumn, I think some information might belong here (i need ot double check)

Look for AnnotationBinder and the use of Ejb3JoinColumn and Ejb3Column, the idea is to convert the new annotations into the Ejb3*Column object. HbmBinder is the reference on how actully map using the internal model



> @ManyToOne not working wth @Formula
> -----------------------------------
>
>                 Key: ANN-210
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-210
>             Project: Hibernate Annotations
>          Issue Type: Improvement
>          Components: binder
>    Affects Versions: 3.1beta7
>         Environment: Hibernate 3.1,  PostgreSQL 8.1.1
>            Reporter: Jason Long
>
> This type of mapping fails:
> @ManyToOne 
> @Formula(value="( select v_pipe_offerprice.offerprice_fk from v_pipe_offerprice where v_pipe_offerprice.id = id )") 
> public OfferPrice getOfferPrice() { return offerPrice; } 
> While the following mapping works as expected:
> <class name="Pipe" table="t_pipe"> 
>  ... 
>     <many-to-one name="offerPrice" 
>                  class="pipetracker.model.price.OfferPrice" 
>                  formula="( select v_pipe_offerprice.offerprice_fk 
>                               from v_pipe_offerprice 
>                               where v_pipe_offerprice.id = id )"/> 
> ... 
> </class>
> This is not being treated as a formula because the generated SQL included a referece to the field pipe.offerprice_id which does not exsist because this is a virtual column calculated from a view. 

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