-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: @JoinFormula ?
PostPosted: Mon Apr 14, 2008 1:25 pm 
Newbie

Joined: Mon Apr 14, 2008 12:52 pm
Posts: 1
I'm trying to map a legacy database, and I'd like to use a combination of two date fields of which the first (date_col) contains the date of interest and the second (time_col) contains the time of day.

I mapped the column with
Code:
  @Formula("(trunc(date_col) - trunc(time_col) + time_col)")
  private Date departure;

... which is all well, but what I'm also looking for is a @JoinFormula to use above property as a foreign key.

Code:
  @ManyToOne(fetch=FetchType.LAZY)
  @JoinColumns(value={
      @JoinColumn(name="areaid",referencedColumnName="areaid"),
      @JoinFormula(expression="(trunc(date_col) - trunc(time_col) + time_col)", referencedColumnName=departure_timestamp)
    })
  private DeparturePriority prio;


Is there a way to emulate this? I'm perfectly OK with some SQL here.

thanks in advance
Thomas.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.