aspose file tools*
The moose likes Object Relational Mapping and the fly likes Using a non-pk join column in @Formula annotation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Using a non-pk join column in @Formula annotation" Watch "Using a non-pk join column in @Formula annotation" New topic
Author

Using a non-pk join column in @Formula annotation

Benny Zlo
Greenhorn

Joined: Jan 28, 2012
Posts: 7

Hello,

I am trying to access a join column (the join is performed using @SecondaryTables annotation) in the @Formula annoation.

I have something like this


Now when I look at the query generated by hibernate, I see that he does not use the alias it made for sectable1 to get some_other_column in the @Formula, but it uses the alias it made for primary_table.

How can I fix this? I came across @JoinColumnsOrFormulas I am not really sure if it's relevant to my problem, but regardless I have seen that is available only since 3.5.1, and unfortunately we are using Hibernate 3.2 (don't ask), and upgrading at this time would be quite a problem. So is there any other way?

 
Consider Paul's rocket mass heater.
 
subject: Using a non-pk join column in @Formula annotation
 
Similar Threads
Embed on Secondary Table
difference between joinColumn and PrimaryKeyJoinColumni
Hibernate: Problem with @SecondaryTable annotation
Hibernate generate timestamp on create and update
Content based discrimination with Hibernate annotations